Haskell: Missing C library on Arch Linux works on Ubuntu

扶醉桌前 提交于 2019-12-21 19:28:40

问题


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: 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.

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

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)

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

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.

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


回答1:


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

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

you add it to your stack.yaml file:

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

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.



来源:https://stackoverflow.com/questions/34267376/haskell-missing-c-library-on-arch-linux-works-on-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!