无法在Windows上安装cairo haskell绑定

时间:2013-03-02 17:50:18

标签: haskell cabal cairo

我正在尝试在Windows 7上安装cairo-0.12.4 Haskell软件包。我首先下载并解压缩Gtk + 2并将其bin子目录添加到PATH。然后我尝试使用额外的库运行cabal并包括:

cabal --extra-lib-dirs="d:\Program Files (x86)\Gtk+\lib" 
      --extra-include-dirs="d:\Program Files (x86)\Gtk+\include" install

但我收到以下错误

 Reading available packages...
 Choosing modular solver.
 Resolving dependencies...
 Ready to install cairo-0.12.4
 Waiting for install task to finish...
 Extracting
 C:\Users\abailly\AppData\Roaming\cabal\packages\hackage.haskell.org\cairo\0.12.4\cairo-0.12.4.tar.gz
 to C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368...
 Updating cairo.cabal with the latest revision from the index.
 creating
 C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist\setup
 creating
 C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist
 creating
 C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist\setup
 d:\Program Files (x86)\Haskell Platform\2012.2.0.0\bin\ghc.exe --make C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-
 0.12.4\Setup.hs -o C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist\setup\setup.exe -odir C:\Users\abailly\
 AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist\setup -hidir C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.
 12.4\dist\setup -i -iC:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4 -package Cabal-1.14.0
 [1 of 2] Compiling SetupWrapper     ( C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\SetupWrapper.hs, C:\Users
 \abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist\setup\SetupWrapper.o )
 [2 of 2] Compiling Main             ( C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\Setup.hs, C:\Users\abaill
 y\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist\setup\Main.o )
 Linking C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist\setup\setup.exe ...
 C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist\setup\setup.exe
 configure --verbose=2 --ghc --prefix=C:\Users\abailly\AppData\Roaming\cabal
 --user --flags=cairo_svg --flags=cairo_ps --flags=cairo_pdf
 --extra-include-dirs=D:\Program Files (x86)\Gtk+\include
 --extra-lib-dirs=D:\Program Files (x86)\Gtk+\lib --constraint=mtl ==2.1.2
 --constraint=bytestring ==0.9.2.1 --constraint=base ==4.5.0.0
 --constraint=array ==0.4.0.0 --disable-tests --disable-benchmarks
 [1 of 2] Compiling Gtk2HsSetup      ( Gtk2HsSetup.hs, dist\setup-wrapper\Gtk2HsSetup.o )
 [2 of 2] Compiling Main             ( SetupMain.hs, dist\setup-wrapper\Main.o )
 Linking dist/setup-wrapper\setup.exe ...
 Configuring cairo-0.12.4...
 Flags chosen: cairo_svg=True, cairo_ps=True, cairo_pdf=True
 Dependency array ==0.4.0.0: using array-0.4.0.0
 Dependency base ==4.5.0.0: using base-4.5.0.0
 Dependency bytestring ==0.9.2.1: using bytestring-0.9.2.1
 Dependency mtl ==2.1.2: using mtl-2.1.2
 Dependency cairo-pdf -any: using version 1.10.2
 Dependency cairo-ps -any: using version 1.10.2
 Dependency cairo-svg -any: using version 1.10.2
 Dependency cairo >=1.2.0: using version 1.10.2
 Using Cabal-1.14.0 compiled by ghc-7.4
 Using compiler: ghc-7.4.1
 Using install prefix: C:\Users\abailly\AppData\Roaming\cabal
 Binaries installed in: C:\Users\abailly\AppData\Roaming\cabal\bin
 Libraries installed in:
 C:\Users\abailly\AppData\Roaming\cabal\cairo-0.12.4\ghc-7.4.1
 Private binaries installed in:
 C:\Users\abailly\AppData\Roaming\cabal\cairo-0.12.4
 Data files installed in: C:\Users\abailly\AppData\Roaming\cabal\cairo-0.12.4
 Documentation installed in:
 C:\Users\abailly\AppData\Roaming\cabal\doc\cairo-0.12.4
 Using alex version 3.0.1 found on system at: d:\Program Files (x86)\Haskell
 Platform\2012.2.0.0\lib\extralibs\bin\alex.exe
 Using ar found on system at: d:\Program Files (x86)\Haskell
 Platform\2012.2.0.0\mingw\bin\ar.exe
 No c2hs found
 Using cpphs version 1.16 found on system at:
 c:\Users\abailly\AppData\Roaming\cabal\bin\cpphs.exe
 No ffihugs found
 Using gcc version 4.5.2 found on system at: d:\Program Files (x86)\Haskell
 Platform\2012.2.0.0\mingw\bin\gcc.exe
 Using ghc version 7.4.1 found on system at: d:\Program Files (x86)\Haskell
 Platform\2012.2.0.0\bin\ghc.exe
 Using ghc-pkg version 7.4.1 found on system at: d:\Program Files (x86)\Haskell
 Platform\2012.2.0.0\bin\ghc-pkg.exe
 No greencard found
 Using gtk2hsC2hs version 0.13.6 found on system at:
 c:\Users\abailly\AppData\Roaming\cabal\bin\gtk2hsC2hs.exe
 Using gtk2hsHookGenerator found on system at:
 c:\Users\abailly\AppData\Roaming\cabal\bin\gtk2hsHookGenerator.exe
 Using gtk2hsTypeGen found on system at:
 c:\Users\abailly\AppData\Roaming\cabal\bin\gtk2hsTypeGen.exe
 Using haddock version 2.10.0 found on system at: d:\Program Files
 (x86)\Haskell Platform\2012.2.0.0\bin\haddock.exe
 Using happy version 1.18.9 found on system at: d:\Program Files (x86)\Haskell
 Platform\2012.2.0.0\lib\extralibs\bin\happy.exe
 No hmake found
 Using hpc version 0.6 found on system at: d:\Program Files (x86)\Haskell
 Platform\2012.2.0.0\bin\hpc.exe
 Using hsc2hs version 0.67 found on system at: d:\Program Files (x86)\Haskell
 Platform\2012.2.0.0\bin\hsc2hs.exe
 Using hscolour version 1.20 found on system at:
 c:\Users\abailly\AppData\Roaming\cabal\bin\HsColour.exe
 No hugs found
 No jhc found
 Using ld found on system at: d:\Program Files (x86)\Haskell
 Platform\2012.2.0.0\mingw\bin\ld.exe
 No lhc found
 No lhc-pkg found
 No nhc98 found
 Using pkg-config version 0.26 found on system at: d:\Program Files
 (x86)\Gtk+\bin\pkg-config.exe
 Using ranlib found on system at: d:\Program Files (x86)\Haskell
 Platform\2012.2.0.0\mingw\bin\ranlib.exe
 Using strip found on system at: d:\Program Files (x86)\Haskell
 Platform\2012.2.0.0\mingw\bin\strip.exe
 Using tar found on system at: D:\Program Files (x86)\Git\bin\tar.exe
 No uhc found
 d:\Program Files (x86)\Gtk+\bin\pkg-config.exe --modversion cairo-pdf
 d:\Program Files (x86)\Gtk+\bin\pkg-config.exe --modversion cairo-ps
 d:\Program Files (x86)\Gtk+\bin\pkg-config.exe --modversion cairo-svg
 d:\Program Files (x86)\Gtk+\bin\pkg-config.exe --modversion cairo
 setup.exe: Missing dependencies on foreign libraries:
 * Missing C libraries: z, cairo
 This problem can usually be solved by installing the system packages that
 provide these libraries (you may need the "-dev" versions). If the libraries
 are already installed but in a non-standard location then you can use the
 flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.
 Failed to install cairo-0.12.4
 cabal.exe: Error: some packages failed to install:
 Chart-0.16 depends on cairo-0.12.4 which failed to install.
 cairo-0.12.4 failed during the configure step. The exception was:
 ExitFailure 1
 splot-0.3.8 depends on cairo-0.12.4 which failed to install.

