strange -fPIC compilation error
Lodovico Giaretta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Nov 1 14:37:13 PDT 2016
On Tuesday, 1 November 2016 at 18:13:32 UTC, TheGag96 wrote:
> On Monday, 31 October 2016 at 07:16:50 UTC, Sebastien Alaiwan
> wrote:
>> Hello,
>> From GCC 6.2, -fpie is becoming the default setting at compile
>> and at link time.
>> As dmd uses GCC to link, now the code needs to be compiled
>> with a special option.
>> Which means you need, at the moment, to add the following
>> options to your dmd.conf:
>> -defaultlib=libphobos2.so -fPIC
>> (the change from GCC is related to security and address space
>> randomization).
>
> So does this mean it's now impossible to compile statically
> until this gets fixed?
It's impossible with the default `libphobos2.a`. I didn't try,
but I'm quite confident that if you clone the Phobos repository
and rebuild the library yourself with -fPIC, you can then link it
statically to PIE executables.
More information about the Digitalmars-d-learn
mailing list