Skip to content
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

In some version of Darwin, compilation Fails with "unexpected GOT reloc" error. #51

Open
mdayaram opened this issue Oct 24, 2013 · 7 comments

Comments

@mdayaram
Copy link
Contributor

I've only been able to reproduce this in certain mac environments, but it looks like for certain cases, trying to compile yields the following error:

gokogiri/xpath(__TEXT/__text): unexpected GOT reloc for non-dynamic symbol exec_xpath_function

I've tried using all versions of Go, and the error is consistent. However, it's not consistent across all Darwin machines.

Specs for one of the machines where the error appears consistently:

$ clang --version
Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin10.8.0
Thread model: posix

$ system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: Mac OS X Server 10.6.8 (10K549)
      Server Configuration: Advanced
      Kernel Version: Darwin 10.8.0
      Boot Volume: Server HD
      Boot Mode: Normal
      Computer Name: computer
      User Name: user (user)
      Secure Virtual Memory: Not Enabled
      64-bit Kernel and Extensions: Yes
      Time since boot: 34 days 3:36

Specs for a Darwin machine where the problem consistently does NOT appear:

$ clang --version
Apple clang version 2.1 (tags/Apple/clang-163.7.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

$ system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: Mac OS X 10.7.5 (11G63)
      Kernel Version: Darwin 11.4.2
      Boot Volume: Macintosh HD
      Boot Mode: Normal
      Computer Name: computer
      User Name: user (user)
      Secure Virtual Memory: Enabled
      64-bit Kernel and Extensions: Yes
      Time since boot: 2 days 16:08
@mdayaram
Copy link
Contributor Author

Commenting the call to exec_xpath_function on this line seems to make the compiler happy:
https://github.com/moovweb/gokogiri/blob/master/xpath/xpath.go#L20

@mdayaram
Copy link
Contributor Author

I should say, tried compiling with go1.2rc2 and the error still exists.

@mdayaram
Copy link
Contributor Author

Made internal branch mw_master with the above line commented out so that we can continue building for the time being. I'll keep the bug in master for reference until it gets fixed (or remove it later if no fix is found in the future.).

@mdayaram
Copy link
Contributor Author

Some more debug info, running go test -x gokogiri/xpath

$  go test -x -ldflags -extldflags=-L/Users/Shared/JenkinsNet/Home/workspace/manhattan-4.8-build/label/darwin_amd64/.build-sandbox/clibs/lib .
WORK=/tmp/go-build533157375
mkdir -p $WORK/gokogiri/xpath/_test/gokogiri/
mkdir -p $WORK/gokogiri/util/_obj/
mkdir -p $WORK/gokogiri/
cd /Users/Shared/JenkinsNet/Home/workspace/manhattan-4.8-build/label/darwin_amd64/.build-sandbox/src/gokogiri/util
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/6g -o $WORK/gokogiri/util/_obj/_go_.6 -p gokogiri/util -complete -D _/Users/Shared/JenkinsNet/Home/workspace/manhattan-4.8-build/label/darwin_amd64/.build-sandbox/src/gokogiri/util -I $WORK ./util.go
mkdir -p $WORK/gokogiri/help/_obj/
cd /Users/Shared/JenkinsNet/Home/workspace/manhattan-4.8-build/label/darwin_amd64/.build-sandbox/src/gokogiri/help
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/cgo -objdir $WORK/gokogiri/help/_obj/ -- -I $WORK/gokogiri/help/_obj/ -I../../../clibs/include/libxml2 help.go
cd /Users/Shared/JenkinsNet/Home/workspace/manhattan-4.8-build/label/darwin_amd64/.build-sandbox/src/gokogiri/util
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/pack grcP $WORK $WORK/gokogiri/util.a $WORK/gokogiri/util/_obj/_go_.6
cd /Users/Shared/JenkinsNet/Home/workspace/manhattan-4.8-build/label/darwin_amd64/.build-sandbox/src/gokogiri/help
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/6c -F -V -w -I $WORK/gokogiri/help/_obj/ -I /Users/jenkins/.gvm/gos/go1.2rc2/pkg/darwin_amd64 -o $WORK/gokogiri/help/_obj/_cgo_defun.6 -D GOOS_darwin -D GOARCH_amd64 $WORK/gokogiri/help/_obj/_cgo_defun.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -print-libgcc-file-name
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -I $WORK/gokogiri/help/_obj/ -I../../../clibs/include/libxml2 -o $WORK/gokogiri/help/_obj/_cgo_main.o -c $WORK/gokogiri/help/_obj/_cgo_main.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -I $WORK/gokogiri/help/_obj/ -I../../../clibs/include/libxml2 -o $WORK/gokogiri/help/_obj/_cgo_export.o -c $WORK/gokogiri/help/_obj/_cgo_export.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -I $WORK/gokogiri/help/_obj/ -I../../../clibs/include/libxml2 -o $WORK/gokogiri/help/_obj/help.cgo2.o -c $WORK/gokogiri/help/_obj/help.cgo2.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -o $WORK/gokogiri/help/_obj/_cgo_.o $WORK/gokogiri/help/_obj/_cgo_main.o $WORK/gokogiri/help/_obj/_cgo_export.o $WORK/gokogiri/help/_obj/help.cgo2.o -lxml2 -L../../../clibs/lib
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/cgo -objdir $WORK/gokogiri/help/_obj/ -dynimport $WORK/gokogiri/help/_obj/_cgo_.o -dynout $WORK/gokogiri/help/_obj/_cgo_import.c
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/6c -F -V -w -I $WORK/gokogiri/help/_obj/ -I /Users/jenkins/.gvm/gos/go1.2rc2/pkg/darwin_amd64 -o $WORK/gokogiri/help/_obj/_cgo_import.6 -D GOOS_darwin -D GOARCH_amd64 $WORK/gokogiri/help/_obj/_cgo_import.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -o $WORK/gokogiri/help/_obj/_all.o $WORK/gokogiri/help/_obj/_cgo_export.o $WORK/gokogiri/help/_obj/help.cgo2.o -L../../../clibs/lib -Wl,-r -nostdlib /usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin10/4.2.1/x86_64/libgcc.a
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/6g -o $WORK/gokogiri/help/_obj/_go_.6 -p gokogiri/help -D _/Users/Shared/JenkinsNet/Home/workspace/manhattan-4.8-build/label/darwin_amd64/.build-sandbox/src/gokogiri/help -I $WORK $WORK/gokogiri/help/_obj/_cgo_gotypes.go $WORK/gokogiri/help/_obj/help.cgo1.go
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/pack grcP $WORK $WORK/gokogiri/help.a $WORK/gokogiri/help/_obj/_go_.6 $WORK/gokogiri/help/_obj/_cgo_import.6 $WORK/gokogiri/help/_obj/_cgo_defun.6 $WORK/gokogiri/help/_obj/_all.o
mkdir -p $WORK/gokogiri/xpath/_test/
cd /Users/Shared/JenkinsNet/Home/workspace/manhattan-4.8-build/label/darwin_amd64/.build-sandbox/src/gokogiri/xpath
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/cgo -objdir $WORK/gokogiri/xpath/_test/ -- -I $WORK/gokogiri/xpath/_test/ -I../../../clibs/include/libxml2 -I../../../clibs/include/libxml2 expression.go util.go xpath.go
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/6c -F -V -w -I $WORK/gokogiri/xpath/_test/ -I /Users/jenkins/.gvm/gos/go1.2rc2/pkg/darwin_amd64 -o $WORK/gokogiri/xpath/_test/_cgo_defun.6 -D GOOS_darwin -D GOARCH_amd64 $WORK/gokogiri/xpath/_test/_cgo_defun.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -I $WORK/gokogiri/xpath/_test/ -I../../../clibs/include/libxml2 -I../../../clibs/include/libxml2 -o $WORK/gokogiri/xpath/_test/_cgo_main.o -c $WORK/gokogiri/xpath/_test/_cgo_main.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -I $WORK/gokogiri/xpath/_test/ -I../../../clibs/include/libxml2 -I../../../clibs/include/libxml2 -o $WORK/gokogiri/xpath/_test/_cgo_export.o -c $WORK/gokogiri/xpath/_test/_cgo_export.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -I $WORK/gokogiri/xpath/_test/ -I../../../clibs/include/libxml2 -I../../../clibs/include/libxml2 -o $WORK/gokogiri/xpath/_test/expression.cgo2.o -c $WORK/gokogiri/xpath/_test/expression.cgo2.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -I $WORK/gokogiri/xpath/_test/ -I../../../clibs/include/libxml2 -I../../../clibs/include/libxml2 -o $WORK/gokogiri/xpath/_test/util.cgo2.o -c $WORK/gokogiri/xpath/_test/util.cgo2.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -I $WORK/gokogiri/xpath/_test/ -I../../../clibs/include/libxml2 -I../../../clibs/include/libxml2 -o $WORK/gokogiri/xpath/_test/xpath.cgo2.o -c $WORK/gokogiri/xpath/_test/xpath.cgo2.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -o $WORK/gokogiri/xpath/_test/_cgo_.o $WORK/gokogiri/xpath/_test/_cgo_main.o $WORK/gokogiri/xpath/_test/_cgo_export.o $WORK/gokogiri/xpath/_test/expression.cgo2.o $WORK/gokogiri/xpath/_test/util.cgo2.o $WORK/gokogiri/xpath/_test/xpath.cgo2.o -lxml2 -L../../../clibs/lib -lxml2 -L../../../clibs/lib
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/cgo -objdir $WORK/gokogiri/xpath/_test/ -dynimport $WORK/gokogiri/xpath/_test/_cgo_.o -dynout $WORK/gokogiri/xpath/_test/_cgo_import.c
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/6c -F -V -w -I $WORK/gokogiri/xpath/_test/ -I /Users/jenkins/.gvm/gos/go1.2rc2/pkg/darwin_amd64 -o $WORK/gokogiri/xpath/_test/_cgo_import.6 -D GOOS_darwin -D GOARCH_amd64 $WORK/gokogiri/xpath/_test/_cgo_import.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -o $WORK/gokogiri/xpath/_test/_all.o $WORK/gokogiri/xpath/_test/_cgo_export.o $WORK/gokogiri/xpath/_test/expression.cgo2.o $WORK/gokogiri/xpath/_test/util.cgo2.o $WORK/gokogiri/xpath/_test/xpath.cgo2.o -L../../../clibs/lib -L../../../clibs/lib -Wl,-r -nostdlib /usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin10/4.2.1/x86_64/libgcc.a
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/6g -o $WORK/gokogiri/xpath/_test/_go_.6 -p gokogiri/xpath -D _/Users/Shared/JenkinsNet/Home/workspace/manhattan-4.8-build/label/darwin_amd64/.build-sandbox/src/gokogiri/xpath -I $WORK -I /Users/Shared/JenkinsNet/Home/workspace/manhattan-4.8-build/label/darwin_amd64/.build-sandbox/pkg/darwin_amd64 ./util_test.go ./xpath_test.go $WORK/gokogiri/xpath/_test/_cgo_gotypes.go $WORK/gokogiri/xpath/_test/expression.cgo1.go $WORK/gokogiri/xpath/_test/util.cgo1.go $WORK/gokogiri/xpath/_test/xpath.cgo1.go
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/pack grcP $WORK $WORK/gokogiri/xpath/_test/gokogiri/xpath.a $WORK/gokogiri/xpath/_test/_go_.6 $WORK/gokogiri/xpath/_test/_cgo_import.6 $WORK/gokogiri/xpath/_test/_cgo_defun.6 $WORK/gokogiri/xpath/_test/_all.o
cd $WORK/gokogiri/xpath/_test
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/6g -o ./_go_.6 -p testmain -complete -D "" -I . -I $WORK ./_testmain.go
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/pack grcP $WORK ./main.a ./_go_.6
cd .
/Users/jenkins/.gvm/gos/go1.2rc2/pkg/tool/darwin_amd64/6l -o $WORK/gokogiri/xpath/_test/xpath.test -L $WORK/gokogiri/xpath/_test -L $WORK -L /Users/Shared/JenkinsNet/Home/workspace/manhattan-4.8-build/label/darwin_amd64/.build-sandbox/pkg/darwin_amd64 -extldflags=-L/Users/Shared/JenkinsNet/Home/workspace/manhattan-4.8-build/label/darwin_amd64/.build-sandbox/clibs/lib $WORK/gokogiri/xpath/_test/main.a
# testmain
gokogiri/xpath(__TEXT/__text): unexpected GOT reloc for non-dynamic symbol exec_xpath_function2
$WORK/gokogiri/xpath/_test/xpath.test
FAIL    gokogiri/xpath [build failed]

@jbowtie
Copy link
Contributor

jbowtie commented Oct 25, 2013

Looking at http://code.google.com/p/go/issues/detail?id=4782 and http://code.google.com/p/go/issues/detail?id=4069 it seems like it might be a toolchain issue (which would make sense since it only happens in certain Mac environments).

You could try "-ldflags=-hostobj" when building in those failing environments and see if that makes a difference.

@mdayaram
Copy link
Contributor Author

Hmmm, unfortunately, that did not help. I filed a new issue in code.google.com:

https://code.google.com/p/go/issues/detail?id=6661&thanks=6661&ts=1382660533

@mdayaram
Copy link
Contributor Author

As a result, I've cleaned up the master branch to make it go-getable and compileable against standard libxml. So hopefully doing pull requests will be easier now ^.^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants