Search code examples
haskellcabalhaskell-platform

Error Installing friday-DevIL - "Missing C Library: IL" on Windows


I'm having a problem similar to the one listed here: Trying to install Image.Codec.DevIL under windows. Needs pthread and IL. Can't get IL to work But I don't seem to be able resolve it following the small pieces of advice in the comments.

I'm running the Haskell Platform on Windows 7, and am attempt to install and use the friday package https://hackage.haskell.org/package/friday

I can successfully run cabal install package friday but when attempting to run cabal install package friday-devil, the package installation fails with the following errors:

Resolving dependencies... 
Configuring friday-devil-0.1.1.1... 
Failed to install friday-devil-0.1.1.1 Last 10 lines of the build log ( C:\Users\Chris\AppData\Roaming\cabal\logs\friday-devil-0.1.1.1.log):     
Configuring friday-devil-0.1.1.1...
setup-Cabal-1.18.1.3-x86_64-windows-ghc-7.8.3.exe: 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. 
cabal: Error: some packages failed to install: 
friday-devil-0.1.1.1 failed during the configure step. The exception was: 
ExitFailure 1

I've installed the libraries found at http://openil.sourceforge.net/, I've also tried manually specifying the location of the libs included in DevIL with the --extra-include-dirs= and --extra-lib-dirs= options suggested above.

I've also attempted to run using MSYS2 shell and via cygwin (running out of ideas at that point).

I thought that maybe the other answer was on to something regarding pthreads, but I've just attempted to install that and reference it, and nothing seemed to change.

I'm unsure what else to try at this point, any thoughts greatly appreciated.

Edit: I get exactly the same issue in Ubuntu 14, there must be a step I'm missing/not understanding somewhere.

Further Edit: I've managed to get over this hump in Ubuntu by running sudo apt-get install libdevil-dev as suggested in this answer: g++ with DevIL: unable to link

Also tried everything listed on this page: https://github.com/RaphaelJ/friday-devil/wiki/Windows and the error persists.

I guess I need to figure out what the equivalent is in Windows?


Solution

  • I eventually managed to get this to work using the steps here with a couple of tweaks.

    DevIL C libraries do not come with friday-devil. Those trying to use friday-devil on Windows can use the following procedue:

    1. Download prebuilt Windows binaries and header files. These are currently hosted from sourceforge in the "DevIL Windows SDK" folder. You will need either x86 or the x64 variant depending on which version of GHC you are using.

    2. Extract the archive somewhere on your hard drive such as C:\DevIL-1.7.8-x64.

    3. Unpack friday-devil with cabal unpack friday-devil.

    4. Edit the "friday-devil.cabal" file so that the "Extra-Libraries" field specifies "DevIL" instead of "IL".

      Extra-Libraries: DevIL

    5. install friday-devil with cabal install friday-devil --extra-lib-dirs=c:\devil-1.7.8-x64 --extra-include-dirs=c:\devil-1.7.8-x64\include.

    Step 3 creates a directory e.g. friday-devil-0.1.1.1, which is where the .cabal file you need to edit resides.

    I was unsuccessful when attempting to run the command in step 5. Instead I had to cd into the friday-devil-0.1.1.1 directory created in step 3, and simply run:

    cabal install --extra-lib-dirs=c:\devil-1.7.8-x64 --extra-include-dirs=c:\devil-1.7.8-x64\include. 
    

    without specifying friday-devil.

    It might be the case that when running the full command, cabal was using a previously downloaded version (although yesterday I'm reasonably sure I changed the downloaded package in the cabal directory as well). I may revisit this on another system at some point, but the altered cabal install step above has solved my immediate problem.

    I'm sure it might just be a simple/obvious to people more familiar with cabal in general (I'm new to this), but I'll leave this here on the off chance it helps someone.