gentoo / dlang

[MIRROR] D programming language ebuild repository

Home Page:https://gitweb.gentoo.org/repo/user/dlang.git

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

binutils 2.28 causing "module <…> is already defined in <…>" errors with shared libraries

mleise opened this issue · comments

We currently have two issues with the linkers in binutils. Since 2.27, the gold linker refuses to work with dmd, but that can be worked around by using ld.bfd (the default) or enabling the old COMDAT hack in DMD, which I'm considering as an option for those using gold to link.
Now with binutils 2.28 we face a new issue. The way the druntime scans shared libraries for modules got broken and you see the error message mentioned in the title when running a Dlang program that loads a DMD generated shared library. The bug report about that was first opened in May and as of now the answer is to compile all code with -fPIC.

For you reading this, it means to append -fPIC to the DFLAGS of the DMD versions you need to work with binutils 2.28. If you only have one, it is in /etc/dmd.conf, if you have multiple versions installed look into /etc/dmd/version.conf. I will change the ebuilds accordingly so that new installs of DMD have -fPIC already in their configuration. Stand by for updates.

Updated the overlay with the -fPIC solution.