dmd and Archlinux
Seb via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jul 11 05:00:51 PDT 2017
On Tuesday, 11 July 2017 at 00:23:55 UTC, Marco Leise wrote:
> Am Sun, 09 Jul 2017 18:35:09 +0000
> schrieb Antonio Corbi <aaacorbi at mail.com>:
>
>> Hi!
>>
>> Are there any news about the status of packaging dmd for
>> archlinux?
>>
>> The last dmd compiler packaged is 2.074.0 and since the last
>> batch of updated packages in archlinux, dmd generated objects
>> fail to link with libphobos with erros like these:
>>
>> /usr/bin/ld: /usr/lib/libphobos2.a(object_a_66e.o): relocation
>> R_X86_64_32 against `.rodata.str1.1' can not be used when
>> making
>> a shared object; recompile con -fPIC
>> /usr/bin/ld: /usr/lib/libphobos2.a(object_b_58c.o): relocation
>> R_X86_64_32 against `.rodata.str1.1' can not be used when
>> making
>> a shared object; recompile con -fPIC
>> /usr/bin/ld: /usr/lib/libphobos2.a(object_c_7f4.o): relocation
>> R_X86_64_32 against `.rodata.str1.1' can not be used when
>> making
>> a shared object; recompile con -fPIC
>> /usr/bin/ld: /usr/lib/libphobos2.a(object_d_a07.o): relocation
>> R_X86_64_32 against `.rodata.str1.1' can not be used when
>> making
>> a shared object; recompile con ...
>>
>> A. Corbi
>
> The linker gold (since binutils 2.27) is problematic with DMD
> and would emit such errors. (Is ld a symlink to ld.gold in this
> case?) Also binutils 2.28 breaks how DMD's druntime loads
> shared libraries. You have to either downgrade binutils or use
> the hack of adding '-fPIC' when compiling executable that link
> against shared libraries. binutils 2.26 should be the most
> compatible version for the time being.
@mleise: OP is using the testing repos where the PIE enforcement
already landed [1], but libphobos.a isn't built with -fPIC on
Arch yet.
The Arch developers, however, are aware of the need to rebuild
libphobos [2], but maybe we can simply build Phobos with -fPIC by
default on Posix [3].
[1] https://www.archlinux.org/todo/pie-rebuild
[2] https://bugs.archlinux.org/task/54749
[3] https://github.com/dlang/phobos/pull/5586
More information about the Digitalmars-d
mailing list