Opened 11 years ago
Closed 11 years ago
#857 closed defect (fixed)
Getting GS3 64 bit linux binaries to compile up again
Reported by: | ak19 | Owned by: | nobody |
---|---|---|---|
Priority: | moderate | Milestone: | |
Component: | Greenstone2&3 | Severity: | major |
Keywords: | Cc: |
Description
This ticket is to document a change made not to the code but the Ubuntu machine that generates the 64 bit caveats. The compilation failed with something along the lines of the following (the following is someone else's error but is similar enough):
/usr/bin/ld: /usr/lib/gcc/[unknown_]x86_64-linux-gnu/4.4.3/crtbeginT.o: relocation R_X86_64_32 against `DTOR_END' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/[unknown_]x86_64-linux-gnu/4.4.3/crtbeginT.o: could not read symbols: Bad value
Change History (3)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Further information on what the files crtbeginT.o and crtbeginS.o are, can be found at:
http://dev.gentoo.org/~vapier/crt.txt
Mini FAQ about the misc libc/gcc crt files.
Some definitions: PIC - position independent code (-fPIC) PIE - position independent executable (-fPIE -pie) crt - C runtime
crtbegin.o
GCC uses this to find the start of the constructors.
crtbeginS.o
Used in place of crtbegin.o when generating shared objects/PIEs.
crtbeginT.o
Used in place of crtbegin.o when generating static executables.
comment:3 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
We got it to compile again by following the solution suggested near the bottom of
https://bugs.launchpad.net/ubuntu/+source/gcc-4.4/+bug/640734
"crtbeginT.o is not, and should not be PIC.
gcc -shared
should link to crtbeginS.o"$ cd /usr/lib/gcc/x86_64-linux-gnu/4.4
$ sudo cp crtbeginT.o crtbeginT.orig.o
$ sudo cp crtbeginS.o crtbeginT.o
Also, add -fPIC to the gcc command above:
gcc -o libnativelib.so -shared -Wl,-soname,libnative.so -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux nativelib.c -static -lc -fPIC
And walla, you have a fresh so library!