shared lib

Johannes Pfau spam at example.com
Mon Nov 14 10:54:53 PST 2011


Jacob Carlborg wrote:
>On 2011-11-14 17:31, Jerry wrote:
>> Ellery Newcomer<ellery-newcomer at utulsa.edu>  writes:
>>
>>> trying to build a .so file (actually, trying to resuscitate pyd)
>>> with gdc.
>>>
>>> celerid is spitting out
>>>
>>> gdc -fPIC -nostartfiles -shared -fdebug {lots of object files plus
>>> some link directives}
>>>
>>> which is spitting out
>>>
>>> /usr/bin/ld: /usr/lib64/libgphobos2.a(object_.o): relocation
>>> R_X86_64_32S against `_D11TypeInfo_Pv6__initZ' can not be used when
>>> making a shared object; recompile with -fPIC
>>> /usr/lib64/libgphobos2.a: could not read symbols: Bad value
>>>
>>> any ideas what might be wrong?
>>
>> Shared libs on linux require things to be compiled with -fPIC so the
>> code can be relocated.  The error looks like phobos wasn't build with
>> position-independent code.  Beyond that I don't know.
>>
>> Jerry
>
>DMD cannot currently generate correct PIC on linux.
>
That's a backend bug though, GDC and LDC shouldn't be affected. But
some inline asm in phobos also doesn't work in PIC (see
https://bitbucket.org/goshawk/gdc/issue/166/add-shared-lib-support).

-- 
Johannes Pfau



More information about the Digitalmars-d-learn mailing list