Ticket #857 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

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

Changed 6 years ago by ak19

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

1. NOTE: See here:  https://bugzilla.redhat.com/show_bug.cgi?id=214465

"crtbeginT.o is not, and should not be PIC. gcc -shared should link to crtbeginS.o"

2. OK, I found a workaround:

$ 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!

Changed 6 years ago by ak19

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.

Changed 6 years ago by ak19

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.