Closed nevrome closed 1 month ago
Thanks for the report @nevrome. The following error might indicate some disagreement about flags between Cabal, ghc, pkg-config, and the linker.
inline-r> /usr/bin/ld.gold: pack-relative-relocs: unknown -z option
inline-r> /usr/bin/ld.gold: use the --help option for usage information
inline-r> collect2: error: ld returned 1 exit status
Solving this issue would require investigating the tooling in your setup. If you figure it out, we could work that in the FAQ. Others might be able to help if you can share a docker container or some nix environment to reproduce it.
Also, a workaround could be to provision the environment with Nix.
OK - thanks for pointing to the linker as the source of the issue. I found this Arch Linux this issue which confirms that there is indeed an issue with ld.gold under certain circumstances.
After a lot of experimenting I managed to change the default linker in the ghc settings
file, in my case at ~/.ghcup/ghc/9.4.7/lib/ghc-9.4.7/lib/settings
. There I replaced
,("C compiler link flags", "-fuse-ld=gold")
with
,("C compiler link flags", "-fuse-ld=bfd")
and this resolved the issue for me. My code compiles and inline-r seems to be functional (based on a simple print test).
Thanks for the help. Maybe it would indeed be helpful to add a short comment to the FAQ that points to the GHC settings file in case the linker acts up. In fact I struggled most to find out where exactly I can change the default linker after identifying ld.gold as the probable nuisance factor.
Thanks @nevrome. I contributed an addition to the FAQ in 30e7fa7.
Thank you for the work on this amazing package. I stumbled over the 2014 paper, realized that inline-r may allow me to use R's brilliant plotting features from within some of my Haskell projects and decided to give it a try. Unfortunately I failed to install inline-r as a dependency. Maybe you could give me some ideas how to overcome this.
Describe the bug I can not install inline-r as a dependency for my Haskell project.
R is installed and I tried setting the paths manually on the command line:
This gives me the same result.
Here is the (slightly reduced, see [...]) output with `--cabal-verbosity 3`
``` $ stack install --extra-include-dirs=/usr/include/R/ --extra-lib-dirs=/usr/lib/R/lib/ --cabal-verbosity 3 inline-r> configure inline-r> Using Parsec parser inline-r> Configuring inline-r-1.0.1... inline-r> creating .stack-work/dist/x86_64-linux/ghc-9.4.7/build inline-r> creating .stack-work/dist/x86_64-linux/ghc-9.4.7 inline-r> creating .stack-work/dist/x86_64-linux inline-r> creating .stack-work/dist inline-r> creating .stack-work inline-r> creating .stack-work/dist inline-r> creating .stack-work/dist/x86_64-linux inline-r> creating .stack-work/dist/x86_64-linux/ghc-9.4.7 inline-r> creating .stack-work/dist/x86_64-linux/ghc-9.4.7/build inline-r> /home/clemens/.ghcup/ghc/9.4.7/bin/ghc --numeric-version inline-r> /home/clemens/.ghcup/ghc/9.4.7/bin/ghc is version 9.4.7 inline-r> /home/clemens/.ghcup/ghc/9.4.7/bin/ghc-pkg-9.4.7 --version inline-r> /home/clemens/.ghcup/ghc/9.4.7/bin/ghc-pkg-9.4.7 is version 9.4.7 inline-r> /home/clemens/.ghcup/ghc/9.4.7/bin/ghc --supported-languages inline-r> /home/clemens/.ghcup/ghc/9.4.7/bin/ghc --info inline-r> Reading installed packages... inline-r> /home/clemens/.ghcup/ghc/9.4.7/bin/ghc-pkg-9.4.7 dump --global -v0 inline-r> /home/clemens/.ghcup/ghc/9.4.7/bin/ghc-pkg-9.4.7 dump '--package-db=/home/clemens/.stack/snapshots/x86_64-linux/5d821f30b14d16ba2e81b52fb5ffd9cf016e56f09c93b51a16c4430a19698947/9.4.7/pkgdb' -v0 inline-r> /home/clemens/.ghcup/ghc/9.4.7/bin/ghc --print-libdir -fhide-source-paths inline-r> Finalized package description: inline-r> cabal-version: 2.2 inline-r> name: inline-r inline-r> version: 1.0.1 inline-r> license: BSD-3-Clause inline-r> license-file: LICENSE inline-r> maintainer: Mathieu BoespflugTo Reproduce I think this issue may be related to my system configuration or a version mismatch. I don't know how to make this easily reproducible.
Expected behavior The installation should run through and my code should get compiled for great good.
Environment