hubris无法安装:缺少C库:ruby,ruby,ruby

我正拼命地尝试安装Hubris但是每当我运行“cabal install”时安装都会失败。

链接到Hurbis:
https://github.com/mwotton/Hubris/tree/master/Haskell

链接到Cabal文件:
https://github.com/mwotton/Hubris/blob/master/Haskell/hubris.cabal

失败的cabal命令是:

cabal install --extra-include-dirs=/usr/include/ruby-1.9.1/x86_64-linux --extra-include-dirs=/usr/include/ruby-1.9.1 --extra-lib-dirs=/usr/lib --user --enable-shared --with-ghc=/usr/local/bin/ghc 

错误消息是:

 Resolving dependencies... Configuring hubris-0.0.4... cabal: Missing dependencies on foreign libraries: * Missing C libraries: ruby, ruby, ruby 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. cabal: Error: some packages failed to install: hubris-0.0.4 failed during the configure step. The exception was: ExitFailure 1 

RAKE ERROR是相同的:

 +install -c tmp/x86_64-linux/stub/1.9.3/stub.so lib/stub.so cabal: Missing dependencies on foreign libraries: * Missing C libraries: ruby, ruby, ruby 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. cabal: Error: some packages failed to install: hubris-0.0.4 failed during the configure step. The exception was: ExitFailure 1 rake aborted! ERROR: ran cabal update; cd Haskell; cabal install --extra-include- dirs=/usr/include/ruby-1.9.1/x86_64-linux --extra-include-dirs=/usr/include/ruby-1.9.1 - -extra-lib-dirs=/usr/lib --user --enable-shared --with-ghc=/usr/local/bin/ghc, got Downloading the latest package list from hackage.haskell.org 

我还安装了’ruby-dev’,例如

 apt-get install ruby1.9.1-dev 

当我运行cabal命令时,错误可能与缺少头文件和错误包含目录有关。

系统配置:

  ubuntu 12.04 GHC version 7.4.1 ruby version 1.9.3p0 gem version 1.8.24 

你应该使用rake安装Hubris。 只需在存储库的根目录中调用rake就可以了。 构建库的任务将为您找到相关的ruby包含目录。

我不得不做一些更改,使编译工作与现代Haskell(例如Haskell Platform 2012.2.0.0)。 可从https://github.com/dflemstr/Hubris获取更改。

它适用于Arch Linux:

 Arch ... well it's rolling release, so there is no version number GHC version 7.4.2 ruby version 1.9.3p194 (2012-04-20 revision 35410) gem version 1.8.23 

最终的答案! 一切正常!

正确答案的功劳归功于用户’dflemstr’。 但是看一下这个答案的一些细节,特别是对于Ubuntu用户。 由于Haskell / Cabal和Ubuntu的安装错误,Mark Wotton也认为。

_
要求:
(使用此设置测试,其他版本可能也有效)

  1. Ubuntu 12.04(Arch Linux也适用)
  2. Ruby 1.9.3p0
  3. GHC 7.4.1
  4. Haskell平台2012.2.0.0

_
Ruby安装

 sudo apt-get install libruby1.9.1 libruby1.9.1-dbg libtcltk-ruby1.9.1 ruby1.9.1 ruby1.9.1-dev ruby1.9.1-examples ruby1.9.1-full rubybook rubygems 

_
gem更新系统(可选)

 sudo env REALLY_GEM_UPDATE_SYSTEM=1 gem update --system 

_
修复Ubuntu
(错误的C库:ruby,ruby,ruby)

  cd /usr/lib ln -s libruby-1.9.1.so ./libruby.so 

_
GHC安装
注意:我没有为GHC和haskell平台使用任何ubuntu软件包。 stackoverflow上的一些人推荐这个。

http://www.haskell.org/ghc/download_ghc_7_4_1 (按照网站上的说明操作)

_
Haskel平台安装
http://lambda.haskell.org/platform/download/2012.2.0.0/haskell-platform-2012.2.0.0.tar.gz
(再次按照网站上的说明)

_
为haskell软件包启用共享库支持

添加以下行: “shared:True”

 nano ~/.cabal/config 

_
使用共享支持重新安装每个haskell软件包
按照以下说明给出:

  1. 构建一个haskell解释器(提示)作为动态库,可以从C ++中使用:Missing Interpreter.dyn_hi
  2. Cabal使用enable-shared标志重建所有内容

注意:以上说明对我不起作用!! 在这种情况下,请用力手动重新安装每个包(!):

 cabal install hint-0.3.3.4 --reinstall --force-reinstall 

对每个已安装的包重复! 例如,mtl包等。您可能会遇到重新安装所需的包的相同错误。 只需重新安装该包和任何递归依赖项。

如果您立即安装Hubris,即跳过此步骤,则会出现以下错误(仅限ubuntu,而不是arch linux):

 Language/Ruby/Hubris/LibraryBuilder.hs:13:8: Could not find module `Control.Monad.Error.Class' Perhaps you haven't installed the "dyn" libraries for package `mtl-2.0.1.0'? Use -v to see a list of the files searched for. cabal: Error: some packages failed to install: 

安装所需的haskell软件包

 cabal install c2hs 

安装所需的ruby包

 sudo gem install rake open4 rspec hoe sudo gem install bundler sudo gem install rake-compiler sudo gem install rspec 

通过github获取Hurbis

 git clone https://github.com/dflemstr/Hubris.git 

(注意:这只是暂时的。当合并更改时,应该拉出Mark Wotton的原始github版本!)

修复Rakefile以在ubuntu中找到GHC

“/ usr / bin / ghc”更改为“/ usr / local / bin / ghc”

 cd Hubris nano Rakefile 

跑耙

 cd Hubris rake 

如果您遇到“可能还没有安装’dyn’库”这样的错误,可能是因为某些软件包未重新安装(请参阅步骤:’重新安装每个haskell软件包并提供共享支持’)。

**安装Hubris *

 cd Hubris sudo rake install 

安装rake

修复权限:

 chmod -R 777 /var/hubris 

注意:不要使用777 !! 如果你这样做,请稍后更改为755或766等。这仅用于测试!

这是必需的,因为rake安装是使用’sudo’完成的,但cabal包是与不同的用户一起安装的。 Hubris编译/ var / hubris /中的haskell文件,除非您更改权限,否则普通用户无法访问该文件。

运行测试示例将以下行添加到“test.rb”:

 require 'hubris' # best line ever class Target hubris :inline =>"triple::Int->Int; triple n = 10*n" end t = Target.new puts t.triple(3) 

执行test.rb:

 ruby test.rb 

检查结果是否正常:

控制台输出的最后三行应该是:

 ... many lines and possibly GHC error messages ... | error || 30 

如果最后一行是“30”那么一切正常!! 请注意,当您第二次运行命令时,不会重新编译内联haskell,因此输出要短得多,但最后一行仍为“30”。

最后的话要感谢Mark Wotton提供的Hubris! 这是向库中添加新function的绝佳起点。 太棒了,它是开源的!