While build Go program with use of Cgo I get error
/usr/lib/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: /tmp/go-link-373355991/000002.o: unrecognized relocation (0x2a) in section `.text'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Tried to google that issue and found some bugs (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808205) on Debian and Ubuntu with C compiler and linker in versions of libc6 (2.21) which are newer than version I use (2.19).
Also there mentioned having problems compiling C programs and I compile example in C successfully.
I tried to build my Go program on other machine with same system and libraries versions and the build succeeded.
check if you are not using ccache. ie by : echo $PATH if something like /usr/local/ccache path comes first... be aware! ccache try to optimize compilation time, using a cache. If you have build a lib with a first compiler and then trying to compile with another, you are expose to such relocation trouble.
so try to clear the ccache : ccache -C or simply edit your PATH removing the path dedicated to ccache by export PATH=/usr/bin: ...
A++ Thilas
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With