Add libgmp-dev as an Ubuntu requirement #3509

Closed
digitalfrost opened this Issue Sep 12, 2015 · 18 comments

Projects

None yet
@digitalfrost

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

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

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

But I can reproduce on ruby-2.2.3

@bippukt
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 flavorjones referenced this issue in sparklemotion/nokogiri Sep 18, 2015
Closed

Problem with ruby 2.1.2 and nokogiri 1.6.2.1  #1184

@flavorjones

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

Bump.

@flavorjones flavorjones referenced this issue in sparklemotion/nokogiri.org-tutorials Oct 9, 2015
Closed

Add libgmp-dev dependency for Ubuntu 14.04.3 #39

@copiousfreetime
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
Contributor

@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

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

@kofronpi kofronpi referenced this issue in alexfedoseev/generator-flux-on-rails Nov 30, 2015
Closed

Creation of rails-api fails #4

@masonjm
masonjm commented Jan 13, 2016

Having the same issue with 2.2.4.

@zxiest
zxiest commented Jan 13, 2016

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

@flavorjones

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 flavorjones referenced this issue in travis-ci/travis-rubies Jan 13, 2016
Open

Some ruby binaries are dependent on `libgmp` #15

@flavorjones

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

@jamsi
jamsi commented Mar 2, 2016

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

@raelgc
Contributor
raelgc commented Mar 2, 2016

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

@flavorjones

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
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 Apr 3, 2016
@larskanis larskanis added a commit to larskanis/ffi that referenced this issue Apr 9, 2016
@larskanis larskanis Travis-CI: update ruby versions and fix builds
Install libgmp-dev as a workaround for the missing dependency of rvm.
See also: rvm/rvm#3509
d5b204a
@larskanis larskanis added a commit to larskanis/ffi that referenced this issue Apr 9, 2016
@larskanis larskanis Travis-CI: update ruby versions and fix builds
Install libgmp-dev as a workaround for the missing dependency of rvm.
See also: rvm/rvm#3509
a876081
@larskanis larskanis added a commit to larskanis/ffi that referenced this issue Apr 9, 2016
@larskanis larskanis Travis-CI: update ruby versions and fix builds
Install libgmp-dev as a workaround for the missing dependency of rvm.
See also: rvm/rvm#3509
a1c306d
@pkuczynski pkuczynski modified the milestone: rvm-1.28.0 Nov 8, 2016
@pkuczynski pkuczynski changed the title from Ubuntu: RVM installs a binary ruby, which is linked to libgmp, but doesn't install the libgmp-dev package to Add libgmp-dev as an Ubuntu requirement Nov 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment