Opened 9 years ago

Closed 9 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:


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 ak19, 9 years ago

We got it to compile again by following the solution suggested near the bottom of

  1. NOTE: See here:

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

  1. 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 -shared -Wl,-soname, -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!

comment:2 by ak19, 9 years ago

Further information on what the files crtbeginT.o and crtbeginS.o are, can be found at:

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


GCC uses this to find the start of the constructors.


Used in place of crtbegin.o when generating shared objects/PIEs.


Used in place of crtbegin.o when generating static executables.

comment:3 by ak19, 9 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.