Haskell:Arch Linux 上缺少的 C 库可在 Ubuntu 上运行 [英] Haskell: Missing C library on Arch Linux works on Ubuntu

查看:18
本文介绍了Haskell:Arch Linux 上缺少的 C 库可在 Ubuntu 上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将工作中的 PC 从 Ubuntu 切换到 Arch Linux.我现在收到以下错误(我正在使用堆栈来构建我的项目):

I recently switched my PC at work from Ubuntu to Arch Linux. And I am now getting the following error (I am using stack to build my project):

setup-Simple-Cabal-1.22.4.0-ghc-7.10.2:缺少对a的依赖外国的图书馆:
* 缺少 C 库:HSrts-ghc7.10.2
这个问题通常可以通过安装系统包来解决提供此库(您可能需要-dev"版本).如果图书馆是已经安装但位于非标准位置,那么您可以使用标志--extra-include-dirs= 和 --extra-lib-dirs= 指定它的位置.

setup-Simple-Cabal-1.22.4.0-ghc-7.10.2: Missing dependency on a foreign library:
* Missing C library: HSrts-ghc7.10.2
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.

据我了解,Linux 发行版的不同应该不会造成任何问题.

As far as I understand it, the difference in Linux Distribution should not cause any issue.

我尝试过的事情:
- 添加库所在的路径 --extra-lib-dirs
- 确保堆栈/ghc 的版本在两个系统上都相同
- 未成功找到两个系统之间的相关差异
(gcc 版本不同但没有改变任何东西)

Things I have tried:
-add the path where the library is with --extra-lib-dirs
-make sure that the version of stack/ghc are the same acrose both systems
-tried unsucesfully to find a relevant difference between the 2 systems
(gcc version was different but didn't change anything)

我有一个基于 ubutu 的 docker 容器,它可以正常构建.

I have a docker container based on ubutu where it builds without an issue.

我唯一能想到的是这个库的处理方式与一些随机的 C 库不同,因为它包含 Haskell-Runtime.但我不知道这种差异是什么.或者不同的处理会如何导致我的 Arch 系统出现问题.

The only thing I can think of is that this library gets handled differently from some random C-library since it contains the Haskell-Runtime. But I have no idea what this difference would be. Or how a differnent handling would cause an issue on my Arch System.

这里是我的 .cabal 文件(该文件夹还包含整个项目):https://github.com/opencog/atomspace/blob/master/tests/haskell/libExecutionOutputTest/opencoglib.cabal

Here my .cabal file (the folder also contains the whole project): https://github.com/opencog/atomspace/blob/master/tests/haskell/libExecutionOutputTest/opencoglib.cabal

推荐答案

好吧,我想出了一个解决方法,而不是在 .cabal 文件中指定库:

Okay i figured out a workaround, instead of specifiyc the library in the .cabal file:

...  
extra-libraries: HSrts-ghc7.10.2   
...

您将其添加到您的 stack.yaml 文件中:

you add it to your stack.yaml file:

...
ghc-options:
    package-name: -lHSrts-ghc7.10.2
...

如果您的 .cabal 文件中还定义了一个可执行文件,这将破坏可执行文件,因为该库不仅包含在库中.并且在可执行文件中包含运行时库会导致即时分段错误.

If you also have a exectuable defined in your .cabal file this will break the executable, since the library is not only included in the library. And including the runtime library in an executable results in an instant segementation fault.

这篇关于Haskell:Arch Linux 上缺少的 C 库可在 Ubuntu 上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