DMD Fails with fPIC error

Mike Wey via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 14 06:08:34 PDT 2014


On 06/14/2014 02:01 PM, Reuben wrote:
> On Saturday, 14 June 2014 at 10:45:25 UTC, Mike Wey wrote:
>> On 06/14/2014 03:58 AM, Reuben wrote:
>>
>> Depending on the desired behavior you'll need to remove the -shared
>> flag from the configuration or add -defaultlib=:libphobos2.so
>
> dmd.conf contains the default settings. I haven't specified -shared
> anywhere. The only thing I can think of is that if -fPIC is required,
> DMD might be implying it somehow.

Try running "dmd test.d -v" the last line in the outpus from dmd should 
show hows it's invoking gcc for the linking step.
Posting that here might give us some clue of what dmd is doing.

> Compiling with -defaultlib seems to have fixed it. I'm getting a
> warning, but the program compiles and seems to run OK.
>
>> dmd -defaultlib=:libphobos2.so -fPIC test.d
>> /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld:
>> test.o: warning: relocation in readonly section `.rodata'.
>> /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld:
>> warning: creating a DT_TEXTREL in object.
>
> Is the warning something I should be worried about?

I don't know about this one.

-- 
Mike Wey


More information about the Digitalmars-d-learn mailing list