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

Can't install openssl in ruby@2.7.6 #534

Closed
m11o opened this issue Aug 11, 2022 · 6 comments
Closed

Can't install openssl in ruby@2.7.6 #534

m11o opened this issue Aug 11, 2022 · 6 comments

Comments

@m11o
Copy link

m11o commented Aug 11, 2022

Hi!

I tried to install openssl to use shopify_api gem.
But, error occured and it wasn't installed. Detail of error is following.

$ bundle install

...
Installing openssl 3.0.0 with native extensions

compiling ossl_ts.c
In file included from ossl_ts.c:10:
In file included from ./ossl.h:171:
./openssl_missing.h:195:11: warning: 'TS_VERIFY_CTS_set_certs' macro redefined [-Wmacro-redefined]
#  define TS_VERIFY_CTS_set_certs(ctx, crts) ((ctx)->certs=(crts))
          ^
/opt/homebrew/Cellar/openssl@3/3.0.5/include/openssl/ts.h:424:11: note: previous definition is here
#  define TS_VERIFY_CTS_set_certs(ctx, cert) TS_VERIFY_CTX_set_certs(ctx,cert)
          ^
ossl_ts.c:829:5: error: incomplete definition of type 'struct TS_verify_ctx'
    TS_VERIFY_CTX_set_certs(ctx, x509inter);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./openssl_missing.h:215:46: note: expanded from macro 'TS_VERIFY_CTX_set_certs'
#  define TS_VERIFY_CTX_set_certs(ctx, crts) TS_VERIFY_CTS_set_certs(ctx, crts)
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./openssl_missing.h:195:52: note: expanded from macro 'TS_VERIFY_CTS_set_certs'
#  define TS_VERIFY_CTS_set_certs(ctx, crts) ((ctx)->certs=(crts))
                                              ~~~~~^
/opt/homebrew/Cellar/openssl@3/3.0.5/include/openssl/ts.h:405:16: note: forward declaration of 'struct TS_verify_ctx'
typedef struct TS_verify_ctx TS_VERIFY_CTX;
               ^
1 warning and 1 error generated.
make: *** [ossl_ts.o] Error 1

I installed openssl@3 in my computer from homebrew.

$ brew list | grep openssl
openssl@1.1
openssl@3

ruby version:

$ ruby -v
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [arm64-darwin21]

Would you please tell me how I can install it?
Thank you for your help!

@rhenium
Copy link
Member

rhenium commented Aug 11, 2022

Please attach the content of mkmf.log file.

./openssl_missing.h:195:11: warning: 'TS_VERIFY_CTS_set_certs' macro redefined [-Wmacro-redefined]
#  define TS_VERIFY_CTS_set_certs(ctx, crts) ((ctx)->certs=(crts))

From a quick glance at this error, it seems like a case where our extconf.rb and ossl_ts.c find the OpenSSL header files of different versions for some reason.

@m11o
Copy link
Author

m11o commented Aug 11, 2022

Hi! @rhenium

Thank you for your replying.
I attached mkmf.log at this comment.
it's very long and it may be hard to read it. Please check it!

Thanks
mkmf.log

@rhenium
Copy link
Member

rhenium commented Aug 11, 2022

"clang -o conftest [...] -I/Users/m11o/.rbenv/versions/2.7.6/openssl/include [...]
| pkg-config --cflags-only-I openssl
=> "-I/opt/homebrew/Cellar/openssl@3/3.0.5/include\n"
| pkg-config --cflags-only-other openssl
=> "\n"
| pkg-config --libs-only-l openssl
=> "-lssl -lcrypto\n"
package configuration for openssl
incflags: -I/opt/homebrew/Cellar/openssl@3/3.0.5/include
cflags: 
ldflags: -L/opt/homebrew/Cellar/openssl@3/3.0.5/lib
libs: -lssl -lcrypto

This appears to be #486. The bugfix is not included in a release yet.

For the time being, I think you can give an environment variable PKG_CONFIG_PATH=/Users/m11o/.rbenv/versions/2.7.6/openssl/lib/pkgconfig to override pkg-config's behavior, or add to Gemfile:

gem "openssl", git: "https://github.com/ruby/openssl", ref: "e9798b1ec794d0c8f0a591b320ebb45afb037b52"

@m11o
Copy link
Author

m11o commented Aug 11, 2022

Great! It's resolved.
I appreciate for your help and am looking forward to the release.

@m11o m11o closed this as completed Aug 11, 2022
@skull-squadron
Copy link

Please release this. Can't install ruby 3.1.3.

@hsbt
Copy link
Member

hsbt commented Nov 28, 2022

Ruby 3.1.3 contains this fix ruby/ruby@b3969f7.

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

No branches or pull requests

4 participants