1

Tried to install puma with the following command

sudo gem install puma -v '3.11.0'

Got the below message:

Building native extensions.  This could take a while...
ERROR:  Error installing puma:
    ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/puma-3.11.0/ext/puma_http11
/usr/bin/ruby2.3 -r ./siteconf20180412-95606-8c9cui.rb extconf.rb
checking for BIO_read() in -lcrypto... *** 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=/usr/bin/$(RUBY_BASE_NAME)2.3
    --with-puma_http11-dir
    --without-puma_http11-dir
    --with-puma_http11-include
    --without-puma_http11-include=${puma_http11-dir}/include
    --with-puma_http11-lib
    --without-puma_http11-lib=${puma_http11-dir}/lib
    --with-openssl-dir
    --without-openssl-dir
    --with-openssl-include
    --without-openssl-include=${openssl-dir}/include
    --with-openssl-lib
    --without-openssl-lib=${openssl-dir}/lib
    --with-cryptolib
    --without-cryptolib
/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/lib/ruby/2.3.0/mkmf.rb:541:in `try_link0'
    from /usr/lib/ruby/2.3.0/mkmf.rb:556:in `try_link'
    from /usr/lib/ruby/2.3.0/mkmf.rb:765:in `try_func'
    from /usr/lib/ruby/2.3.0/mkmf.rb:997:in `block in have_library'
    from /usr/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
    from /usr/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
    from /usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from /usr/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
    from /usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from /usr/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
    from /usr/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
    from /usr/lib/ruby/2.3.0/mkmf.rb:992:in `have_library'
    from extconf.rb:8:in `block in <main>'
    from extconf.rb:8:in `each'
    from extconf.rb:8:in `find'
    from extconf.rb:8:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/puma-3.11.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/puma-3.11.0 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/puma-3.11.0/gem_make.out

The mkmf.log looks like this:

"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2   -g -O2 -fdebug-prefix-map=/build/ruby2.3-E8maFs/ruby2.3-2.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c  -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic     -lruby-2.3  -lpthread -lgmp -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

Update 1: Run command dpkg -S libcrypt*:

libc6-dev:amd64: /usr/lib/x86_64-linux-gnu/libcrypt.a
libcryptsetup4:amd64: /usr/share/doc/libcryptsetup4
libssl-dev:amd64: /usr/lib/x86_64-linux-gnu/libcrypto.so
libssl-dev:amd64: /usr/lib/x86_64-linux-gnu/libcrypto.a
libcryptsetup4:amd64: /lib/x86_64-linux-gnu/libcryptsetup.so.4.7.0
libcryptsetup4:amd64: /usr/share/doc/libcryptsetup4/copyright
libc6:amd64: /lib/x86_64-linux-gnu/libcrypt-2.26.so
libc6-dev:amd64: /usr/lib/x86_64-linux-gnu/libcrypt.so
libcryptsetup4:amd64: /usr/share/doc/libcryptsetup4/changelog.Debian.gz
libssl-dev:amd64: /usr/lib/x86_64-linux-gnu/pkgconfig/libcrypto.pc
libc6:amd64: /lib/x86_64-linux-gnu/libcrypt.so.1
libcryptsetup4:amd64: /usr/share/doc/libcryptsetup4/NEWS.Debian.gz
libcryptsetup4:amd64: /lib/x86_64-linux-gnu/libcryptsetup.so.4
libssl1.0.0:amd64: /lib/x86_64-linux-gnu/libcrypto.so.1.0.0

Update 2: Result of ls -l /usr/lib/x86_64-linux-gnu/libcrypt*:

-rw-r--r-- 1 root root   60288 1月  12 20:42 /usr/lib/x86_64-linux-gnu/libcrypt.a
lrwxrwxrwx 1 root root      35 1月  12 20:42 /usr/lib/x86_64-linux-gnu/libcrypt.so -> /lib/x86_64-linux-gnu/libcrypt.so.1
-rw-r--r-- 1 root root 4706666 3月  27 18:17 /usr/lib/x86_64-linux-gnu/libcrypto.a
lrwxrwxrwx 1 root root      40 3月  27 18:17 /usr/lib/x86_64-linux-gnu/libcrypto.so -> /lib/x86_64-linux-gnu/libcrypto.so.1.0.0

What is going on?

Note: I have installed libssl-dev, libssl1.0-dev and libgmp3-dev. None of them fixed the problem.

Koala Yeung
  • 183
  • 1
  • 8

1 Answers1

0

Try to create conft.c file with content:

#include <stdio.h>

int main(int argc, char **argv)
{
  return 0;
}

and next in the same directory when you will have this file, run this command:

gcc -o conft -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2  -fstack-protector-strong -Wformat -Werror=format-security -fPIC conft.c  -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic  -lpthread -lgmp -ldl -lcrypt -lm   -lc

Put here the result. If you got only "conft" binary file the compilation finish with success and we need to look inside "ruby.h" file.

mariaczi
  • 236
  • 1
  • 5