我拼命地想安装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 1RAKE错误是相同的:
+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发布于 2012-07-16 00:33:37
你应该使用rake来安装Hubris。只需在存储库的根目录中调用rake就可以了。构建库的任务将为您找到相关的ruby包含目录。
我不得不做一些修改,以使编译与现代Haskell一起工作(例如,Haskell平台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发布于 2012-07-16 22:13:32
最终答案!一切正常!
正确答案的功劳属于用户'dflemstr‘。但看看这个答案可以了解一些细节,特别是对于Ubuntu用户。这也归功于Mark Wotton,因为安装错误主要是由于Haskell/Cabal和Ubuntu造成的。
_
要求:
(使用此设置进行了测试,其他版本可能也适用)
_
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 _
宝石更新系统(可选)
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 Installation
注意:我没有在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包
请按照中的说明进行操作:
注意:上面的说明对我不起作用!在这种情况下,请手动重新安装每个软件包(!)有了力:
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运行rake
cd Hubris
rake如果你收到类似“也许你还没有安装'dyn‘库”这样的错误,这可能是因为某些软件包没有被重新安装(请参阅步骤:’重新安装每个haskell包和共享支持‘)。
**安装Hubris*
cd Hubris
sudo rake install安装rake
修复权限:
chmod -R 777 /var/hubris注意:不要使用777!!如果您这样做了,稍后更改为755或766,等等。这只是为了测试!
这是必需的,因为rake安装是用'sudo‘完成的,而cabal包是用不同的用户安装的。Hubris将haskell文件编译到/var/hubris/中,除非您更改权限,否则普通用户无法访问该文件。
运行测试示例将以下行添加到“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“。
Final Words感谢马克·沃顿提供的傲慢!!将新特性添加到库中是一个很好的起点。太棒了,它是开源的!
https://stackoverflow.com/questions/11493620
复制相似问题