[erlang-questions] "OpenSSL might not be installed on this system." (OS X 10.9, openssl seems to be there).

Weston C westonc@REDACTED
Sun Nov 13 19:15:04 CET 2016


When trying to use crypto/ssl-related stuff in my local build of
Erlang (Mac OS X 10.9), I'm getting errors that indicate it doesn't
believe I have OpenSSL installed on my system, despite some notable
evidence that I apparently do.

Here's the error I'm seeing:

    westonMBP:weston$ erl
    Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:8:8]
[async-threads:10] [hipe] [kernel-poll:false]

    Eshell V7.3  (abort with ^G)
    1> crypto:start().
    ** exception error: undefined function crypto:start/0
    2>
    =ERROR REPORT==== 7-Nov-2016::16:45:02 ===
    Unable to load crypto library. Failed with error:
    "load_failed, Failed to load NIF library:
'dlopen(/usr/local/lib/erlang/lib/crypto-3.7/priv/lib/crypto.so, 2):
Symbol not found: _EVP_aes_128_cbc
      Referenced from: /usr/local/lib/erlang/lib/crypto-3.7/priv/lib/crypto.so
    Expected in: flat namespace
     in /usr/local/lib/erlang/lib/crypto-3.7/priv/lib/crypto.so'"
    OpenSSL might not be installed on this system.

    =WARNING REPORT==== 7-Nov-2016::16:45:02 ===
    The on_load function for module crypto returned {error,
                                                 {load_failed,
    "Failed to load NIF library:
'dlopen(/usr/local/lib/erlang/lib/crypto-3.7/priv/lib/crypto.so, 2):
Symbol not found: _EVP_aes_128_cbc\n  Referenced from:
/usr/local/lib/erlang/lib/crypto-3.7/priv/lib/crypto.so\n  Expected
in: flat namespace\n in
/usr/local/lib/erlang/lib/crypto-3.7/priv/lib/crypto.so'"}}

Now... I'm pretty sure I have openssl installed:


    westonMBP:otp_src_18.3 weston$ openssl version
    OpenSSL 1.0.2j  26 Sep 2016
    westonMBP:otp_src_18.3 weston$ which openssl
    /usr/local/bin/openssl

And libcrypto.a and libcrypto.dylib show under /usr/local/lib, there's
a full openssl header directory under /usr/local/include.

So, I figured I'd go back and take a look at the different options
presented to me by `configure` when I built from source.

Initially, I ran configure with `--with-ssl=/usr/local`, but I notice
one can opmit the path... why not try just `--with-ssl`, and see if it
makes the connection better on its own?

Doesn't seem to:


    checking for static ZLib to be used by SSL in standard locations... no
    checking for OpenSSL >= 0.9.7 in standard locations... rm:
conftest.dSYM: is a directory
    rm: conftest.dSYM: is a directory
    found; but not usable
    configure: WARNING: No (usable) OpenSSL found, skipping ssl, ssh
and crypto applications
    checking for kstat_open in -lkstat... (cached) no

    ...

    *********************************************************************
    **********************  APPLICATIONS DISABLED  **********************
    *********************************************************************

    crypto         : No usable OpenSSL found
    ssh            : No usable OpenSSL found
    ssl            : No usable OpenSSL found


Going back to `--with-ssl=/usr/local` gives me:


    checking for static ZLib to be used by SSL in standard locations... no
    checking for OpenSSL kerberos 5 support... yes
    rm: conftest.dSYM: is a directory
    checking for krb5.h in standard locations... found in /usr/include
    checking for kstat_open in -lkstat... (cached) no


So the build process seems to think I've got it. Nevertheless,
invoking `crypto:start()` brings us back to the "OpenSSL might not be
installed on this system." error.

Having wrestled with some weird OS X library/header path issues
recently, I thought about the possibility that one or the other is
there, but OS X can't see it, figured I'd look up an OpenSSL "Hello
World" program:


    /*
        https://www.mitchr.me/SS/exampleCode/openssl.html
        https://www.mitchr.me/SS/exampleCode/openssl/bio_hello0.c.html
    */
    #include <stdio.h>
    #include <openssl/ssl.h>
    #include <openssl/bio.h>

    int main(int argc, char *argv[]);

    int main(int argc, char *argv[]) {

        BIO *bio_stdout;

        bio_stdout = BIO_new_fp(stdout, BIO_NOCLOSE);

          BIO_printf(bio_stdout, "hello, World!\n");

        BIO_free_all(bio_stdout);

          return 0;
    }


And then try building/running it:


    westonMBP:tmp weston$ gcc -o hellossl hellossl.c -lcrypto
    westonMBP:tmp weston$ ./hellossl
    hello, World!


So, it's finding openssl on this toy/test program.

I did consider that this might be related to an issue potentially
fixed in a later release, and tried builing 19.1.  Same result
(although the missing symbol given in the error message seems to be
_CRYPTO_num_locks rather than  _EVP_aes_128_cbc).

I also tried building/installing a few different versions of openssl
-- 1.0.2e, 1.0.2j, and 1.1.0b. There's no difference between the
result of the 1.0.2's, 1.1.0b seems to actually break the make process
entirely.

Any hints on what to try next?



More information about the erlang-questions mailing list