DUB fails to build a dynamic library on Linux

David Nadlinger via Digitalmars-d digitalmars-d at puremagic.com
Sun Dec 14 11:02:50 PST 2014


On Sunday, 14 December 2014 at 16:57:24 UTC, Gabor Mezo wrote:
> /home/gabor/dev/ldc2-0.15.0-beta1-linux-x86_64/bin/../lib/libdruntime-ldc.a(eh.o): 
> relocation R_X86_64_32 against `.rodata..str1' can not be used 
> when making a shared object; recompile with -fPIC

Hm, the problem here is that LDC uses a static runtime build, 
while dynamic libraries require Phobos and druntime to be built 
as shared libraries. The latter has actually been supported since 
quite a few months now, but IIRC still isn't shipped as part of 
the binary packages: 
https://github.com/ldc-developers/ldc/issues/807

If you want to give it a try, you can quickly build LDC from 
source (http://wiki.dlang.org/Building_LDC_from_source) and pass 
the -DBUILD_SHARED_LIBS=ON flag to CMake. Building shared 
libraries should then succeed.

David


More information about the Digitalmars-d mailing list