Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hubris fails to install with: Missing C libraries: ruby, ruby, ruby

Tags:

ruby

haskell

I am desperately trying to install Hubris but the installation fails whenever I run "cabal install".

Link to Hurbis:
https://github.com/mwotton/Hubris/tree/master/Haskell

Link to the Cabal file:
https://github.com/mwotton/Hubris/blob/master/Haskell/hubris.cabal

The cabal command that fails is:

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

The error message is:

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

THE RAKE ERROR IS THE SAME:

+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

I also installed 'ruby-dev', e.g.

apt-get install ruby1.9.1-dev

Probably the error is related to missing header files and wrong include directories when I run the cabal command.

.

System Configuration:

 ubuntu 12.04
 GHC version 7.4.1
 ruby version 1.9.3p0
 gem version 1.8.24
like image 493
mrsteve Avatar asked Jan 25 '26 01:01

mrsteve


2 Answers

You should install Hubris using rake. Simply invoking rake in the root of the repository should work. The task that builds the library will find the relevant ruby include directories for you.

I had to make some changes to make the compile work with modern Haskell (E.g. Haskell Platform 2012.2.0.0). The changes are available at https://github.com/dflemstr/Hubris.

It works for me on 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
like image 89
dflemstr Avatar answered Jan 28 '26 00:01

dflemstr


FINAL ANSWER!!! EVERYTHING WORKS!!!

The credit for the right answer goes to User 'dflemstr'. BUT look at this answer for some details, especially for Ubuntu Users. Credit also goes to Mark Wotton, as the install errors where mainly due to Haskell/Cabal and Ubuntu.

_
Requirements:
(tested with this setup, other version probably work too)

  1. Ubuntu 12.04 (Arch Linux works too)
  2. Ruby 1.9.3p0
  3. GHC 7.4.1
  4. Haskell Platform 2012.2.0.0

_
Ruby Installation

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 Update System (optional)

sudo env REALLY_GEM_UPDATE_SYSTEM=1 gem update --system

_
Fix for Ubuntu
(error Missing C libraries: ruby, ruby, ruby)

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

_
GHC Installation
NOTE: I don't use any ubuntu packages for GHC and the haskell platform. Some people on stackoverflow recommend this.

http://www.haskell.org/ghc/download_ghc_7_4_1 (follow the instructions on the website)

_
Haskel Platform Installation
http://lambda.haskell.org/platform/download/2012.2.0.0/haskell-platform-2012.2.0.0.tar.gz
(again follow the instructions on the website)
.

_
Enable shared library support for haskell packages

Add the following line: "shared: True"

nano ~/.cabal/config

_
Reinstall every haskell package with shared support
Follow the instructions given in:

  1. Building a haskell interpreter (hint) as dynamic library, useable from C++: Missing Interpreter.dyn_hi
  2. Cabal rebuild all with enable-shared flag

NOTE: The above instructions did not work for me!! In that case, manually reinstall every package by hand (!) with force:

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

Repeat with every installed package! e.g. also the mtl package, etc. You may get the same error with a package that is needed for the reinstallation. Just reinstall that package and any recursive dependencies.

If you install Hubris right away, i.e. skipping this step, you get the following error (only in ubuntu, not 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:

Install needed haskell packages

cabal install c2hs

Install needed ruby packages

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

Get Hurbis via github

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

(Note: This is just for now. As the changes are merged, the original github version from Mark Wotton should be pulled!)

Fix Rakefile to find GHC in ubuntu

Change "/usr/bin/ghc" to "/usr/local/bin/ghc":

cd Hubris
nano Rakefile

Run rake

cd Hubris
rake

If you get errors like "Perhaps you haven't installed the 'dyn' libraries for" here it is possibly due that some package are not reinstalled (see step: 'Reinstall every haskell package with shared support').

**Install Hubris*

cd Hubris
sudo rake install

Install rake

Fix permissions:

chmod -R 777 /var/hubris

NOTE: Don't use 777!! If you do, change later to 755 or 766, etc. This is just for testing!

This is needed because rake install is done with 'sudo' but the cabal packages are installed with a different user. Hubris compiles the haskell files in /var/hubris/ which is not accessible for a regular user unless you change the permissions.

Run test example Add the following lines to "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)

Execute test.rb:

ruby test.rb

Check if the result is okay:

The last three lines of the console output should be:

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

If the last line is "30" then everything works!! Note that when you run the command a second time the inline haskell is not recompiled, therefore the output is much shorter, but the last line is still "30".

Final Words Thanks to Mark Wotton for providing Hubris!! It is an excellent starting point to add new features to the library. Great that it is open source!

like image 45
mrsteve Avatar answered Jan 27 '26 22:01

mrsteve



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!