2

This is the output from cabal install codec-image-devil:

Resolving dependencies...  
Configuring Codec-Image-DevIL-0.2.3...  
cabal: 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:  
Codec-Image-DevIL-0.2.3 failed during the configure step. The exception was:  
ExitFailure 1  

I tried --extra-include-dirs and --extra-lib-dirs. but they didn't work. so I edited the .cabal in Codec-Image-DevIL-0.2.3.tar.gz. I don't know if I'm even supposed to change that. but it worked for pthread.

I added these two lines:

include-dirs: C:\Users\Rumbold\Documents\libs\IL\include, C:\Users\Rumbold\Documents\libs\pthread\include, .  
extra-lib-dirs: C:\Users\Rumbold\Documents\libs\IL\lib, C:\Users\Rumbold\Documents\libs\pthread\lib, .  

They are indented so they are in the Library section. I don't know if I got the format for lists right, just something i stumbled upon while googling. The libs and `header files are all in the correct place, I think.

any clue how i can get it to work?

Edit_1:

I got it to work with --extra-include-dirs and --extra-lib-dirs, so I don't need to edit the cabal anymore. but IL still doesn't work. is there a way to find out which files it's looking for?

Wdit_2:

Alright it works. I had to rename DevIL.lib and DevIL.dll to libIL.lib and libIL.dll. (not sure if I had to do both, but that's what I did. also kept them under their old names)

Edit_3:

Getting lots of errors like:

"cabal\Codec-Image-DevIL-0.2.3\ghc-6.12.3/libHSCodec-Image-DevIL-0.2.3.a(DevIL.o):fake:(.text+0x2379):
undefined reference to `ilGetInteger@4'"
Cactus
  • 27,075
  • 9
  • 69
  • 149
user616024
  • 21
  • 2
  • 2
    Comma is the separator for the include-dirs and extra-lib dirs. On Windows you are advised to put paths in double quotes. Once you've started working with FFI bindings on Windows you really want to use a proper installation of MinGW/MSYS rather than rely on the parts of it that are distributed with GHC. DevIL seems to distribute DLL plus headers so you could build the binding with Cygwin as well. Note if you move to MinGW/MSYS I think you need to use double-slash path separators for include-dirs and extra-lib-dirs. – stephen tetley Feb 14 '11 at 11:24
  • Are the "undefined reference" errors during the cabal install or afterwards when trying compile something that uses HSCodec-Image-DevIL? – stephen tetley Feb 15 '11 at 08:24
  • afterwards. the cabal install worked, but now when i want to compile my program that uses codec.image.devil, i get those errors. – user616024 Feb 15 '11 at 09:39
  • Good - its better that its afterwards. Are you still pointing GHC to use --extra-lib-dirs when you compile your program? I suspect you may need to do this, as although you've installed the DevIL binding library, compiling an executable may still need to know where the DLL is. If you can compile but then get runtime errors because the DLL cannot be found, try copying the DLL into the same directory as the EXE. – stephen tetley Feb 15 '11 at 11:43
  • it works now. i've been using leksah before, now i compiled it manually with ghc. first i compiled without linking, which got me two .o files. then i copied devil.dll and devil.lib into the same folder, and linked my two .o files with devil.lib and the .o file cabal had made for codec.image.devil. – user616024 Feb 15 '11 at 12:52

0 Answers0