Ticket #648 (new defect)
Cabal C lib check error message is occasionally misleading
|Reported by:||GregoryWeber||Owned by:|
This problem occurs with Cabal version 18.104.22.168 on Arch Linux (this version number does not appear in the Version selector, so I have left it at 22.214.171.124) and ghc version 6.12.1.
Trying to install Codec-Image-DevIL, either version 0.1 or 0.2.0, 'runghc Setup configure' produces a misleading error message:
$ runghc Setup configure
Configuring Codec-Image-DevIL-0.2.0... Setup: Missing dependency on a foreign library: * Missing C library: IL 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.
The error message "Missing C library: IL" is incorrect: the Arch 'devil' package is installed, and the include and library files are present in the normal locations:
$ pacman -Q devil
$ ls /usr/include/IL
devil_cpp_wrapper.hpp il.h ilu.h ilu_region.h ilut.h
$ ls /usr/lib/*IL*
/usr/lib/libIL.a /usr/lib/libILU.a /usr/lib/libILUT.a /usr/lib/libIL.so@ /usr/lib/libILU.so@ /usr/lib/libILUT.so@ /usr/lib/libIL.so.1@ /usr/lib/libILU.so.1@ /usr/lib/libILUT.so.1@ /usr/lib/libIL.so.1.1.0* /usr/lib/libILU.so.1.1.0* /usr/lib/libILUT.so.1.1.0*
There does seem to be an error in Codec-Image-DevIL.cabal: where it says
it should say any of the following (take your choice, all of them work):
Extra-Libraries: IL, pthread
Extra-Libraries: IL, rt
Extra-Libraries: IL, pthread, rt
It seems that using the IL library in a C program requires linking with -lrt or -pthread in addition to -lIL.
I have the impression that in the configuration step, when Cabal sees the line
it writes a small C program that tries to include that library, and reports the library is missing if there's an error in compiling and linking the C program. Maybe Cabal needs to interpret the C compiler's and linker's error messages more carefully.