Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add libgmp-dev as an Ubuntu requirement #3509

Closed
digitalfrost opened this issue Sep 12, 2015 · 19 comments
Closed

Add libgmp-dev as an Ubuntu requirement #3509

digitalfrost opened this issue Sep 12, 2015 · 19 comments

Comments

@digitalfrost
Copy link

RVM installs a binary ruby, which is linked to libgmp, but doesn't install the libgmp-dev package. Ruby runs fine this way, but extensions will not compile.

rake-compiler-dock via @larskanis

lars@d14816859b44:/home/lars/comcard/nokogiri$ rvm install 2.2.3 
Searching for binary rubies, this might take some time. 
Found remote file https://rubies.travis-ci.org/ubuntu/14.04/x86_64/ruby-2.2.3.tar.bz2 
Checking requirements for ubuntu. 
Requirements installation successful. 
ruby-2.2.3 - #configure 
ruby-2.2.3 - #download 
 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current 
                                Dload  Upload   Total   Spent    Left  Speed 
 0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0 
100 22.9M  100 22.9M    0     0   864k      0  0:00:27  0:00:27 --:--:-- 1232k 
No checksum for downloaded archive, recording checksum in user configuration. 
ruby-2.2.3 - #validate archive 
ruby-2.2.3 - #extract 
ruby-2.2.3 - #validate binary 
ruby-2.2.3 - #setup 
ruby-2.2.3 - #gemset created /usr/local/rvm/gems/ruby-2.2.3@global 
ruby-2.2.3 - #importing gemset /usr/local/rvm/gemsets/global.gems................................... 
ruby-2.2.3 - #generating global wrappers........ 
ruby-2.2.3 - #gemset created /usr/local/rvm/gems/ruby-2.2.3 
ruby-2.2.3 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list 
ruby-2.2.3 - #generating default wrappers........ 
lars@d14816859b44:/home/lars/comcard/nokogiri$  
lars@d14816859b44:/home/lars/comcard/nokogiri$  
lars@d14816859b44:/home/lars/comcard/nokogiri$ ldd /usr/local/rvm/rubies/ruby-2.2.3/lib/libruby.so 
       linux-vdso.so.1 =>  (0x00007ffd3c640000) 
       libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc87bfde000) 
       libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007fc87bd6a000) 
       libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fc87bb66000) 
       libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007fc87b92d000) 
       libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fc87b627000) 
       libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc87b262000) 
       /lib64/ld-linux-x86-64.so.2 (0x00007fc87c6dc000)

As a result it is not possible to install gems like nokogiri or atomic (which is necessary for rails).
Installs of these gems fail with this error:

gem_make.out:

/home/gerald/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20150905-15835-17vnavf.rb extconf.rb
checking if the C compiler accepts ... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/gerald/.rvm/rubies/ruby-2.2.3/bin/$(RUBY_BASE_NAME)
    --help
    --clean
/home/gerald/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /home/gerald/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
    from /home/gerald/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
    from /home/gerald/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile'
    from extconf.rb:80:in `nokogiri_try_compile'
    from extconf.rb:87:in `block in add_cflags'
    from /home/gerald/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
    from extconf.rb:86:in `add_cflags'
    from extconf.rb:337:in `<main>'

extconf failed, exit code 1

mkmf.log:

"gcc -o conftest -I/home/gerald/.rvm/rubies/ruby-2.2.3/include/ruby-2.2.0/x86_64-linux -I/home/gerald/.rvm/rubies/ruby-2.2.3/include/ruby-2.2.0/ruby/backward -I/home/gerald/.rvm/rubies/ruby-2.2.3/include/ruby-2.2.0 -I.     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat  -fPIC  conftest.c  -L. -L/home/gerald/.rvm/rubies/ruby-2.2.3/lib -Wl,-R/home/gerald/.rvm/rubies/ruby-2.2.3/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,'/../lib' -Wl,-R'/../lib' -lruby  -lpthread -lgmp -ldl -lcrypt -lm   -lc "
/usr/bin/ld: cannot find -lgmp
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

System infomation

gerald@gerald-VirtualBox:~/code/rails-i18n$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.3 LTS
Release:    14.04
Codename:   trusty
gerald@gerald-VirtualBox:~/code/rails-i18n$ ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]

@fgperianez
Copy link

This happens for me only with ruby-2.2.3
Have you tried with version 2.2.2 @digitalfrost ?

If it is the same for you, maybe you could edit the post so that rvm guys have an easier work.

@digitalfrost
Copy link
Author

Ok - I just did a test on a brand new VM (Ubuntu 14.04.3 LTS) . This is not an issue with ruby-2.2.2 .

@digitalfrost
Copy link
Author

But I can reproduce on ruby-2.2.3

@bippukt
Copy link

bippukt commented Sep 18, 2015

I can confirm that I had this issue on Ruby-2.2.3. I wasted hours trying out solutions on Stack Overflow and other sites, but finally found the solution here:

https://groups.google.com/forum/#!topic/nokogiri-talk/cMUdmGRVYos

Thanks Lars Kanis for the solution. I had to do the following:

sudo apt-get install libgmp-dev

Sorry, this is my first post here, so I am not good at formatting.

@flavorjones
Copy link

This is an issue with the binary hosted at https://rubies.travis-ci.org/ubuntu/14.04/x86_64/ruby-2.2.3.tar.bz2

To wit:

$ wget https://rubies.travis-ci.org/ubuntu/14.04/x86_64/ruby-2.2.2.tar.bz2
...
2015-09-18 17:13:07 (737 KB/s) - ‘ruby-2.2.2.tar.bz2’ saved [24426305/24426305]

