Bug 15054 – DMD doesn't work with hardening-wrapper

Status
RESOLVED
Resolution
WORKSFORME
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2015-09-13T10:09:00Z
Last change time
2017-07-21T06:47:06Z
Assigned to
nobody
Creator
public

Comments

Comment #0 by public — 2015-09-13T10:09:10Z
Originally reported by Arch Linux user Richard White (rwhite) : https://bugs.archlinux.org/task/46260 Quotes: >>> Description: Both the dmd and ldc (but not the gdc) d compilers in the repos fail to build anything. It always returns this /usr/bin/ld: hello.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC hello.o: error adding symbols: Bad value collect2: error: ld returned 1 exit status --- errorlevel 1 Steps to reproduce: Create a *.d file with the trivial program void main(){} $ dmd filename.d <<< >>> I found the problem. The hardening-wrapper package appends its utils (which seem to be incompatible with dmd and ldc) to the begging of your path causing them to be used. Removing the hardening-wrapper and restarting seems to have fixed the problem. <<< Relevant : https://wiki.debian.org/Hardening
Comment #1 by dlang-bugzilla — 2017-07-21T06:47:06Z
I believe this has been addressed in the latest D releases. There has been a very similar problem recently, with Arch Linux switching to -fPIE by default for everything. This resulted in very similar linking errors when building anything, because libphobos2.a was not built with -fPIC. A workaround was to create a cc/gcc/c++/g++ wrapper somewhere in PATH, which adds -no-pie to the gcc invocation used for linking. However, this has been properly fixed in the latest releases from Arch Linux repositories, where libphobos2.a is now built with -fPIC and generating position-independent binaries is enabled by default. Please reopen if this is still an issue with the latest Arch Linux DMD 2.075.0 package.