Skip to content

Commit 30e7fa7

Browse files
Add some more clues to the FAQ about diagnosing linking issues
1 parent b0c33de commit 30e7fa7

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

docs/docs/faq.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,34 @@ This is a known issue with GHC, tracked as
4040

4141
[trac-10458]: https://ghc.haskell.org/trac/ghc/ticket/10458
4242

43+
#### Why does stack say that R is missing or bad?
44+
45+
Even if R is installed in a standard location, stack might fail
46+
to link it.
47+
48+
~~~
49+
$ stack install
50+
inline-r> configure
51+
inline-r> Configuring inline-r-1.0.1...
52+
inline-r> Error: Cabal-simple_DY68M0FN_3.8.1.0_ghc-9.4.7: Missing dependency on a
53+
inline-r> foreign library:
54+
inline-r> * Missing (or bad) C library: R
55+
...
56+
~~~
57+
58+
In that case, it is helpful to see the actual output of the linker for diagnosing.
59+
60+
~~~
61+
$ stack install --cabal-verbosity 3
62+
~~~
63+
64+
You will have to look for the output corresponding to invocations of `gcc` and `ld`.
65+
Linking might fail for reasons specific to the environment in which `inline-r` is
66+
built. See for instance [#427][] or the next question about linker errors. In these
67+
cases, a workaround is to use Nix to install the system dependencies.
68+
69+
[#427]: https://github.com/tweag/HaskellR/issues/427
70+
4371
#### How do I fix linker errors?
4472

4573
Most systems use the historic `ld.bfd` linker by default. However,
@@ -53,8 +81,8 @@ errors like the following:
5381
collect2: error: ld returned 1 exit status
5482
~~~
5583

56-
The fix is to either upgrade your linker, or better yet, switch to the
57-
gold linker. On Ubuntu, you can do this with:
84+
The fix is to either upgrade your linker, or on some systems it might also work
85+
to switch to the gold linker. On Ubuntu, you can do this with:
5886

5987
~~~
6088
# update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20

0 commit comments

Comments
 (0)