Не удалось установить привязки cairo haskell в Windows

Я пытаюсь установить пакет cairo-0.12.4 Haskell в Windows 7. Сначала я загрузил и распаковал 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

я без понятия...


person insitu    schedule 02.03.2013    source источник


Ответы (3)


Если вы прочитали сообщение об ошибке:

* Missing C libraries: z, cairo

В нем говорится, что вам нужно установить библиотеки (и файлы заголовков) для библиотек libz и cairo. В системах *nix это обычно означает установку -dev версий этих пакетов с помощью менеджера пакетов. Я предполагаю, что в Windows вы загрузите исходную версию библиотеки и установите ее.

person Thomas M. DuBuisson    schedule 02.03.2013
comment
Спасибо за Ваш ответ. Как я уже сказал, я скачал пакет gitk+, который содержит как библиотеки DLL, так и заголовки. AFAICT, эти библиотеки присутствуют в моей системе в каталоге D:\Program Files (x86)\Gtk+\: - z -> include\zlib.h - cairo -> include\cairo\cairo.h - cairo.lib -> lib\ - zdll.lib -> lib\ Я изменил командную строку Cabal, чтобы добавить библиотеки DLL и указать пути к Cabal. Отсюда и мое недоумение... - person insitu; 03.03.2013
comment
Кстати, я хотел собрать cairo из исходного кода в Windows, но я (пока) не пробовал это, так как ожидал, что готовых бинарных пакетов будет более чем достаточно, учитывая мои потребности. Может я и ошибаюсь, конечно. - person insitu; 03.03.2013
comment
Какова бы ни была цель загруженной вами библиотеки GTK, похоже, что ваша сборка (cabal) не знает, где найти cairo или z. Возможно, придется немного повозиться, чтобы понять, почему нет. - person Thomas M. DuBuisson; 03.03.2013
comment
Я понимаю. Но я ожидал каких-то подсказок от людей, более осведомленных, чем я :-) В любом случае спасибо. - person insitu; 03.03.2013

У меня возникла эта проблема. В моем случае это было несоответствие между 64-битным ghc и 32-битной cairo dll.

person Simon Bergot    schedule 22.04.2014

Я переместил библиотеку 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, все проходит успешно!

person insitu    schedule 03.03.2013