堆栈无法在Windows下编译

时间:2017-12-11 23:36:16

标签: windows haskell compilation glib haskell-stack

我有一个相当棘手的错误,阻止我在Windows下构建一个小的haskell项目,which you can find here if you want to try to compile it。我在cygwin64下。

我在建议given on this post上使用堆栈作为构建助手。 现在,构建在最后接近失败(在尝试这样做几个小时之后相当令人沮丧)。

错误消息如下:

setup.exe:
'C:\Users\Julien\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.2\bin\ghc-pkg.EXE'
exited with an error:
cairo-0.13.4.2: Warning: haddock-interfaces:
C:\cygwin64\tmp\stack11608\cairo-0.13.4.2\.stack-work\dist\ca59d0ab\doc\html\cairo\cairo.haddock
doesn't exist or isn't a file
cairo-0.13.4.2: Warning: haddock-html:
C:\cygwin64\tmp\stack11608\cairo-0.13.4.2\.stack-work\dist\ca59d0ab\doc\html\cairo
doesn't exist or isn't a directory
cairo-0.13.4.2: include-dirs: /usr/include/cairo is a relative path which
makes no sense (as there is nothing for it to be relative to). You can make
paths relative to the package database itself by using ${pkgroot}. (use
--force to override)
cairo-0.13.4.2: include-dirs: /usr/include/glib-2.0 is a relative path which
makes no sense (as there is nothing for it to be relative to). You can make
paths relative to the package database itself by using ${pkgroot}. (use
--force to override)
cairo-0.13.4.2: include-dirs: /usr/lib/glib-2.0/include is a relative path
which makes no sense (as there is nothing for it to be relative to). You can
make paths relative to the package database itself by using ${pkgroot}. (use
--force to override)
cairo-0.13.4.2: include-dirs: /usr/include/pixman-1 is a relative path which
makes no sense (as there is nothing for it to be relative to). You can make
paths relative to the package database itself by using ${pkgroot}. (use
--force to override)
cairo-0.13.4.2: include-dirs: /usr/include/freetype2 is a relative path which
makes no sense (as there is nothing for it to be relative to). You can make
paths relative to the package database itself by using ${pkgroot}. (use
--force to override)
cairo-0.13.4.2: include-dirs: /usr/include/libpng16 is a relative path which
makes no sense (as there is nothing for it to be relative to). You can make
paths relative to the package database itself by using ${pkgroot}. (use
--force to override)


--  While building custom Setup.hs for package glib-0.13.5.0 using:
  C:\cygwin64\tmp\stack11608\glib-0.13.5.0\.stack-work\dist\ca59d0ab\setup\setup --builddir=.stack-work\dist\ca59d0ab build --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: C:\cygwin64\home\Julien\syme-master\.stack-work\logs\glib-0.13.5.0.log

[1 of 2] Compiling Main             ( C:\cygwin64\tmp\stack11608\glib-0.13.5.0\Setup.hs, C:\cygwin64\tmp\stack11608\glib-0.13.5.0\.stack-work\dist\ca59d0ab\setup\Main.o )
[2 of 2] Compiling StackSetupShim   ( C:\sr\setup-exe-src\setup-shim-Z6RU0evB.hs, C:\cygwin64\tmp\stack11608\glib-0.13.5.0\.stack-work\dist\ca59d0ab\setup\StackSetupShim.o )
Linking C:\cygwin64\tmp\stack11608\glib-0.13.5.0\.stack-work\dist\ca59d0ab\setup\setup.exe ...
Configuring glib-0.13.5.0...
Building glib-0.13.5.0...
In file included from C:/cygwin64/usr/include/glib/gtypes.h:34:0,
                 from C:/cygwin64/usr/include/glib/galloca.h:32,
                 from C:/cygwin64/usr/include/glib.h:30,
                 from C:/cygwin64/usr/include/gobject/gbinding.h:28,
                 from C:\cygwin64\home\Julien\syme-master\../../../usr/include\glib-object.h:23:
C:/cygwin64/usr/include/glib/gversionmacros.h:257:2: error: #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
 #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
  ^
