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

Building ruby 2.5.1 fails with openssl 1.0.2o_1 #199

Closed
papilip opened this issue May 2, 2018 · 2 comments
Closed

Building ruby 2.5.1 fails with openssl 1.0.2o_1 #199

papilip opened this issue May 2, 2018 · 2 comments

Comments

@papilip
Copy link

papilip commented May 2, 2018

Hello all, i can not compile ruby 2.5.1 and ruby 2.6.0-preview1 with the same error.

macOS High Sierra Version 10.13.4 with homebrew. I use ruby-install with this command ruby-install ruby 2.5.1

compiling openssl_missing.c
In file included from openssl_missing.c:21:
./openssl_missing.h:75:11: warning: 'X509_STORE_get_ex_new_index' macro redefined [-Wmacro-redefined]
#  define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \
          ^
/usr/local/Cellar/openssl@1.1/1.1.0h/include/openssl/x509_vfy.h:320:9: note: previous definition is here
#define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \
        ^
openssl_missing.c:65:36: error: invalid application of 'sizeof' to an incomplete type 'HMAC_CTX'
      (aka 'struct hmac_ctx_st')
    HMAC_CTX *ctx = OPENSSL_malloc(sizeof(HMAC_CTX));
                                   ^     ~~~~~~~~~~
/usr/local/Cellar/openssl@1.1/1.1.0h/include/openssl/crypto.h:126:23: note: expanded from macro 'OPENSSL_malloc'
        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
                      ^~~
/usr/local/Cellar/openssl@1.1/1.1.0h/include/openssl/ossl_typ.h:102:16: note: forward declaration of
      'struct hmac_ctx_st'
typedef struct hmac_ctx_st HMAC_CTX;
               ^
openssl_missing.c:68:5: warning: implicit declaration of function 'HMAC_CTX_init' is invalid in C99
      [-Wimplicit-function-declaration]
    HMAC_CTX_init(ctx);
    ^
openssl_missing.c:78:2: warning: implicit declaration of function 'HMAC_CTX_cleanup' is invalid in C99
      [-Wimplicit-function-declaration]
        HMAC_CTX_cleanup(ctx);
        ^
openssl_missing.c:90:13: error: incomplete definition of type 'struct X509_crl_st'
        *psig = crl->signature;
                ~~~^
/usr/local/Cellar/openssl@1.1/1.1.0h/include/openssl/ossl_typ.h:121:16: note: forward declaration of
      'struct X509_crl_st'
typedef struct X509_crl_st X509_CRL;
               ^
openssl_missing.c:92:13: error: incomplete definition of type 'struct X509_crl_st'
        *palg = crl->sig_alg;
                ~~~^
/usr/local/Cellar/openssl@1.1/1.1.0h/include/openssl/ossl_typ.h:121:16: note: forward declaration of
      'struct X509_crl_st'
typedef struct X509_crl_st X509_CRL;
               ^
openssl_missing.c:102:13: error: incomplete definition of type 'struct X509_req_st'
        *psig = req->signature;
                ~~~^
/usr/local/Cellar/openssl@1.1/1.1.0h/include/openssl/x509.h:91:16: note: forward declaration of 'struct X509_req_st'
typedef struct X509_req_st X509_REQ;
               ^
openssl_missing.c:104:13: error: incomplete definition of type 'struct X509_req_st'
        *palg = req->sig_alg;
                ~~~^
/usr/local/Cellar/openssl@1.1/1.1.0h/include/openssl/x509.h:91:16: note: forward declaration of 'struct X509_req_st'
typedef struct X509_req_st X509_REQ;
               ^
3 warnings and 5 errors generated.
make[2]: *** [openssl_missing.o] Error 1
make[1]: *** [ext/openssl/all] Error 2
make: *** [build-ext] Error 2
!!! Compiling ruby 2.5.1 failed!

If you can help me, many thanks !

@awolfson
Copy link

awolfson commented Nov 21, 2018

I had this exact same error, and I solved it by following these two recommendations:

  1. Reinstall XCode Command Line Tools
  2. Install without headers in /usr/local/include

I was on Mojave and installing Ruby version 2.5.3.

@rhenium
Copy link
Member

rhenium commented Dec 20, 2021

I believe you fixed this already.

./openssl_missing.h:75:11: warning: 'X509_STORE_get_ex_new_index' macro redefined [-Wmacro-redefined]
#  define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \

This error is due to multiple versions of OpenSSL being installed on the system. Removing the other or explicitly specifying the path where the desired OpenSSL version is installed to, by --with-openssl-dir=, should have resolved it.

@rhenium rhenium closed this as completed Dec 20, 2021
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

3 participants