Skip to content

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

@mleise

Description

@mleise

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions