haskell / haskell/cabal

Change error message when linking fails

Open
#1,709 0 comments 0 reactions 0 assignees View on GitHub
cabal-install: other re: error-message type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

I just lost half a day of work because the error message for linker failures is extremely misleading:

```
cabal: Missing dependency on a foreign library:
* Missing C library: chipmunk
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
```

This suggests that the library isn't there, or at least not on cabals library search path. I had to turn on -v3 to find out that the problem wasn't that the library couldn't be found, but that it requires libm which wasn't linked to.

```
/usr/local/lib/libchipmunk.so: undefined reference to `__pow_finite'
/usr/local/lib/libchipmunk.so: undefined reference to `sincos'
/usr/local/lib/libchipmunk.so: undefined reference to `__exp_finite'
/usr/local/lib/libchipmunk.so: undefined reference to `sin'
/usr/local/lib/libchipmunk.so: undefined reference to `__acos_finite'
```

I suggest that upon failure to link the real error message (in this case, the one from gcc - I don't know what's being used on windows or osx) should _always_ be reported. In any case, an error message shouldn't give a wrong impression of what the actual point of failure is if it can be helped at all.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.