toddr / Crypt-OpenSSL-RSA

Release history of Crypt-OpenSSL-RSA
https://metacpan.org/pod/Crypt::OpenSSL::RSA
Other
8 stars 25 forks source link

Fails to Compile on OS/X [rt.cpan.org #122552] #17

Closed toddr closed 4 years ago

toddr commented 5 years ago

Migrated from rt.cpan.org#122552 (status was 'new')

Requestors:

From nhorne@cpan.org on 2017-07-20 17:28:22:

cc -c   -fno-common -DPERL_DARWIN -O2 -W -Wformat=2 -Wswitch -Wshadow -Wwrite-strings -Wuninitialized -Wall -pipe -mtune=native -march=native -fomit-frame-pointer -msse2 -msse -mmmx -D_FORTIFY_SOURCE=2 -I/usr/local/include -O3   -DVERSION=\"0.28\" -DXS_VERSION=\"0.28\"  "-I/Users/hornenj/perl5/perlbrew/perls/perl-5.26.0/lib/5.26.0/darwin-thread-multi-2level/CORE" -DPERL5 -DOPENSSL_NO_KRB5 RSA.c
RSA.xs:52:22: error: incomplete definition of type 'struct rsa_st'
    return(p_rsa->rsa->d != NULL);
           ~~~~~~~~~~^
/usr/include/openssl/include/openssl/ossl_typ.h:110:16: note: forward
      declaration of 'struct rsa_st'
typedef struct rsa_st RSA;
toddr commented 5 years ago

Still broken

$>perl Makefile.PL; make
Checking if your kit is complete...
Looks good
Writing Makefile for Crypt::OpenSSL::RSA
Writing MYMETA.yml and MYMETA.json
cp RSA.pm blib/lib/Crypt/OpenSSL/RSA.pm
AutoSplitting blib/lib/Crypt/OpenSSL/RSA.pm (blib/lib/auto/Crypt/OpenSSL/RSA)
/usr/bin/perl /System/Library/Perl/5.18/ExtUtils/xsubpp  -typemap /System/Library/Perl/5.18/ExtUtils/typemap -typemap typemap  RSA.xs > RSA.xsc && mv RSA.xsc RSA.c
cc -c   -arch x86_64 -arch i386 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os   -DVERSION=\"0.31\" -DXS_VERSION=\"0.31\"  "-I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE"  -DPERL5 -DOPENSSL_NO_KRB5 RSA.c
RSA.xs:5:10: fatal error: 'openssl/bio.h' file not found
#include <openssl/bio.h>
         ^~~~~~~~~~~~~~~
1 error generated.
make: *** [RSA.o] Error 1
toddr commented 5 years ago

From what I can tell, OSX doesn't ship the full header libraries for openssl. Probably due to license restrictions in openssl.

The only solution appears to be to compile openssl in opt or some other place.

Possibly we need something to make that more clear when Makefile.PL is run.

karupanerura commented 5 years ago

Hello. I success to build Crypt::OpenSSL::RSA on my macOS using homebrew's openssl.

brew install openssl
export C_INCLUDE_PATH=/usr/local/opt/openssl/include
export LIBRARY_PATH=/usr/local/opt/openssl/lib
cpanm Crypt::OpenSSL::RSA

So I suggest adding C_INCLUDE_PATH/LIBRARY_PATH for homebrew's openssl if these directories are exists. How do you think?

akiym commented 5 years ago

Maybe this problem was fixed in Crypt::OpenSSL::RSA >= 0.30. These versions are using Crypt::OpenSSL::Guess to determine include/library path and so you don't have to export environment variables before installing the module.

@karupanerura Would you please try to reinstall Crypt::OpenSSL::RSA without exporting variables?

karupanerura commented 5 years ago

oops. My cpanm looked my DarkPAN's OLD Crypt::OpenSSL::RSA... Sorry. And thank you for telling it!

toddr commented 4 years ago

At the least, the macos github actions seems to test just fine.

https://github.com/toddr/Crypt-OpenSSL-RSA/commit/92e2990e5a68cc6c187247670c3755d02de38071/checks?check_suite_id=409511768

I'm closing this for now.