Thread overview
gdc-0.23 x86_64 can't create shared objects?
Mar 06, 2007
Neal Becker
Mar 06, 2007
Frits van Bommel
Mar 06, 2007
Neal Becker
Mar 06, 2007
Gregor Richards
March 06, 2007
gdc-0.23 x86_64 can't create shared objects?
cd /home/nbecker/
gdc -g -o test2.so -shared -fpic -v test2.d -Wall
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.1.1/configure --prefix=/home/dvdf/Devel/Gcc-D/r23rc5/Rgcc --disable-shared --enable-languages=c,d --disable-shared
Thread model: posix
gcc version 4.1.1 20060524 (  (gdc 0.23, using dmd 1.007))
 /home/nbecker/gdc/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.1.1/cc1d test2.d -quiet -dumpbase test2.d -mtune=k8 -auxbase test2 -g -Wall -version -fpic -iprefix /home/nbecker/gdc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/ -o /tmp/ccqUV52a.s
GNU D version 4.1.1 20060524 (  (gdc 0.23, using dmd 1.007)) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.1.0 20060304 (Red Hat 4.1.0-3).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
 as -V -Qy -o /tmp/ccS4trNh.o /tmp/ccqUV52a.s
GNU assembler version 2.17.50.0.6-2.fc6 (x86_64-redhat-linux) using BFD version 2.17.50.0.6-2.fc6 20061020
 /home/nbecker/gdc/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.1.1/collect2 --eh-frame-hdr -m elf_x86_64 -shared -o test2.so /usr/lib/../lib64/crti.o /home/nbecker/gdc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/crtbeginS.o -L/home/nbecker/gdc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1 -L/home/nbecker/gdc/bin/../lib/gcc -L/home/nbecker/gdc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 /tmp/ccS4trNh.o -lgphobos -lm -lgcc -lpthread -lc -lgcc /home/nbecker/gdc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/crtendS.o /usr/lib/../lib64/crtn.o
/usr/bin/ld: /home/nbecker/gdc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../lib64/libgphobos.a(deh.o): relocation R_X86_64_32 against `_D39TypeInfo_AS3gcc3deh18OurUnwindException6__initZ' can not be used when making a shared object; recompile with -fPIC
/home/nbecker/gdc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../lib64/libgphobos.a: could not read symbols: Bad value
collect2: ld returned 1 exit status

March 06, 2007
Neal Becker wrote:
> gdc-0.23 x86_64 can't create shared objects?
> cd /home/nbecker/
> gdc -g -o test2.so -shared -fpic -v test2.d -Wall
[snip]
> /usr/bin/ld: /home/nbecker/gdc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../lib64/libgphobos.a(deh.o): relocation R_X86_64_32 against `_D39TypeInfo_AS3gcc3deh18OurUnwindException6__initZ' can not be used when making a shared object; recompile with -fPIC

Did you try it with -fPIC instead of -fpic like the error message suggests?
(Or if that doesn't work, perhaps try recompiling libgphobos with that option; I'm not sure what exactly the message means)
March 06, 2007
Frits van Bommel wrote:

> Neal Becker wrote:
>> gdc-0.23 x86_64 can't create shared objects?
>> cd /home/nbecker/
>> gdc -g -o test2.so -shared -fpic -v test2.d -Wall
> [snip]
>> /usr/bin/ld:
>> /home/nbecker/gdc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../lib64/libgphobos.a(deh.o):
>> relocation R_X86_64_32 against
>> `_D39TypeInfo_AS3gcc3deh18OurUnwindException6__initZ' can not be used
>> when making a shared object; recompile with -fPIC
> 
> Did you try it with -fPIC instead of -fpic like the error message suggests? (Or if that doesn't work, perhaps try recompiling libgphobos with that option; I'm not sure what exactly the message means)

Yes, tried that.  The problem is we have to have a shared libgphobos.  On i386 linux, it was legal to link non-pic code into a shared library.  This is not legal on x86_64 (and, I think, most other arch's).
March 06, 2007
Neal Becker wrote:
> Frits van Bommel wrote:
> 
>> Neal Becker wrote:
>>> gdc-0.23 x86_64 can't create shared objects?
>>> cd /home/nbecker/
>>> gdc -g -o test2.so -shared -fpic -v test2.d -Wall
>> [snip]
>>> /usr/bin/ld:
>>> /home/nbecker/gdc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../lib64/libgphobos.a(deh.o):
>>> relocation R_X86_64_32 against
>>> `_D39TypeInfo_AS3gcc3deh18OurUnwindException6__initZ' can not be used
>>> when making a shared object; recompile with -fPIC
>> Did you try it with -fPIC instead of -fpic like the error message
>> suggests? (Or if that doesn't work, perhaps try recompiling libgphobos
>> with that option; I'm not sure what exactly the message means)
> 
> Yes, tried that.  The problem is we have to have a shared libgphobos.  On
> i386 linux, it was legal to link non-pic code into a shared library.  This
> is not legal on x86_64 (and, I think, most other arch's). 

You don't have to have a /shared/ libgphobos, but you do have to have a -fPIC libgphobos.

 - Gregor Richards