$ wget https://rubies.travis-ci.org/ubuntu/14.04/x86_64/ruby-2.2.3.tar.bz2
...
2015-09-18 17:15:29 (1.46 MB/s) - ‘ruby-2.2.3.tar.bz2’ saved [24039970/24039970]

$ tar -jxf ruby-2.2.2.tar.bz2

$ tar -jxf ruby-2.2.3.tar.bz2

$ ldd ruby-2.2.2/bin/ruby
    linux-vdso.so.1 =>  (0x00007fff42f24000)
    libruby.so.2.2 => /home/flavorjones/tmp/ruby-2.2.2/bin/../lib/libruby.so.2.2 (0x00007f7169a0c000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7169623000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7169404000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7169200000)
    libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f7168fc7000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7168cc0000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f7169eeb000)

$ ldd ruby-2.2.3/bin/ruby
    linux-vdso.so.1 =>  (0x00007fffc95fe000)
    libruby.so.2.2 => /home/flavorjones/tmp/ruby-2.2.3/bin/../lib/libruby.so.2.2 (0x00007f3700161000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f36ffd78000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f36ffb59000)
    libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f36ff8e5000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f36ff6e1000)
    libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f36ff4a7000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f36ff1a1000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f3700643000)

$ ruby-2.2.2/bin/ruby -e 'puts RbConfig::CONFIG["LIBS"]'
-lpthread -ldl -lcrypt -lm 

$ ruby-2.2.3/bin/ruby -e 'puts RbConfig::CONFIG["LIBS"]'
-lpthread -lgmp -ldl -lcrypt -lm 

This is evidence that the 2.2.3 binary is linking against libgmp, where that hadn't been done in the past.

Who built this binary? Is it under the rvm team's control? It's causing problems with the installation of C extensions, as indicated by these threads:

@sylphiae
Copy link

sylphiae commented Oct 1, 2015

I had this issue as well for ruby 2.2.3 and installing this library definitely fixed the issue. Can this be documented on the installation page?

@flavorjones
Copy link

Bump.

@copiousfreetime
Copy link
Contributor

This issue is also causing problems with my gem hitimes. I have had multiple folks report hitimes as unable to install and this is the culprit. Has anyone contacted @travis-ci about this? It sounds to be that there needs to be some additional coordination between RVM and @travis-ci if one is going to provide the ruby installation, and the other is going to use it.

@havenwood
Copy link
Member

@copiousfreetime I've stopped by and mentioned it in the #travis irc channel but I don't know of any formal liaison to inform.

@flavorjones
Copy link

The alternative is to remove the Travis URLs from RVM's config.
On Nov 19, 2015 9:29 AM, "Shannon Skipper" notifications@github.com wrote:

@copiousfreetime https://github.com/copiousfreetime I've stopped by and
mentioned it in the #travis irc channel but I don't know of any formal
liaison to inform.


Reply to this email directly or view it on GitHub
#3509 (comment).

@masonjm
Copy link

masonjm commented Jan 13, 2016

Having the same issue with 2.2.4.

@zxiest
Copy link

zxiest commented Jan 13, 2016

Installing libgmp-dev is the only thing that let me proceed with 2.2.3. Thanks!

@flavorjones
Copy link

For anyone that finds this thread, please know there's a workaround, which is to install your ruby with --disable-binary which will then build your ruby without the libgmp dependency.

@flavorjones
Copy link

Please note that I've raised a new issue at travis-ci/travis-rubies#15 which appears to be a related repo.

@jamsi
Copy link

jamsi commented Mar 2, 2016

Confirming "apt-get install libgmp-dev" allowed me to install msgpack on 2.2.4.

@raelgc
Copy link
Contributor

raelgc commented Mar 2, 2016

@mpapis Should I add libgmp-dev as a dependency in the Ubuntu package?

@flavorjones
Copy link

I'd prefer if Travis binaries either were no longer installed by RVM or
were built without libgmp.

Adding libgmp as a dependency for RVM seems like a defensive decision, but
maybe that's OK given the lack of attention to this issue.
On Mar 2, 2016 4:50 AM, "Rael Gugelmin Cunha" notifications@github.com
wrote:

@mpapis https://github.com/mpapis Should I add libgmp-dev as a
dependency in the Ubuntu package https://github.com/rvm/ubuntu_rvm?


Reply to this email directly or view it on GitHub
#3509 (comment).

@mpapis
Copy link
Member

mpapis commented Apr 3, 2016

@raelgc I think it was added already in #3564

@flavorjones RVM2 will have more advanced installation method that will be able to detect dependencies at runtime and install them ... at least this is the plan, till then we have the extra dependency in RVM1.

@mpapis mpapis closed this as completed Apr 3, 2016
larskanis added a commit to larskanis/ffi that referenced this issue Apr 9, 2016
Install libgmp-dev as a workaround for the missing dependency of rvm.
See also: rvm/rvm#3509
larskanis added a commit to larskanis/ffi that referenced this issue Apr 9, 2016
Install libgmp-dev as a workaround for the missing dependency of rvm.
See also: rvm/rvm#3509
larskanis added a commit to larskanis/ffi that referenced this issue Apr 9, 2016
Install libgmp-dev as a workaround for the missing dependency of rvm.
See also: rvm/rvm#3509
@pkuczynski pkuczynski added this to the rvm-1.28.0 milestone Nov 8, 2016
@husiiinhpo336
Copy link

gem install nokogiri

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

15 participants