How to fix linker errors when creating a package using cabal

I'm trying to make a package of Ben.Lippmeier's very nice ANUPlot graphics library (http://cs.anu.edu.au/people/Ben.Lippmeier) IMHO this would be a great contribution to the Haskell library, it's very clean code for newbies :) I created the following cabal file: name: Plot version: 1.1 license: AllRightsReserved maintainer: Ben.Lippmeier@anu.edu.au exposed-modules: Graphics.Plot.Display, Graphics.Plot.Picture, Graphics.Plot.Primitive, Graphics.Plot.Render, Graphics.Plot.Colors, Graphics.Plot.Util, Graphics.Plot.RenderState, Graphics.Plot.Animate, Graphics.Plot.View, Graphics.Plot.Wrapper, Graphics.Plot Build-Depends: base, OpenGL, GLUT ghc-options: -fglasgow-exts and then tried runhaskell Setup.hs configure runhaskell Setup.hs build runhaskell Setup.hs install which all seemed to work fine (see log below). However, when building an example that uses that package, I get a lot of linker errors (see log below) Is this because I configured the cabal files incorrectly, or do I have to adjust the module sources so they explicitly export the missing symbols? Thanks, Peter ------------------ LOG ------------------------------- L:\3rdParty\ANUPlot\src>runhaskell Setup.hs unregister Unregistering Plot-1.1... Saving old package config file... done. Writing new package config file... done. L:\3rdParty\ANUPlot\src>runhaskell Setup.hs clean cleaning... L:\3rdParty\ANUPlot\src>runhaskell Setup.hs configure --global Configuring Plot-1.1... configure: Dependency base-any: using base-2.1.1 configure: Dependency OpenGL-any: using OpenGL-2.2.1 configure: Dependency GLUT-any: using GLUT-2.1.1 configure: Using install prefix: C:\Program Files configure: Binaries installed in: C:\Program Files\Haskell\bin configure: Libraries installed in: C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1 configure: Private binaries installed in: C:\Program Files\Plot-1.1 configure: Data files installed in: C:\Program Files\Common Files\Plot-1.1 configure: Using compiler: c:\app\ghc\bin\ghc.exe configure: Compiler flavor: GHC configure: Compiler version: 6.6.1 configure: Using package tool: c:\app\ghc\bin\ghc-pkg.exe configure: Using ar found on system at: c:\app\ghc\bin\ar.exe configure: No haddock found configure: No pfesetup found configure: No ranlib found configure: Using runghc found on system at: c:\app\ghc\bin\runghc.exe configure: No runhugs found configure: No happy found configure: No alex found configure: Using hsc2hs: c:\app\ghc\bin\hsc2hs.exe configure: No c2hs found configure: No cpphs found configure: No greencard found L:\3rdParty\ANUPlot\src>runhaskell Setup.hs build Preprocessing library Plot-1.1... Building Plot-1.1... L:\3rdParty\ANUPlot\src>runhaskell Setup.hs register Registering Plot-1.1... Reading package info from ".installed-pkg-config" ... done. Saving old package config file... done. Writing new package config file... done. L:\3rdParty\ANUPlot\src>runhaskell Setup.hs install Installing: C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1 & C:\Program Files\Haskell\bin Plot-1.1... Registering Plot-1.1... Reading package info from ".installed-pkg-config" ... done. Saving old package config file... done. Writing new package config file... done. Linking AnimClock.exe ... C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Wrapper.o)(.text+0x2f1):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziCallback_Display_con_info' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Wrapper.o)(.text+0xc7c):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Wrapper.o)(.text+0xdcb):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziCallback_Idle_con_info' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Wrapper.o)(.text+0xdfc):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziCallback_Display_con_info' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Wrapper.o)(.text+0xe3b):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziCallback_Display_con_info' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Wrapper.o)(.text+0xe68):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziCallback_Display_con_info' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Wrapper.o)(.rodata+0x54):fa ke: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(RenderState.o)(.text+0x3d6) :fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(RenderState.o)(.text+0x652) :fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(RenderState.o)(.text+0x8ce) :fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(RenderState.o)(.text+0xb4a) :fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(RenderState.o)(.text+0xdc8) :fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziCallback_KeyMouse_con_info' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(RenderState.o)(.rodata+0x10 ):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x190b):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x19cc):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x1b9b):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x1c5c):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x20c9):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x21fc):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x22f0):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x2400):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x2e83):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x2f74):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x305c):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x37f9):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x3954):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x3a60):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x3b88):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x3dec):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x3ebc):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x402a):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x43c1):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x45f2):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x4975):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x4c5a):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x4efe):fake: more undefined references to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' follow C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x5b0a):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziCallback_Reshape_con_info' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x5b38):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziCallback_Motion_con_info' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.text+0x5b65):fake: undefined reference to `Plotzm1zi1_GraphicsziPlotziCallback_KeyMouse_con_info' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.rodata+0x130):fake : undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.rodata+0x134):fake : undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.rodata+0x144):fake : undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.rodata+0x148):fake : undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.rodata+0x170):fake : undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.rodata+0x174):fake : undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.rodata+0x1a4):fake : undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(View.o)(.rodata+0x1a8):fake : undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Render.o)(.text+0x1e2b):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziTexture_cacheTexture_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Render.o)(.text+0x2146):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziRaster_withRasterCoords_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Render.o)(.text+0x2484):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziRaster_withRasterCoords_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Render.o)(.rodata+0xc0):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziRaster_withRasterCoords_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Render.o)(.rodata+0xc4):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziTexture_cacheTexture_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.text+0x322):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.text+0x511):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.text+0x75c):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.text+0x838):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.text+0x908):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.text+0x1111):fa ke: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.text+0x1220):fa ke: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.text+0x151a):fa ke: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.text+0x16bc):fa ke: undefined reference to `Plotzm1zi1_GraphicsziPlotziCallback_KeyMouse_con_info' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.text+0x17bd):fa ke: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.text+0x18b4):fa ke: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.text+0x1a24):fa ke: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.rodata+0x28):fa ke: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.rodata+0x2c):fa ke: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.rodata+0x98):fa ke: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.rodata+0xac):fa ke: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zhzh_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Animate.o)(.rodata+0xb0):fa ke: undefined reference to `Plotzm1zi1_GraphicsziPlotziUtilOp_zlzhzhzg_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Display.o)(.text+0x766):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziDump_dumpFragmentState_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Display.o)(.text+0x76d):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziDump_dumpFramebufferState_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Display.o)(.text+0x7d7):fak e: undefined reference to `Plotzm1zi1_GraphicsziPlotziDump_dumpGlutState_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Display.o)(.rodata+0xa4):fa ke: undefined reference to `Plotzm1zi1_GraphicsziPlotziDump_dumpGlutState_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Display.o)(.rodata+0xa8):fa ke: undefined reference to `Plotzm1zi1_GraphicsziPlotziDump_dumpFramebufferState_closure' C:\Program Files\Haskell\Plot-1.1\ghc-6.6.1/libHSPlot-1.1.a(Display.o)(.rodata+0xac):fa ke: undefined reference to `Plotzm1zi1_GraphicsziPlotziDump_dumpFragmentState_closure' collect2: ld returned 1 exit status

Oops, I forget to paste that in. Just GHC --make AnimClock.hs with ANUPlot\src\Demo As the current directory. -----Original Message----- From: haskell-cafe-bounces@haskell.org [mailto:haskell-cafe-bounces@haskell.org] On Behalf Of Malte Milatz Sent: Saturday, August 25, 2007 12:11 PM To: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] How to fix linker errors when creating a package using cabal Peter Verswyvelen:
However, when building an example that uses that package, I get a lot of linker errors (see log below)
What options did you use when compiling the example? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (2)
-
Malte Milatz
-
Peter Verswyvelen