Why is libphobos not a shared library?

DanO dano at threeos.eu
Tue Jun 26 02:21:51 PDT 2012

On Monday, 18 June 2012 at 01:00:26 UTC, 拖狗散步 wrote:
> On Monday, 18 June 2012 at 00:59:02 UTC, 拖狗散步 wrote:
>> dmd -shared testlib.d
>> error:
>> relocation R_X86_64_32 against '.data' can not be used when 
>> making a shared object; recompile with -fPIC
>> could not read symbols:bad value
>> so gdc error。。。
>> my system is ubuntu 64b
> Brothers help me!

I'd been having problems with shared libs and DMD on 64-bit 
Ubuntu but:

dmd -shared -fPIC -defaultlib= testlib.d

seemed to work for me (the -defaultlib= stops dmd trying to link 
libphobos into the library which gives another relocation error).

More information about the D.gnu mailing list