Haskell中cabal install glib遇到的问题

时间:2024-03-23 14:35:38

1. 运行命令cabal install glib时出现错误:

Cannot find gtk2hsC2hs
Please install `gtk2hs-buildtools` first and check that the install directory is in your PATH (e.g. HOME/.cabal/bin).

2. 运行命令cabal install gtk2hs-buildtools

Installed gtk2hs-buildtools-0.12.5.2

3. 重新运行命令cabal install glib,出现新的错误:

The program pkg-config version >=0.9.0 is required but it could not be found. 

4. 下载/安装GTK+ all-in-one bundle

a) 下载网址:http://www.gtk.org/download/win32.php,直接下载链接:http://win32builder.gnome.org/gtk+-bundle_3.6.4-20130921_win32.zip

b) 下载后,解压至一个文件夹,比如F:\GTK,并将该文件夹路径添加至PATH环境变量中

setx /M PATH "%PATH%;F:\GTK"

5. 重新运行命令cabal install glib,出现新的错误:

The pkg-config package glib-2.0 is required but it could not be found.

6. 运行命令pkg-config --modversion glib-2.0,出现错误:

ackage glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found

7. 在F:\GTK中添加glib-2.0.pc文件,文件内容如下:

prefix=F:\GTK
exec_prefix=F:\GTK
libdir=F:\GTK
includedir=F:\GTK glib_genmarshal=glib-genmarshal
gobject_query=gobject-query
glib_mkenums=glib-mkenums Name: GLib
Description: C Utility Library
Version: 2.0
Libs: -L${libdir} -lglib-2.0
Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include

8. 重新运行命令cabal install glib,又出现新的错误:

The pkg-config package gobject-2.0 is required but it could not be
found.

在F:\GTK中添加gobject-2.0.pc文件

9. 重新运行命令cabal install glib,又出现新的错误:

Missing dependencies on foreign libraries:
* Missing C libraries: glib-2.0, gobject-2.0
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.

就研究到这个地方,问题未得到解决。。。