narasimp has asked for the wisdom of the Perl Monks concerning the following question:

We have downloaded Net::SSLeay module source from cpan and would like to compile it locally and use it. We are facing issues in two situations.

We need your suggestions on couple of items: 1) We need to use Net::SSLeay module. We have compiled it on Linux x86_64 box using the following statements: perl Makefile.PL INC=-I”<openssl_path>/include" LIBS=-L” <openssl_path>/lib" This generates a Makefile which doesn’t seem to use –lcrypto option. I want to use this option since we are seeing the following error at the runtime: undefined symbol: X509_EXTENSION_free

From the below link, it appears that we need to include –lcrypto option. Please help us how to include this option. I tried looking into Makefile.pl but could not understand much since I am new to this Makefile. http://w3facility.org/question/what-is-undefined-symbol-x509_extension_free/

2) Secondly, while building on Windows, we need to include openssl_path, but INC= and LIBS= doesn’t seem to work. Openssl libraries are already present in a local directory. Please let us know how to include the path with the #perl Makefile.pl option. Your suggestions will be very much appreciated.

  • Comment on Issues while building Net::SSLeay module on linux and windows

Replies are listed 'Best First'.
Re: Issues while building Net::SSLeay module on linux and windows
by syphilis (Archbishop) on Apr 21, 2015 at 12:28 UTC
    Hi,
    As regards building Net-SSLeay-1.68 on Windows, the first thing I always do is remove the provided Makefile.PL.
    (Coming to grips with the crippling conditions imposed by inc::Module::Install is something I most definitely do wish to avoid.)

    I replace that Makefile.PL with one that contains:
    use ExtUtils::MakeMaker; WriteMakefile( 'NAME' => 'Net::SSLeay', 'VERSION_FROM' => 'lib/Net/SSLeay.pm', 'LIBS' => ['-lssl -lcrypto -lcrypt32 -lz'], );
    (I can't recall why "-lcrypt32" is there ... I strongly suspect it's not needed, but it's not causing any breakage.
    And you might not need the "-lz" either.)

    However, that works for me only because the required libraries and headers are being found by default. That is, they're located in directories that are automatically searched.
    If your openssl libraries and headers are in directories that are not automatically searched, then the Makefile.PL needs to specify something extra.
    Let's say that your openssl headers are in C:/someplace/include/openssl and that your openssl libraries are in C:/someplace/lib, then the Makefile.PL would need to be something like:
    use ExtUtils::MakeMaker; WriteMakefile( 'NAME' => 'Net::SSLeay', 'VERSION_FROM' => 'lib/Net/SSLeay.pm', 'INC' => '-IC:/someplace/include', 'LIBS' => ['-LC:/someplace/lib -lssl -lcrypto -lcrypt3 +2 -lz'], );
    That works fine for me, except that on some 64-bit builds of perl I get a t/ocsp.t failure (which I ignore) during the "dmake test" stage.
    If that approach does not work for you, I'd be wanting to see the error messages you're getting, the full path to your openssl headers & libraries, and the actual Makefile.PL that was run.

    Cheers,
    Rob
      Thanks for suggestion. Let me try this and get back.
Re: Issues while building Net::SSLeay module on linux and windows
by Corion (Patriarch) on Apr 21, 2015 at 11:47 UTC

    The distribution unfortunately uses a custom installer script and hides most of the setup logic in inc/Module/Install/PRIVATE/Net/SSLeay.pm. Maybe you can find there where you need to put the additional parameters and where to put the logic to find the OpenSSL libraries/paths.