我在OS X Lion上构建hmatrix library时遇到问题。看看.cabal文件,它需要gsl
库,所以我使用macports安装它。 .a文件位于/ opt/local/lib中,.h文件位于/ opt/local/include/gsl中Haskell包丢失c库
如建议here我将内置类型从Custom更改为Simple。 (没有这种变化,我得到了类似的错误)。
当我使用cabal configure
我得到以下输出:
* Missing C library: gsl
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
于是,我就cabal --extra-include-dirs=/opt/local/include --extra-lib-dirs=/opt/local/lib configure
,但我仍然得到同样的错误。我可以编译和链接一个包含gsl的c程序。 cabal正在寻找哪些文件?如果我有正确的文件,我该如何告诉它如何找到它们?
libgsl.a是通用二进制:
$ file /opt/local/lib/libgsl.a
/opt/local/lib/libgsl.a: Mach-O universal binary with 2 architectures
/opt/local/lib/libgsl.a (for architecture x86_64): current ar archive random library
/opt/local/lib/libgsl.a (for architecture i386): current ar archive random library
GHC看起来像它的64位:
$ ghc --info
[("Project name","The Glorious Glasgow Haskell Compilation System")
,("GCC extra via C opts"," -fwrapv")
,("C compiler command","/usr/bin/llvm-gcc")
,("C compiler flags"," -m64 -fno-stack-protector -m64")
,("ar command","/usr/bin/ar")
,("ar flags","clqs")
,("ar supports at file","NO")
,("touch command","touch")
,("dllwrap command","/bin/false")
,("windres command","/bin/false")
,("perl command","/usr/bin/perl")
,("target os","OSDarwin")
,("target arch","ArchX86_64")
,("target word size","8")
,("target has GNU nonexec stack","False")
,("target has subsections via symbols","True")
,("Project version","7.4.2")
,("Booter version","7.4.2")
,("Stage","2")
,("Build platform","x86_64-apple-darwin")
,("Host platform","x86_64-apple-darwin")
,("Target platform","x86_64-apple-darwin")
,("Have interpreter","YES")
,("Object splitting supported","NO")
,("Have native code generator","YES")
,("Support SMP","YES")
,("Unregisterised","NO")
,("Tables next to code","YES")
,("RTS ways","l debug thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn thr_debug_dyn")
,("Leading underscore","YES")
,("Debug on","False")
,("LibDir","/usr/local/Cellar/ghc/7.4.2/lib/ghc-7.4.2")
,("Global Package DB","/usr/local/Cellar/ghc/7.4.2/lib/ghc-7.4.2/package.conf.d")
,("Gcc Linker flags","[\"-m64\"]")
,("Ld Linker flags","[\"-arch\",\"x86_64\"]")
]
在黑暗中完成拍摄:你有安装g ++吗?我记得安装了一个不同的库,并得到类似的奇怪的错误信息(它也没有找到明确安装的C库);后来证明它也需要g ++。 – 2013-04-30 04:03:12
我确实安装了g ++。 – munk 2013-04-30 04:06:40
您是否尝试过'cabal install -v hmatrix'来查看失败的步骤?这可能有助于缩小问题的范围。 – 2013-05-01 11:39:23