当我尝试直接安装cairo时,我得到了以下内容:

d:\Program Files (x86)\Gtk+\bin\pkg-config.exe --modversion cairo-pdf
d:\Program Files (x86)\Gtk+\bin\pkg-config.exe --modversion cairo-ps
d:\Program Files (x86)\Gtk+\bin\pkg-config.exe --modversion cairo-svg
d:\Program Files (x86)\Gtk+\bin\pkg-config.exe --modversion cairo
setup.exe: Missing dependencies on foreign libraries:
* Missing C libraries: z, cairo
This problem can usually be solved by installing the system packages that
provide these libraries (you may need the "-dev" versions). If the libraries
are already installed but in a non-standard location then you can use the
flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.
Failed to install cairo-0.12.4
World file is already up to date.
cabal.exe: Error: some packages failed to install:
cairo-0.12.4 failed during the configure step. The exception was:
ExitFailure 1

我无能为力......

3 个答案:

答案 0 :(得分:4)

如果您阅读错误消息:

* Missing C libraries: z, cairo

它说您需要为库libz和cairo安装库(和头文件)。在* nix系统上,这通常意味着只需在软件包管理器中安装这些软件包的-dev版本。在Windows上我假设你下载了该库的源版本并安装。

答案 1 :(得分:2)

我遇到了这个问题。在我的情况下,它是64位ghc和32位cairo dll之间的不匹配

答案 2 :(得分:1)

我将Gtk +库移动到D:\soft\gtk+\,一切运行正常。 Gtk +的路径包含似乎没有被cabal / ghc正确解释的空间,尽管我引用了它:

--extra-lib-dirs="d:\Program Files (x86)\Gtk+\lib"

解决方案:将gtk +放在无空位的位置。

更新:现在,无法安装Chart-0.16时出现更加神秘的错误:

