-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
R_hsc_make.o: requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC #371
Comments
FWIW, I tried changing my
and that didn't make any difference. It's hard to observe how these options propagate from one program to another using |
See #257. In more detail, what's happening here is that on Fedora, packages on hardened by default. Binaries are built as PIE's. But it's not GCC doing that behind people's back. It's the pkg-config database telling consumers of any library in these packages to use the hardening flags. And worse, they can't be overridden. On Fedora, there is a set of macros for RPM's in The Then GHC, like So I'd close as a dupe of #257, except that we could probably improve the FAQ entry about this. Either that or force the use of |
(BTW I don't think rpm is involved here? Perhaps you mean the Fedora R package build configuration is "leaking"?) I seem to be hitting something similar on Ubuntu 22.04 using debian11 ghc 9.4.4.
On the other hand the rest of the testsuite is linking: so should I open a separate issue for this? From perusing SO, the only way to fix this seems to be -fPIC, but I haven't dug into #257 in detail. |
Building test suite 'test-shootout' for inline-r-1.0.0.. [1 of 2] Compiling Test.Scripts [2 of 2] Compiling Main /usr/bin/ld.gold: error: .stack-work/dist/x86_64-linux-tinfo6/Cabal-3.8.1.0/build/test-shootout/test-shootout-tmp/Test/Script s.dyn_o: requires dynamic R_X86_64_PC32 reloc against 'TestziScripts_scripts10_bytes' which may overflow at runtime; recompile with -fPIC collect2: error: ld returned 1 exit status <no location info>: error: `gcc' failed in phase `Linker'. (Exit code: 1)
On Fedora (35; but I had the same issue back on 33), I get the following error when trying to build inline-r without nix:
Apparently, this is caused by gcc using pie (position-independent executables) as a security feature by default, and is fixed on the ghc side by passing -no-pie to gcc. However, hsc2hs calls gcc directly and doesn't know to pass -no-pie; see haskell/hsc2hs#66. I'm not entirely sure this is the correct diagnosis, but it looks plausible.
Environment
The text was updated successfully, but these errors were encountered: