Puma: Failed to build on debian stretch

Created on 26 Jan 2017  Â·  5Comments  Â·  Source: puma/puma

Steps to reproduce

$ gem install puma -v '3.6.2'

Expected behavior

gem should be installed successful

Actual behavior

installation failing with output:

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

    current directory: /home/senid/.rvm/gems/ruby-2.3.1@comic_viewer/gems/puma-3.6.2/ext/puma_http11
/home/senid/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20170126-1463-l8g2j9.rb extconf.rb
checking for BIO_read() in -lcrypto... yes
checking for SSL_CTX_new() in -lssl... yes
checking for openssl/bio.h... yes
creating Makefile

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

  /home/senid/.rvm/gems/ruby-2.3.1@comic_viewer/extensions/x86_64-linux/2.3.0/puma-3.6.2/mkmf.log

current directory: /home/senid/.rvm/gems/ruby-2.3.1@comic_viewer/gems/puma-3.6.2/ext/puma_http11
make "DESTDIR=" clean

current directory: /home/senid/.rvm/gems/ruby-2.3.1@comic_viewer/gems/puma-3.6.2/ext/puma_http11
make "DESTDIR="
compiling mini_ssl.c
mini_ssl.c: In function ‘get_dh1024’:
mini_ssl.c:90:5: error: dereferencing pointer to incomplete type ‘DH {aka struct dh_st}’
   dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
     ^~
mini_ssl.c: In function ‘engine_init_server’:
mini_ssl.c:139:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   ID sym_cert = rb_intern("cert");
   ^~
mini_ssl.c:144:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   ID sym_ca = rb_intern("ca");
   ^~
mini_ssl.c:166:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   DH *dh = get_dh1024();
   ^~
mini_ssl.c:170:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   EC_KEY *ecdh = EC_KEY_new_by_curve_name(NID_secp521r1);
   ^~~~~~
mini_ssl.c: In function ‘engine_init_client’:
mini_ssl.c:197:3: warning: ‘DTLSv1_method’ is deprecated [-Wdeprecated-declarations]
   conn->ctx = SSL_CTX_new(DTLSv1_method());
   ^~~~
In file included from /usr/include/openssl/ct.h:13:0,
                 from /usr/include/openssl/ssl.h:61,
                 from mini_ssl.c:15:
/usr/include/openssl/ssl.h:1614:1: note: declared here
 DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */
 ^
mini_ssl.c: In function ‘engine_shutdown’:
mini_ssl.c:333:8: warning: unused variable ‘buf’ [-Wunused-variable]
   char buf[512];
        ^~~
mini_ssl.c:332:11: warning: unused variable ‘err’ [-Wunused-variable]
   int ok, err;
           ^~~
mini_ssl.c: In function ‘engine_init’:
mini_ssl.c:350:8: warning: unused variable ‘buf’ [-Wunused-variable]
   char buf[512];
        ^~~
mini_ssl.c:349:11: warning: unused variable ‘err’ [-Wunused-variable]
   int ok, err;
           ^~~
mini_ssl.c:349:7: warning: unused variable ‘ok’ [-Wunused-variable]
   int ok, err;
       ^~
Makefile:238: recipe for target 'mini_ssl.o' failed
make: *** [mini_ssl.o] Error 1

make failed, exit code 2

mkmf.log

have_library: checking for BIO_read() in -lcrypto... -------------------- yes

"gcc -o conftest -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/x86_64-linux -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.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 -Wno-maybe-uninitialized  -fPIC conftest.c  -L. -L/home/senid/.rvm/rubies/ruby-2.3.1/lib -Wl,-R/home/senid/.rvm/rubies/ruby-2.3.1/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R/home/senid/.rvm/rubies/ruby-2.3.1/lib -L/home/senid/.rvm/rubies/ruby-2.3.1/lib -lruby  -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 */

"gcc -o conftest -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/x86_64-linux -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.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 -Wno-maybe-uninitialized  -fPIC conftest.c  -L. -L/home/senid/.rvm/rubies/ruby-2.3.1/lib -Wl,-R/home/senid/.rvm/rubies/ruby-2.3.1/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R/home/senid/.rvm/rubies/ruby-2.3.1/lib -L/home/senid/.rvm/rubies/ruby-2.3.1/lib -lruby -lcrypto  -lpthread -lgmp -ldl -lcrypt -lm   -lc"
conftest.c: In function ‘t’:
conftest.c:13:57: error: ‘BIO_read’ undeclared (first use in this function)
 int t(void) { void ((*volatile p)()); p = (void ((*)()))BIO_read; return !p; }
                                                         ^~~~~~~~
conftest.c:13:57: note: each undeclared identifier is reported only once for each function it appears in
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10: 
11:   return 0;
12: }
13: int t(void) { void ((*volatile p)()); p = (void ((*)()))BIO_read; return !p; }
/* end */

