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

Fail to build on debian sid #1136

Closed
nicoe opened this issue Nov 19, 2016 · 7 comments
Closed

Fail to build on debian sid #1136

nicoe opened this issue Nov 19, 2016 · 7 comments
Labels

Comments

@nicoe
Copy link

nicoe commented Nov 19, 2016

I tried to install puma using the following command line on my debian box (unstable up to date):

gem install puma -v '3.6.0' --user-install

It failed to build with the following message:

WARNING:  You don't have /home/nicoe/.gem/ruby/2.3.0/bin in your PATH,
	  gem executables will not run.
Building native extensions.  This could take a while...
ERROR:  Error installing puma:
	ERROR: Failed to build gem native extension.

    current directory: /home/nicoe/.gem/ruby/2.3.0/gems/puma-3.6.0/ext/puma_http11
/usr/bin/ruby2.3 -r ./siteconf20161119-32550-kwzs7p.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/nicoe/.gem/ruby/2.3.0/extensions/x86_64-linux/2.3.0/puma-3.6.0/mkmf.log

current directory: /home/nicoe/.gem/ruby/2.3.0/gems/puma-3.6.0/ext/puma_http11
make "DESTDIR=" clean

current directory: /home/nicoe/.gem/ruby/2.3.0/gems/puma-3.6.0/ext/puma_http11
make "DESTDIR="
compiling http11_parser.c
compiling io_buffer.c
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_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 */
 ^
Makefile:239: recipe for target 'mini_ssl.o' failed
make: *** [mini_ssl.o] Error 1

make failed, exit code 2

Ruby version: ruby 2.3.2p217 (2016-11-15) [x86_64-linux-gnu]
Rails version: 4.2.7.1

@nicoe
Copy link
Author

nicoe commented Nov 19, 2016

I might be mistaken but I doubt this is #783 because the error is not a missing file.

@spk
Copy link
Contributor

spk commented Nov 19, 2016

This might be because Debian sid is currently moving to libssl1.1 and mini_ssl only support libssl1.0 ABI

@yob
Copy link

yob commented Nov 22, 2016

I was able to build puma on debian sid once I installed the new libssl1.0-dev package.

Installing it might be a challenge, as it conflicts with libssl-dev (v1.1.0). You should only need it installed while puma builds though, then you can re-install libssl-dev. It's a hack, but might be helpful as an interim solution.

@junaruga
Copy link
Contributor

junaruga commented Nov 22, 2016

This also happens on Fedora rawhide.

Build puma with openssl-devel 1.0.2j: Success
Build puma with openssl-devel 1.1.0b: Failure

Same error on nginx.
https://trac.nginx.org/nginx/ticket/860#comment:6

Koronen added a commit to Koronen/puma that referenced this issue Dec 16, 2016
Fixes the following error:

```
../../../../ext/puma_http11/mini_ssl.c: In function ‘get_dh1024’:
../../../../ext/puma_http11/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);
     ^~
```

These changes are based on the following patch to nginx:
<nginx/nginx@789abf2>
("SSL: default DH parameters compatible with OpenSSL 1.1.0").

Relevant parts of the nginx source code in their full context can be
found here:
<https://github.com/nginx/nginx/blob/release-1.10.2/src/event/ngx_event_openssl.c#L954-L980>.

For reference:

> *) Made DH and DH_METHOD opaque. The structures for managing DH objects
>    have been moved out of the public header files. New functions for managing
>    these have been added.
>    [Matt Caswell]

<https://www.openssl.org/news/cl110.txt>

Fixes puma#1136.
@scifisamurai
Copy link

scifisamurai commented Feb 7, 2018

For anyone else that finds this thread like I did (via google) due to getting a similar error trying to install puma 2.16.0 for ruby 2.3.0 on Arch Linux.

Doing the following worked to install puma using openssl-1.0 (after you install openssl-1.0 via pacman)
gem install puma -v '2.16.0' -- --with-cppflags=-I/usr/include/openssl-1.0 --with-ldflags=-L/usr/lib/openssl-1.0

References:

  1. SSL not available in this build #971 (shows the syntax for passing cppflags & ldfags switches to gem install )
  2. https://wiki.archlinux.org/index.php/RVM (shows the cppflags & ldflags appropriate for openssl 1 on Arch Linux)

@kinduff
Copy link

kinduff commented Mar 2, 2018

Method above from @scifisamurai works to compile puma v3.2.0 for ruby 2.3.0 on ArchLinux.

@artkirienko
Copy link

Works fine for an old project after bundle update 👍

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

No branches or pull requests

8 participants