Preprocessing library glib-0.13.5.0...
setup.exe: Error during preprocessing

关键是根据cygwin安装程序,我安装了libglib2.0-devel版本2.52.3-1。它是glib2的错误版本吗?其他glib版本之间是否有冲突?如果是这样,我怎样才能理解堆栈理解 哪个版本正确?

我必须说通过在stack.yaml文件中添加相对路径来搞砸了一些,我不知道它是否有麻烦。

非常感谢任何帮助。

UDPATE:正如评论建议的那样,我更改了我的项目本地stack.yaml以添加以下内容(花了一些时间来弄清楚如何在Windows上编写路径)

extra-include-dirs: [c;\\cygwin64\\usr\\include]
extra-lib-dirs: [c;\\cygwin64\\lib]

在这些内容中,我解压缩了评论中提供的链接user2407038提供的库。现在,错误消息如下所示:

--  While building custom Setup.hs for package cairo-0.13.4.2 using:
  C:\cygwin64\tmp\stack10676\cairo-0.13.4.2\.stack-work\dist\ca59d0ab\setup\setup --builddir=.stack-work\dist\ca59d0ab build --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: C:\cygwin64\home\Julien\syme-master\.stack-work\logs\cairo-0.13.4.2.log

[1 of 2] Compiling Main             ( C:\cygwin64\tmp\stack10676\cairo-0.13.4.2\Setup.hs, C:\cygwin64\tmp\stack10676\cairo-0.13.4.2\.stack-work\dist\ca59d0ab\setup\Main.o )
[2 of 2] Compiling StackSetupShim   ( C:\sr\setup-exe-src\setup-shim-Z6RU0evB.hs, C:\cygwin64\tmp\stack10676\cairo-0.13.4.2\.stack-work\dist\ca59d0ab\setup\StackSetupShim.o )
Linking C:\cygwin64\tmp\stack10676\cairo-0.13.4.2\.stack-work\dist\ca59d0ab\setup\setup.exe ...
Configuring cairo-0.13.4.2...
Building cairo-0.13.4.2...
C:\cygwin64\tmp\stack10676\cairo-0.13.4.2\cairo-gtk2hs.h:1:18: fatal error: cairo.h: No such file or directory
compilation terminated.
Preprocessing library cairo-0.13.4.2...
setup.exe: Error during preprocessing


-- While building custom Setup.hs for package glib-0.13.5.0 using:
C:\cygwin64\tmp\stack10676\glib-0.13.5.0\.stack-work\dist\ca59d0ab\setup\setup --builddir=.stack-work\dist\ca59d0ab build --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: C:\cygwin64\home\Julien\syme-master\.stack-work\logs\glib-0.13.5.0.log

[1 of 2] Compiling Main             ( C:\cygwin64\tmp\stack10676\glib-0.13.5.0\Setup.hs, C:\cygwin64\tmp\stack10676\glib-0.13.5.0\.stack-work\dist\ca59d0ab\setup\Main.o )
[2 of 2] Compiling StackSetupShim   ( C:\sr\setup-exe-src\setup-shim-Z6RU0evB.hs, C:\cygwin64\tmp\stack10676\glib-0.13.5.0\.stack-work\dist\ca59d0ab\setup\StackSetupShim.o )
Linking C:\cygwin64\tmp\stack10676\glib-0.13.5.0\.stack-work\dist\ca59d0ab\setup\setup.exe ...
Configuring glib-0.13.5.0...
Building glib-0.13.5.0...
Preprocessing library glib-0.13.5.0...
setup.exe: glib-object.h: File does not exist

我在哪里可以找到这些标题?

1 个答案:

答案 0 :(得分:0)

我会看一下gtk2hs的Windows安装说明:https://wiki.haskell.org/Gtk2Hs/Installation#Windows

您可以直接下载该捆绑包(来自https://www.gtk.org/download/windows.php),也可以使用随平台安装的msys发行版分发的pacman进行安装。

你应该使用msys版本或独立版本,而不是cywin版本,因为ghc是为与msys而不是cygwin一起构建的。

一旦完成,您应该能够正确设置路径cabal install cairo

相关问题