"gcc -o conftest -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/x86_64-linux -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.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 -Wno-maybe-uninitialized  -fPIC conftest.c  -L. -L/home/senid/.rvm/rubies/ruby-2.3.1/lib -Wl,-R/home/senid/.rvm/rubies/ruby-2.3.1/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R/home/senid/.rvm/rubies/ruby-2.3.1/lib -L/home/senid/.rvm/rubies/ruby-2.3.1/lib -lruby -lcrypto  -lpthread -lgmp -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10: 
11:   return 0;
12: }
13: extern void BIO_read();
14: int t(void) { BIO_read(); return 0; }
/* end */

--------------------

have_library: checking for SSL_CTX_new() in -lssl... -------------------- yes

"gcc -o conftest -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/x86_64-linux -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.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 -Wno-maybe-uninitialized  -fPIC conftest.c  -L. -L/home/senid/.rvm/rubies/ruby-2.3.1/lib -Wl,-R/home/senid/.rvm/rubies/ruby-2.3.1/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic    -lcrypto  -Wl,-R/home/senid/.rvm/rubies/ruby-2.3.1/lib -L/home/senid/.rvm/rubies/ruby-2.3.1/lib -lruby -lssl -lcrypto  -lpthread -lgmp -ldl -lcrypt -lm   -lc"
conftest.c: In function ‘t’:
conftest.c:13:57: error: ‘SSL_CTX_new’ undeclared (first use in this function)
 int t(void) { void ((*volatile p)()); p = (void ((*)()))SSL_CTX_new; return !p; }
                                                         ^~~~~~~~~~~
conftest.c:13:57: note: each undeclared identifier is reported only once for each function it appears in
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10: 
11:   return 0;
12: }
13: int t(void) { void ((*volatile p)()); p = (void ((*)()))SSL_CTX_new; return !p; }
/* end */

"gcc -o conftest -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/x86_64-linux -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.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 -Wno-maybe-uninitialized  -fPIC conftest.c  -L. -L/home/senid/.rvm/rubies/ruby-2.3.1/lib -Wl,-R/home/senid/.rvm/rubies/ruby-2.3.1/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic    -lcrypto  -Wl,-R/home/senid/.rvm/rubies/ruby-2.3.1/lib -L/home/senid/.rvm/rubies/ruby-2.3.1/lib -lruby -lssl -lcrypto  -lpthread -lgmp -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10: 
11:   return 0;
12: }
13: extern void SSL_CTX_new();
14: int t(void) { SSL_CTX_new(); return 0; }
/* end */

--------------------

have_header: checking for openssl/bio.h... -------------------- yes

"gcc -E -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/x86_64-linux -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward -I/home/senid/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.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 -Wno-maybe-uninitialized  -fPIC  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <openssl/bio.h>
/* end */

--------------------

gem_make.out

bash: /home/senid/.rvm/gems/ruby-2.3.1@comic_viewer/extensions/x86_64-linux/2.3.0/puma-3.6.2/gem_make.out: Permission denied
senid@senid-dell:comic_viewer$ cat /home/senid/.rvm/gems/ruby-2.3.1@comic_viewer/extensions/x86_64-linux/2.3.0/puma-3.6.2/gem_make.out
current directory: /home/senid/.rvm/gems/ruby-2.3.1@comic_viewer/gems/puma-3.6.2/ext/puma_http11
/home/senid/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20170126-1463-l8g2j9.rb extconf.rb
checking for BIO_read() in -lcrypto... yes
checking for SSL_CTX_new() in -lssl... yes
checking for openssl/bio.h... yes
creating Makefile

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

  /home/senid/.rvm/gems/ruby-2.3.1@comic_viewer/extensions/x86_64-linux/2.3.0/puma-3.6.2/mkmf.log

current directory: /home/senid/.rvm/gems/ruby-2.3.1@comic_viewer/gems/puma-3.6.2/ext/puma_http11
make "DESTDIR=" clean

current directory: /home/senid/.rvm/gems/ruby-2.3.1@comic_viewer/gems/puma-3.6.2/ext/puma_http11
make "DESTDIR="
compiling mini_ssl.c
mini_ssl.c: In function ‘get_dh1024’:
mini_ssl.c:90:5: error: dereferencing pointer to incomplete type ‘DH {aka struct dh_st}’
   dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
     ^~
mini_ssl.c: In function ‘engine_init_server’:
mini_ssl.c:139:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   ID sym_cert = rb_intern("cert");
   ^~
mini_ssl.c:144:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   ID sym_ca = rb_intern("ca");
   ^~
mini_ssl.c:166:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   DH *dh = get_dh1024();
   ^~
mini_ssl.c:170:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   EC_KEY *ecdh = EC_KEY_new_by_curve_name(NID_secp521r1);
   ^~~~~~
