【问题标题】:Cabal: missing dependency on foreign C libraryCabal:缺少对外国 C 库的依赖
【发布时间】:2018-01-30 06:53:14
【问题描述】:

我一直在尝试在我的 Windows 机器上安装 tensorflow/haskell 包。

但是,在使用 stack 和 cabal 安装时,我一直遇到这个错误:

Cabal-simple_Z6RU0evB_1.24.2.0_ghc-8.0.2.exe: Missing dependency on a foreign
    library:
    * Missing C library: tensorflow
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.

根据 Tensorflow 网站:https://www.tensorflow.org/install/install_c ,Tensorflow 的 C 包只能在 Unix 机器上运行。我不确定这是死胡同还是有一些解决方法。

我在链接库或 cabal 方面没有经验,希望能得到一些帮助。

使用 Cabal,我在我的目录中包含了以下 .cabal 文件:

cabal-version: >= 1.2 
Executable hax 
Includes: c_api.h 
Extra-libraries: tensorflow 

但我仍然收到错误:cabal.exe: Missing dependency on a foreign library: * Missing C library: tensorflow The exception was: user error (Using 'build-type: Custom' but there is no Setup.hs or Setup.lhs script.)

【问题讨论】:

  • 您链接的页面没有明确的 Windows 说明,但肯​​定也是在 Windows 上构建的 designedHere 就是这样的构建。
  • 我在这里找到了应该是 C 库的东西:stackoverflow.com/questions/44682845/…,但我不知道该告诉 cabal 如何处理它
  • 您可以将标志--extra-lib-dirs=<..> 传递给cabal(堆栈有一个相应的字段可以放在配置文件中)。我不知道这是否足够;您可能需要.lib 文件和.dll 文件(我不太了解 GHC 如何链接事物以了解它是否真的如此)。
  • 随时尝试编辑您的问题 - 没有任何人可以单独处理单行错误消息。
  • 使用 Cabal,我在我的目录中包含了以下 .cabal 文件:cabal-version: >= 1.2 Executable hax Includes: c_api.h Extra-libraries: tensorflow 但我仍然收到错误:cabal.exe:缺少对外部库的依赖:* 缺少 C 库: tensorflow异常是:用户错误(使用'build-type:Custom'但没有Setup.hs或Setup.lhs脚本。)

标签: haskell cabal


【解决方案1】:

您写道“根据 Tensorflow 网站:https://www.tensorflow.org/install/install_c,Tensorflow 的 C 包只能在 Unix 机器上运行。我不确定这是死路还是有一些解决方法。”

确实,如果你的机器上没有安装tensorflow C 包——因为它不能在上面运行,那么你就找不到它来绑定它。

没有办法解决这个问题。

【讨论】:

    猜你喜欢
    • 2011-09-22
    • 1970-01-01
    • 1970-01-01
    • 2011-06-24
    • 2012-04-03
    • 2021-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多