Jump to page: 1 2
Thread overview
dmd and Archlinux
Jul 09, 2017
Antonio Corbi
Jul 09, 2017
Nemanja Boric
Jul 09, 2017
Antonio Corbi
Jul 09, 2017
Seb
Jul 09, 2017
Antonio Corbi
Jul 09, 2017
Seb
Jul 11, 2017
Marco Leise
Jul 11, 2017
Seb
Jul 11, 2017
Jonathan M Davis
Jul 12, 2017
Marco Leise
Jul 15, 2017
Seb
Jul 20, 2017
Vladimir Panteleev
July 09, 2017
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
July 09, 2017
On Sunday, 9 July 2017 at 18:35:09 UTC, Antonio Corbi wrote:
> 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

Hm, I can't reproduce this issue with dmd 2.074.0-1. I've just installed dmd and it works out
of the box:

```
➜  arch tmp% pacman -Q | grep phob
libphobos-devel 1:2.074.0-1
➜  arch tmp% pacman -Q | grep dmd
dmd 1:2.074.0-1
➜  arch tmp% cat test.d
import std.stdio;

void main()
{
	writeln("hello!");
}
➜  arch tmp% dmd -c test.d
➜  arch tmp% dmd test.o
➜  arch tmp% ./test
hello!
```
July 09, 2017
On Sunday, 9 July 2017 at 18:35:09 UTC, Antonio Corbi wrote:
> 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


I think the Arch Linux TUs are in the process of enabling -fPIC by default, see e.g. [1] - it might be releated to this?
In any case - building dmd/druntime/phobos with -fPIC enabled is a good idea and since 2.072.2 the official releases do so. Not sure why it's not done on Arch, maybe because Dicebot stepped down as maintainer? (see [2, 3]).

[1] https://lists.archlinux.org/pipermail/arch-dev-public/2017-July/028918.html
[2] http://forum.dlang.org/post/o6fbbu$1qli$1@digitalmars.com
[3] http://forum.dlang.org/post/o6sldo$1pad$1@digitalmars.com
July 09, 2017
On Sunday, 9 July 2017 at 19:15:15 UTC, Nemanja Boric wrote:
> On Sunday, 9 July 2017 at 18:35:09 UTC, Antonio Corbi wrote:
>> [...]
>
> Hm, I can't reproduce this issue with dmd 2.074.0-1. I've just installed dmd and it works out
> of the box:
>
> ```
> ➜  arch tmp% pacman -Q | grep phob
> libphobos-devel 1:2.074.0-1
> ➜  arch tmp% pacman -Q | grep dmd
> dmd 1:2.074.0-1
> ➜  arch tmp% cat test.d
> import std.stdio;
>
> void main()
> {
> 	writeln("hello!");
> }
> ➜  arch tmp% dmd -c test.d
> ➜  arch tmp% dmd test.o
> ➜  arch tmp% ./test
> hello!
> ```

Thank's!

In my case the error persists.
I'm using the testing repo...so I think it must be related to that.

A. Corbi
July 09, 2017
On Sunday, 9 July 2017 at 19:21:48 UTC, Seb wrote:
> On Sunday, 9 July 2017 at 18:35:09 UTC, Antonio Corbi wrote:
>> [...]
>
>
> I think the Arch Linux TUs are in the process of enabling -fPIC by default, see e.g. [1] - it might be releated to this?
> In any case - building dmd/druntime/phobos with -fPIC enabled is a good idea and since 2.072.2 the official releases do so. Not sure why it's not done on Arch, maybe because Dicebot stepped down as maintainer? (see [2, 3]).
>
> [1] https://lists.archlinux.org/pipermail/arch-dev-public/2017-July/028918.html
> [2] http://forum.dlang.org/post/o6fbbu$1qli$1@digitalmars.com
> [3] http://forum.dlang.org/post/o6sldo$1pad$1@digitalmars.com

Hi Seb!

I think you are right. Official releases (the ones downloaded from dlang.org via curl) work for me.

A. Corbi
July 09, 2017
On Sunday, 9 July 2017 at 19:33:45 UTC, Antonio Corbi wrote:
> On Sunday, 9 July 2017 at 19:21:48 UTC, Seb wrote:
>> On Sunday, 9 July 2017 at 18:35:09 UTC, Antonio Corbi wrote:
>>> [...]
>>
>>
>> I think the Arch Linux TUs are in the process of enabling -fPIC by default, see e.g. [1] - it might be releated to this?
>> In any case - building dmd/druntime/phobos with -fPIC enabled is a good idea and since 2.072.2 the official releases do so. Not sure why it's not done on Arch, maybe because Dicebot stepped down as maintainer? (see [2, 3]).
>>
>> [1] https://lists.archlinux.org/pipermail/arch-dev-public/2017-July/028918.html
>> [2] http://forum.dlang.org/post/o6fbbu$1qli$1@digitalmars.com
>> [3] http://forum.dlang.org/post/o6sldo$1pad$1@digitalmars.com
>
> Hi Seb!
>
> I think you are right. Official releases (the ones downloaded from dlang.org via curl) work for me.
>
> A. Corbi


Maybe phobos/5586 [1] helps us. Of course the package would need to be rebuilt by the Arch Linux maintainers. Something I am not sure whether they are interested - the packages are orphaned and flagged out-of-date since more than a month [2]. Maybe you have an idea?

[1] https://github.com/dlang/phobos/pull/5586
[2] http://forum.dlang.org/post/ppyeysvwmgjpchazuuwk@forum.dlang.org
July 11, 2017
Am Sun, 09 Jul 2017 18:35:09 +0000
schrieb Antonio Corbi <aaacorbi@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.

-- 
Marco

July 11, 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@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
July 11, 2017
On Tuesday, July 11, 2017 12:00:51 PM MDT Seb via Digitalmars-d wrote:
> @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

PIC and PIE may make sense from security perspective, but they've sure made dealing with some the Linux distros over the last year or so a bit of a pain.

- Jonathan M Davis

July 12, 2017
Am Tue, 11 Jul 2017 06:21:33 -0600
schrieb Jonathan M Davis via Digitalmars-d
<digitalmars-d@puremagic.com>:

> On Tuesday, July 11, 2017 12:00:51 PM MDT Seb via Digitalmars-d wrote:
> > @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
> 
> PIC and PIE may make sense from security perspective, but they've sure made dealing with some the Linux distros over the last year or so a bit of a pain.
> 
> - Jonathan M Davis

It adds to security and adds another shovel of dirt on the grave of x86. X86 needs to emulate access to global constants in PIE, while amd64 is using offsets relative to the instruction pointer. RIP x86. (pun intended!)

-- 
Marco

« First   ‹ Prev
1 2