Build error with Haskell GD bindings

I installed the GD package ( http://hackage.haskell.org/package/gd-3000.4.0 ) using cabal. When I try to compile a program that uses GD, I get the error:

[mp262554@students:~/jpp/haskell]$ ghc gd.hs
compilation IS NOT required
gd.o: In function `sV8_info':
(.text+0x1bf): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_saveJpegFile_closure'
gd.o: In function `sUY_info':
(.text+0x3be): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_drawLine_closure'
gd.o: In function `sUI_info':
(.text+0x51a): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_newImage_closure'
gd.o: In function `sUI_info':
(.text+0x6a5): undefined reference to `__stginit_gdzm3000zi4zi0_GraphicsziGD_'
gd.o: In function `sVc_srt':
(.data+0x34): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_drawLine_closure'
gd.o: In function `sVc_srt':
(.data+0x38): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_saveJpegFile_closure'
gd.o: In function `sUI_srt':
(.data+0x4c): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_newImage_closure'
collect2: ld returned 1 exit status

      

+2


a source to share


2 answers


The GD package provides bindings to the GD library written in C. You need to link the C library to your program. First try the option --make

for GHC:

 ghc --make gd.hs

      



GHC --make

should automatically detect dependencies and correctly link a multi-module program. You can also use the settings -l

and -l

manually.

+2


a source


Such messages may indicate that the files need to be recompiled. Try ghc -fforce-recomp



0


a source







All Articles