Loading package Win32-2.2.2.0 ... linking ... done.
Loading package array-0.4.0.0 ... linking ... done.
Loading package deepseq-1.3.0.0 ... linking ... done.
Loading package old-locale-1.0.0.4 ... linking ... done.
Loading package time-1.4 ... linking ... done.
Loading package containers-0.4.2.1 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package data-accessor-0.2.2.3 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package utility-ht-0.0.8 ... linking ... done.
Loading package data-accessor-template-0.2.1.10 ... linking ... done.
Loading package colour-2.3.3 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
*** gcc:
"D:\Program Files (x86)\Haskell Platform\2012.2.0.0\lib/../mingw/bin/gcc.exe" "-fno-stack-protector" "-Wl,--hash-size=31" "-Wl,--r
educe-memory-overheads" "-LC:\Users\abailly\AppData\Roaming\cabal\cairo-0.12.4\ghc-7.4.1" "-Ld:/soft/Gtk+/lib" "--print-file-name"
 "libz.dll"
*** gcc:
"D:\Program Files (x86)\Haskell Platform\2012.2.0.0\lib/../mingw/bin/gcc.exe" "-fno-stack-protector" "-Wl,--hash-size=31" "-Wl,--r
educe-memory-overheads" "-LC:\Users\abailly\AppData\Roaming\cabal\cairo-0.12.4\ghc-7.4.1" "-Ld:/soft/Gtk+/lib" "--print-file-name"
 "libcairo-2.dll"
Loading package cairo-0.12.4 ... d:\Program Files (x86)\Haskell Platform\2012.2.0.0\bin\ghc.exe returned
ExitFailure 1
Failed to install Chart-0.16
cabal.exe: Error: some packages failed to install:
Chart-0.16 failed during the building phase. The exception was:
ExitFailure 1
splot-0.3.8 depends on Chart-0.16 which failed to install.

我怀疑这是由于链接错误,因为当我执行以下命令时编译运行正常,这是cabal在调试模式下输出的内容:

 "D:\\Program Files (x86)\\Haskell Platform\\2012.2.0.0\\bin\\ghc.exe"
 "--make" "-v" "-fbuilding-cabal-package" "-O" "-odir" "dist\\build"
 "-hidir" "dist\\build" "-stubdir" "dist\\build" "-i" "-idist\\build"
 "-i." "-idist\\build\\autogen" "-Idist\\build\\autogen"
 "-Idist\\build" "-optP-include"
 "-optPdist\\build\\autogen\\cabal_macros.h" "-package-name"
 "Chart-0.16" "-hide-all-packages" "-package-conf"
 "dist\\package.conf.inplace" "-package-id"
 "array-0.4.0.0-3cf1bc3f5cd0078adea24752c18081b9" "-package-id"
 "base-4.5.0.0-597748f6f53a7442bcae283373264bb6" "-package-id"
 "cairo-0.12.4-f04021ea456c901e8d05395a31f7a861" "-package-id"
 "colour-2.3.3-4eaa610bb6d825a7334e1b3de448f6c0" "-package-id"
 "data-accessor-0.2.2.3-5477c48e3478339fdff299c536a033c6" "-package-id"
 "data-accessor-template-0.2.1.10-28ee96821fd908880f3a49417c4da548"
 "-package-id" "mtl-2.1.2-7ec8bbada2af74b49c6e4aeea2889fdc"
 "-package-id" "old-locale-1.0.0.4-29bd50ed2bb4a20928338f52e4ab1b71"
 "-package-id" "time-1.4-01d7bf22d87e70510fe9ee4c4434b3ab"
 "-XHaskell98" "Graphics.Rendering.Chart"
 "Graphics.Rendering.Chart.Types" "Graphics.Rendering.Chart.Renderable"
 "Graphics.Rendering.Chart.Axis"
 "Graphics.Rendering.Chart.Axis.Floating"
 "Graphics.Rendering.Chart.Axis.Indexed"
 "Graphics.Rendering.Chart.Axis.Int"
 "Graphics.Rendering.Chart.Axis.LocalTime"
 "Graphics.Rendering.Chart.Axis.Types"
 "Graphics.Rendering.Chart.Axis.Unit" "Graphics.Rendering.Chart.Layout"
 "Graphics.Rendering.Chart.Legend" "Graphics.Rendering.Chart.Simple"
 "Graphics.Rendering.Chart.Simple.Internal"
 "Graphics.Rendering.Chart.Grid" "Graphics.Rendering.Chart.Plot"
 "Graphics.Rendering.Chart.Plot.Types"
 "Graphics.Rendering.Chart.Plot.Annotation"
 "Graphics.Rendering.Chart.Plot.AreaSpots"
 "Graphics.Rendering.Chart.Plot.Bars"
 "Graphics.Rendering.Chart.Plot.Candle"
 "Graphics.Rendering.Chart.Plot.ErrBars"
 "Graphics.Rendering.Chart.Plot.FillBetween"
 "Graphics.Rendering.Chart.Plot.Hidden"
 "Graphics.Rendering.Chart.Plot.Lines"
 "Graphics.Rendering.Chart.Plot.Pie"
 "Graphics.Rendering.Chart.Plot.Points"
 "Graphics.Rendering.Chart.SparkLine" "-hide-package" "monads-tf" 

我更加困惑......

更新(2):当我运行cabal install > out 2>&1时,它会成功!