mini_ssl.c: In function ‘engine_init_client’:
mini_ssl.c:197:3: warning: ‘DTLSv1_method’ is deprecated [-Wdeprecated-declarations]
   conn->ctx = SSL_CTX_new(DTLSv1_method());
   ^~~~
In file included from /usr/include/openssl/ct.h:13:0,
                 from /usr/include/openssl/ssl.h:61,
                 from mini_ssl.c:15:
/usr/include/openssl/ssl.h:1614:1: note: declared here
 DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */
 ^
mini_ssl.c: In function ‘engine_shutdown’:
mini_ssl.c:333:8: warning: unused variable ‘buf’ [-Wunused-variable]
   char buf[512];
        ^~~
mini_ssl.c:332:11: warning: unused variable ‘err’ [-Wunused-variable]
   int ok, err;
           ^~~
mini_ssl.c: In function ‘engine_init’:
mini_ssl.c:350:8: warning: unused variable ‘buf’ [-Wunused-variable]
   char buf[512];
        ^~~
mini_ssl.c:349:11: warning: unused variable ‘err’ [-Wunused-variable]
   int ok, err;
           ^~~
mini_ssl.c:349:7: warning: unused variable ‘ok’ [-Wunused-variable]
   int ok, err;
       ^~
Makefile:238: recipe for target 'mini_ssl.o' failed
make: *** [mini_ssl.o] Error 1

make failed, exit code 2
````

### System configuration
```bash
$ uname -a
Linux senid-dell 4.8.0-2-amd64 #1 SMP Debian 4.8.11-1 (2016-12-02) x86_64 GNU/Linux
$ ruby -v -ropenssl -e "puts OpenSSL::OPENSSL_VERSION"
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
OpenSSL 1.0.2h  3 May 2016
$ dpkg -l | grep ssl
ii  libcurl4-openssl-dev:amd64                    7.51.0-1                            amd64        development files and documentation for libcurl (OpenSSL flavour)
ii  libflac8:amd64                                1.3.1-4                             amd64        Free Lossless Audio Codec - runtime C library
ii  libflac8:i386                                 1.3.1-4                             i386         Free Lossless Audio Codec - runtime C library
ii  libio-socket-ssl-perl                         2.040-1                             all          Perl module implementing object oriented interface to SSL sockets
ii  libnet-smtp-ssl-perl                          1.04-1                              all          Perl module providing SSL support to Net::SMTP
ii  libnet-ssleay-perl                            1.78-1+b1                           amd64        Perl module for Secure Sockets Layer (SSL)
ii  libqca2-plugin-ossl:amd64                     2.1.1-4                             amd64        transitional package for libqca2-plugins
ii  libssl-dev:amd64                              1.1.0c-2                            amd64        Secure Sockets Layer toolkit - development files
ii  libssl-doc                                    1.1.0c-2                            all          Secure Sockets Layer toolkit - development documentation
ii  libssl1.0.0:amd64                             1.0.1t-1+deb8u2                     amd64        Secure Sockets Layer toolkit - shared libraries
ii  libssl1.0.2:amd64                             1.0.2j-4                            amd64        Secure Sockets Layer toolkit - shared libraries
ii  libssl1.0.2:i386                              1.0.2j-4                            i386         Secure Sockets Layer toolkit - shared libraries
ii  libssl1.1:amd64                               1.1.0c-2                            amd64        Secure Sockets Layer toolkit - shared libraries
ii  libwavpack1:amd64                             4.80.0-1                            amd64        audio codec (lossy and lossless) - library
ii  libwavpack1:i386                              4.80.0-1                            i386         audio codec (lossy and lossless) - library
ii  openssl                                       1.1.0c-2                            amd64        Secure Sockets Layer toolkit - cryptographic utility
ii  python-openssl                                16.2.0-1                            all          Python 2 wrapper around the OpenSSL library
ii  ssl-cert                                      1.0.38                              all          simple debconf wrapper for OpenSSL

bug

Most helpful comment

Had the same problem in a fresh install of stretch, solved with:
apt-get install libssl1.0-dev

All 5 comments

Hi @senid231! I looked at this failure that someone else had run into when their apt installation lacked that function: Do you also need libgmp3-dev? See also https://github.com/puma/puma/issues/848

http://stackoverflow.com/questions/30143180/puma-gem-failed-to-build-gem-native-extension/34537944#34537944

Had the same problem in a fresh install of stretch, solved with:
apt-get install libssl1.0-dev

i solve this by installing libssl1.0 from stable branch

This has been fixed by #1178.

Praise be! Please re-open if someone experiences this on puma 3.7+

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MSP-Greg picture MSP-Greg  Â·  4Comments

leonkielstra picture leonkielstra  Â·  3Comments

banister picture banister  Â·  3Comments

F4Ke picture F4Ke  Â·  4Comments

knzudgt picture knzudgt  Â·  4Comments