Coder Social home page Coder Social logo

Comments (21)

agl avatar agl commented on May 15, 2024

Comment 1:

What version of GCC? What distro?
If cgo is generating a .o file, could you attach that too?

from go.

gopherbot avatar gopherbot commented on May 15, 2024

Comment 2 by roblesjm:

I have the same error. I'm using Ubuntu 9.04 (Jaunty).

from go.

gopherbot avatar gopherbot commented on May 15, 2024

Comment 3 by roblesjm:

I forgot to specify my architecture, GOARCH=386.

from go.

gopherbot avatar gopherbot commented on May 15, 2024

Comment 4 by ejdiezfraile:

I have the same error in Ubuntu 8.04 (hardy) hosted in VirtualBox on Windows XP

from go.

gopherbot avatar gopherbot commented on May 15, 2024

Comment 5 by julians37:

I don't have the same error but the same test segfaults on me on AMD64:
--- cd ../misc/cgo/stdio
rm -rf *.[568vqo] *.a [568vq].out *.cgo[12].go *.cgo[34].c *.so _obj _test 
_testmain.go hello fib chain run.out
cgo  file.go
6g -o _go_.6 file.cgo1.go file.cgo2.go
6c -FVw -I/redacted/src/pkg/runtime -D_64BIT file.cgo3.c
make: *** [file.cgo3.6] Segmentation fault
make: *** Deleting file `file.cgo3.6'
$ uname -a
Linux heta 2.6.20.5_rsp_3.9 #1 SMP Wed Oct 14 16:24:34 EST 2009 x86_64 x86_64 
x86_64 GNU/Linux
$ gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ cat /etc/redhat-release 
CentOS release 5.3 (Final)

from go.

rsc avatar rsc commented on May 15, 2024

Comment 6:

Status changed to Accepted.

from go.

rsc avatar rsc commented on May 15, 2024

Comment 7:

Issue #43 has been merged into this issue.

from go.

gopherbot avatar gopherbot commented on May 15, 2024

Comment 8 by Sean.Stangl:

@1: The GCC version is "gcc (GCC) 4.4.1 20090725 (Red Hat 4.4.1-2)"; the distro is
Fedora 11.

from go.

gopherbot avatar gopherbot commented on May 15, 2024

Comment 9 by Sean.Stangl:

@1: Attached generated _cgo_.o.

Attachments:

  1. cgo.o (6600 bytes)

from go.

rsc avatar rsc commented on May 15, 2024

Comment 10:

Sean.Stangl: could you please hg pull -u
and try again?  It won't work but it should 
produce some more useful output when it breaks.
Thanks.

Status changed to WaitingForReply.

from go.

gopherbot avatar gopherbot commented on May 15, 2024

Comment 11 by Sean.Stangl:

@rsc:
I've discovered something strange about this bug: it doesn't occur when my $LANG is
en_US.UTF-8.
The default $LANG on my system is ru_RU.UTF-8. When I run all.bash with this setting,
I always get the following output.
----------------
--- cd ../misc/cgo/stdio
rm -rf *.[568vqo] *.a [568vq].out *.cgo[12].go *.cgo[34].c *.so _obj _test
_testmain.go hello fib chain run.out
cgo  file.go
could not determine kind of name for C.CString
could not determine kind of name for C.puts
could not determine kind of name for C.fflushstdout
could not determine kind of name for C.free
failed to interpret gcc output:
cc1: warnings being treated as errors
cgo-test: В функции ‘f’: (In the function 'f')
cgo-test:0: ошибка: оператор без побочного эффекта
(operator without side effect)
cgo-test:1: ошибка: оператор без побочного эффекта
cgo-test:2: ошибка: оператор без побочного эффекта
cgo-test:3: ошибка: оператор без побочного эффекта
make: *** [file.cgo1.go] Ошибка 2 (Error 2)
----------------
However, when I set $LANG to en_US.UTF-8 and then run all.bash, I get the following
(correct) output, and all tests pass:
----------------
--- cd ../misc/cgo/stdio
rm -rf *.[568vqo] *.a [568vq].out *.cgo[12].go *.cgo[34].c *.so _obj _test
_testmain.go hello fib chain run.out
cgo  file.go
6g -o _go_.6 file.cgo1.go file.cgo2.go
6c -FVw -I/home/sean/dev/go/src/pkg/runtime -D_64BIT file.cgo3.c
rm -f _obj/stdio.a
gopack grc _obj/stdio.a _go_.6 file.cgo3.6
cp _obj/stdio.a /home/sean/dev/go/pkg/linux_amd64/stdio.a
gcc -m64 -fPIC -O2 -o file.cgo4.o -c  file.cgo4.c
gcc -m64 -shared -lpthread -lm -o stdio_file.so file.cgo4.o 
cp stdio_file.so /home/sean/dev/go/pkg/linux_amd64/./stdio_file.so
6g hello.go
6l -o hello hello.6
6g fib.go
6l -o fib fib.6
6g chain.go
6l -o chain chain.6
rm stdio_file.so file.cgo4.o
rm -rf *.[568vqo] *.a [568vq].out *.cgo[12].go *.cgo[34].c *.so _obj _test
_testmain.go hello fib chain run.out
----------------
I have changed between the languages many times -- en_US.UTF-8 always succeeds, while
ru_RU.UTF-8 always fails. Hopefully this bit of information should help.

from go.

gopherbot avatar gopherbot commented on May 15, 2024

Comment 12 by libercv:

Same problem here with es_ES.utf8
It started working as soon as I changed to en_US.utf8
Distro archlinux, gcc version 4.4.2

from go.

gopherbot avatar gopherbot commented on May 15, 2024

Comment 13 by tequilasTeam:

Thanks  Sean.Stangl... problem solve...
Sorry for not writing more, my English is horrible...

from go.

gopherbot avatar gopherbot commented on May 15, 2024

Comment 14 by nicolas.b.pierron:

This issue is caused by the translation of error messages of GCC.  "cgo" use "gcc" to 
investigate types of each C symbols by creating a dummy function inside which each 
symbol is put on his own line.  The problem encounter here is that translated error 
messages do not match the registered error messages.
A possible work around would be to set LC_ALL=C before calling "cgo".  This could be 
done in a small shell script.
#!/bin/sh
LC_ALL=C /path/to/.cgo "@"
I am currently looking into fixing this inside src/pkg/cmd/*.go files.  I'll add 
attach a diff on this issue if I succeed to make it work without the script shell 
hack.

from go.

gopherbot avatar gopherbot commented on May 15, 2024

Comment 15 by nicolas.b.pierron:

Here is a small patch which fix this issue.

Attachments:

  1. cgo-set-local-to-match-gcc-error-messages.patch (405 bytes)

from go.

rsc avatar rsc commented on May 15, 2024

Comment 16:

Owner changed to [email protected].

Status changed to Started.

from go.

rsc avatar rsc commented on May 15, 2024

Comment 17:

Issue #1 has been merged into this issue.

from go.

rsc avatar rsc commented on May 15, 2024

Comment 18:

Thanks for diagnosing this, everyone.

from go.

rsc avatar rsc commented on May 15, 2024

Comment 19:

Issue #169 has been merged into this issue.

from go.

rsc avatar rsc commented on May 15, 2024

Comment 20:

This issue was closed by revision 0238fd8.

Status changed to Fixed.

Merged into issue #-.

from go.

rsc avatar rsc commented on May 15, 2024

Comment 21:

Issue #246 has been merged into this issue.

from go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.