Bind D as a shared lib for ldc

David Nadlinger via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Wed Jul 26 09:10:40 PDT 2017


Hi Prasun,

On 26 Jul 2017, at 7:53, Prasun Anand via digitalmars-d-ldc wrote:
> But how should I so I do it with LDC?
>
> I tried the example from above post and get the following error:
>
> ```
> $ ldc2 -shared -m64 -relocation-model=pic i.d
> /usr/bin/ld: 
> /home/prasun/ldclatest/ldc-1.1.0-pk9rkm4zvdp6pglam7s2/lib/libdruntime-ldc.a(errno.c.o): 
> relocation R_X86_64_PC32 against undefined symbol 
> `__errno_location@@GLIBC_2.2.5' can not be used when making a shared 
> object; recompile with -fPIC
> /usr/bin/ld: final link failed: Bad value
> collect2: error: ld returned 1 exit status
> Error: /usr/lib/nvidia-cuda-toolkit/bin/gcc failed with status: 1
> ```

You need to use a version of LDC built with shared druntime/Phobos – 
the static ones (libdruntime-ldc.a in the linker error message) are not 
compatible with creating shared libraries.

  — David



More information about the digitalmars-d-ldc mailing list