Comments (21)
What version of GCC? What distro? If cgo is generating a .o file, could you attach that too?
from go.
I have the same error. I'm using Ubuntu 9.04 (Jaunty).
from go.
I forgot to specify my architecture, GOARCH=386.
from go.
I have the same error in Ubuntu 8.04 (hardy) hosted in VirtualBox on Windows XP
from go.
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.
Status changed to Accepted.
from go.
Issue #43 has been merged into this issue.
from go.
@1: The GCC version is "gcc (GCC) 4.4.1 20090725 (Red Hat 4.4.1-2)"; the distro is Fedora 11.
from go.
@1: Attached generated _cgo_.o.
Attachments:
- cgo.o (6600 bytes)
from go.
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.
@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.
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.
Thanks Sean.Stangl... problem solve... Sorry for not writing more, my English is horrible...
from go.
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.
Comment 15 by nicolas.b.pierron:
Here is a small patch which fix this issue.
Attachments:
- cgo-set-local-to-match-gcc-error-messages.patch (405 bytes)
from go.
Owner changed to [email protected].
Status changed to Started.
from go.
Issue #1 has been merged into this issue.
from go.
Thanks for diagnosing this, everyone.
from go.
Issue #169 has been merged into this issue.
from go.
This issue was closed by revision 0238fd8.
Status changed to Fixed.
Merged into issue #-.
from go.
Issue #246 has been merged into this issue.
from go.
Related Issues (20)
- proposal: time: allow scientific notation in ParseDuration HOT 7
- internal/runtime/atomic: TestAnd64 panics with "unaligned 64-bit atomic operation" error HOT 10
- x/tools/gopls: set non-zero exit code on `check` command when there are errors
- x/tools/go/ssa: commit 75ff53bc introduced a race condition
- build: archive/tar failures HOT 1
- cmd/cgo/internal/testplugin: TestIssue18676 failures HOT 1
- build: build failure on x_pkgsite-gotip-darwin-amd64_11 HOT 1
- cmd/go: TestScript/generate_bad_imports failures HOT 1
- build: bufio failures HOT 2
- x/vulndb: TestLintReports/data/reports/GO-2024-2667.yaml failures HOT 1
- "github.com/golang/glog": feature request: support for including stack trace in non-Fatal logs HOT 1
- x/sync/singleflight: runtime.Goexit blocks waiting channels forever HOT 1
- syscall: TestAmbientCapsUserns fails on Ubuntu 24.04/Linux 6.8.0 HOT 4
- runtime: TestGdbAutotmpTypes fails on Ubuntu 24.04 / gdb 15.0.50-20240403-0ubuntu1
- internal/runtime/atomic: TestAnd64 failures HOT 2
- net.Conn set 【SO_RCVBUF】, can‘t Close the Conn HOT 1
- net: TestLookupNoSuchHost failing on Plan 9 HOT 1
- Chinese string process error on Mac HOT 2
- x/text/unicode/bidi: consider reusing internal slices HOT 1
- x/spec: the selector rules list states that certain legal expressions are illegal HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go.