-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/cgo: package that fails to link during test with gccgo #3027
Labels
Comments
Maybe related to issue #1397. |
Forgot to attach the source... Attachments:
|
Labels changed: added priority-go1, removed priority-triage. Owner changed to builder@golang.org. Status changed to Accepted. |
Okay, here are slightly tweaked input files. I added //#cgo linux LDFLAGS: -libverbs to qp.go. $ go test -v -x -c ./... WORK=/dev/shm/go-build351850605 mkdir -p $WORK/ib/_test/ $GOROOT/pkg/tool/linux_amd64/cgo -objdir $WORK/ib/_test/ -- -I $WORK/ib/_test/ qp.go $GOROOT/pkg/tool/linux_amd64/6c -FVw -I $WORK/ib/_test/ -I $GOROOT/pkg/linux_amd64 -o $WORK/ib/_test/_cgo_defun.6 -DGOOS_linux -DGOARCH_amd64 $WORK/ib/_test/_cgo_defun.c gcc -I . -g -O2 -fPIC -m64 -pthread -I $WORK/ib/_test/ -o $WORK/ib/_test/_cgo_main.o -c $WORK/ib/_test/_cgo_main.c gcc -I . -g -O2 -fPIC -m64 -pthread -I $WORK/ib/_test/ -o $WORK/ib/_test/_cgo_export.o -c $WORK/ib/_test/_cgo_export.c gcc -I . -g -O2 -fPIC -m64 -pthread -I $WORK/ib/_test/ -o $WORK/ib/_test/qp.cgo2.o -c $WORK/ib/_test/qp.cgo2.c gcc -I . -g -O2 -fPIC -m64 -pthread -o $WORK/ib/_test/_cgo_.o $WORK/ib/_test/_cgo_main.o $WORK/ib/_test/_cgo_export.o $WORK/ib/_test/qp.cgo2.o -libverbs $GOROOT/pkg/tool/linux_amd64/cgo -objdir $WORK/ib/_test/ -dynimport $WORK/ib/_test/_cgo_.o -dynout $WORK/ib/_test/_cgo_import.c $GOROOT/pkg/tool/linux_amd64/6c -FVw -I $WORK/ib/_test/ -I $GOROOT/pkg/linux_amd64 -o $WORK/ib/_test/_cgo_import.6 -DGOOS_linux -DGOARCH_amd64 $WORK/ib/_test/_cgo_import.c $GOROOT/pkg/tool/linux_amd64/6g -o $WORK/ib/_test/_go_.6 -p ib -D ib -I $WORK ./qp_test.go $WORK/ib/_test/_cgo_gotypes.go $WORK/ib/_test/qp.cgo1.go $GOROOT/pkg/tool/linux_amd64/pack grc $WORK/ib/_test/ib.a $WORK/ib/_test/_go_.6 $WORK/ib/_test/_cgo_import.6 $WORK/ib/_test/_cgo_defun.6 $WORK/ib/_test/_cgo_export.o $WORK/ib/_test/qp.cgo2.o cd $WORK/ib/_test $GOROOT/pkg/tool/linux_amd64/6g -o ./_go_.6 -p testmain -D -I . -I $WORK ./_testmain.go $GOROOT/pkg/tool/linux_amd64/pack grc ./main.a ./_go_.6 $GOROOT/pkg/tool/linux_amd64/6l -o ./ib.test -L . -L $WORK ./main.a cp $WORK/ib/_test/ib.test ib.test $ ldd ib.test linux-vdso.so.1 => (0x00007fff743ff000) libibverbs.so.1 => /usr/lib64/libibverbs.so.1 (0x00007ff54cf3c000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ff54cd1f000) libc.so.6 => /lib64/libc.so.6 (0x00007ff54c967000) libdl.so.2 => /lib64/libdl.so.2 (0x00007ff54c763000) /lib64/ld-linux-x86-64.so.2 (0x00007ff54d157000) $ GC=gccgo go test -v -x -c ./... WORK=/dev/shm/go-build196429072 cd /home/alberts/ib/src/ib $GOROOT/pkg/tool/linux_amd64/cgo -objdir $WORK/ib/_test/ -gccgo -- -I $WORK/ib/_test/ qp.go gcc -Wall -g -I $WORK/ib/_test/ -I $GOROOT/pkg/linux_amd64 -o $WORK/ib/_test/_cgo_defun.6 -DGOOS_linux -DGOARCH_amd64 -c $WORK/ib/_test/_cgo_defun.c gcc -I . -g -O2 -fPIC -m64 -pthread -I $WORK/ib/_test/ -o $WORK/ib/_test/_cgo_main.o -c $WORK/ib/_test/_cgo_main.c gcc -I . -g -O2 -fPIC -m64 -pthread -I $WORK/ib/_test/ -o $WORK/ib/_test/_cgo_export.o -c $WORK/ib/_test/_cgo_export.c gcc -I . -g -O2 -fPIC -m64 -pthread -I $WORK/ib/_test/ -o $WORK/ib/_test/qp.cgo2.o -c $WORK/ib/_test/qp.cgo2.c gcc -I . -g -O2 -fPIC -m64 -pthread -o $WORK/ib/_test/_cgo_.o $WORK/ib/_test/_cgo_main.o $WORK/ib/_test/_cgo_export.o $WORK/ib/_test/qp.cgo2.o -libverbs gccgo -I $WORK -c -g -fgo-prefix=fake_ib -o $WORK/ib/_test/ib.o ./qp_test.go $WORK/ib/_test/_cgo_gotypes.go $WORK/ib/_test/qp.cgo1.go ar cru $WORK/ib/_test/libib.a $WORK/ib/_test/ib.o $WORK/ib/_test/_cgo_defun.6 $WORK/ib/_test/_cgo_export.o $WORK/ib/_test/qp.cgo2.o cd $WORK/ib/_test gccgo -I . -I $WORK -c -g -o ./main.o ./_testmain.go ar cru ./main.a ./main.o gccgo -o ./ib.test ./main.o -Wl,-( ./libib.a -lpthread -libverbs -Wl,-) # testmain qp.go:15: error: undefined reference to 'ibv_post_send' collect2: error: ld returned 1 exit status ibverbs shows up in the link line, but it doesn't work. I configured with --with-ld=/usr/bin/ld.gold. Attachments:
|
Let's tackle this after Go 1. The fix is going to be to always generate a wrapper function. I recently exported syscall.Entersyscall and syscall.Exitsyscall, so in fact we always want to generate a wrapper function anyhow, so that we can call those around the call to C code. Labels changed: added priority-later, removed priority-go1. Owner changed to @ianlancetaylor. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: