Codec-Image-DevIL, Arch Linux, haskell-codec-image-devil

I. Problem: Codec-Image-DevIL 0.1 and 0.2.0 will not build on Arch Linux A. Attempted installation from Arch User Repository (AUR) I attempted to install the package haskell-codec-image-devil 0.2.0-2 (http://aur.archlinux.org/packages.php?ID=18919) with bauerbill: $ bauerbill --aur -Sy haskell-codec-image-devil ... ==> Starting build()... 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. ==> ERROR: Build Failed. Aborting... ERROR: makepkg exited with an error (512) ERROR: no package found: /tmp/bauerbill/build/aur/haskell-codec-image-devil/haskell-codec-image-devil-0.2.0-2-x86_64.pkg.tar.gz $ 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 devil 1.7.8-6 $ 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* B. Attempted installation from Hackage Trying to install either version 0.1 or 0.2.0 from Hackage yields essentially the same result: $ 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. $ C. Missing comment on AUR package page Incidentally -- I'm pretty sure I posted a comment reporting the problem earlier this month (March 2010) on http://aur.archlinux.org/packages.php?ID=18919 -- but the comment seems to have disappeared. Or maybe I'm not going through the right hoops to view comments -- I remember having that trouble before, but can't remember the solution. II. Solution There seem to be two errors, one involving Codec-Image-DevIL and one involving Cabal. I have solutions for the first, but not the second. A. Fixing Codec-Image-DevIL 1. Quick fix: Edit Codec-Image-DevIL.cabal and replace the line Extra-Libraries: IL with one of the following (take your choice): Extra-Libraries: IL, pthread Extra-Libraries: IL, rt Extra-Libraries: IL, pthread, rt These all work in Arch Linux, and they also work (though they are not needed) in Fedora 10. 2. How I discovered this: I wrote a small C program that calls a few DevIL functions (such as ilInit, ilLoadImage) just to demonstrate that they are truly there. Compiling and linking with -lIL failed: $ gcc -o ctestil -lIL ctestil.o /usr/lib/libIlmThread.so.6: undefined reference to `sem_init' /usr/lib/libIlmThread.so.6: undefined reference to `sem_destroy' /usr/lib/libIlmThread.so.6: undefined reference to `pthread_create' /usr/lib/libIlmThread.so.6: undefined reference to `sem_post' /usr/lib/libIlmThread.so.6: undefined reference to `sem_trywait' /usr/lib/libIlmThread.so.6: undefined reference to `sem_getvalue' /usr/lib/libIlmThread.so.6: undefined reference to `sem_wait' /usr/lib/libIlmThread.so.6: undefined reference to `pthread_join' collect2: ld returned 1 exit status Reading 'man sem_init', I found the statement "Link with -lrt or -pthread." Sure enough, both of these worked: $ gcc -o ctestil -lIL -lrt ctestil.o $ gcc -o ctestil -lIL -pthread ctestil.o B. Whether to fix Cabal? But why is Cabal spuriously reporting the absence of libIL? It is an error, isn't it? I have the impression, formed from browsing around on http://hackage.haskell.org/trac/hackage/, that in the configuration step, when Cabal sees the line Extra-Libraries: IL 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 it. Maybe Cabal needs to interpret the C compiler's error messages more carefully. Greg -- ___ ___ __ _ / _ \ / _ \| | | | Gregory D. Weber, Associate Professor / /_\// / | | | /\ | | Indiana University East / /_\\/ /__| | |/ \| | http://mypage.iu.edu/~gdweber/ \____/\_____/\___/\__/ Tel. (765) 973-8420; FAX (765) 973-8550

On 26/03/10 20:37, Gregory D. Weber wrote: [..]
B. Whether to fix Cabal?
But why is Cabal spuriously reporting the absence of libIL? It is an error, isn't it?
I have the impression, formed from browsing around on http://hackage.haskell.org/trac/hackage/, that in the configuration step, when Cabal sees the line
Extra-Libraries: IL
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 it. Maybe Cabal needs to interpret the C compiler's error messages more carefully.
Based on your own experiment it looks like Cabal is correct. Linking with *only* IL fails! The error is in the .cabal file, as you yourself point out mentioning only IL isn't enough (on Arch[1]). I would agree that Cabal's error message isn't as descriptive as it could be. Cheers, M [1]: It may work on other platforms/distros. It would be possible to decide which of pthread/rt to use when IL is compiled, and in that case it would be enough to use just -lIL. -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe
participants (2)
-
Gregory D. Weber
-
Magnus Therning