Opened 10 years ago

Last modified 9 years ago

#45114 new defect

erlang @17.3_0+hipe+ssl: can't load crypto library

Reported by: dedalo@… Owned by: ci42
Priority: Normal Milestone:
Component: ports Version: 2.3.1
Keywords: Cc:
Port: erlang

Description (last modified by larryv (Lawrence Velázquez))

There is a problem with the openssl library. When I try to load the crypto library, which depends on ssl, an exception is triggered. I'm on Mac OS X 10.7.5.

erl
Erlang/OTP 17 [erts-6.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V6.2  (abort with ^G)
1> crypto:start().
** exception error: undefined function crypto:start/0
2> 
=ERROR REPORT==== 21-Sep-2014::17:55:32 ===
Unable to load crypto library. Failed with error:
"load, Library load-call unsuccessful."
OpenSSL might not be installed on this system.

=ERROR REPORT==== 21-Sep-2014::17:55:32 ===
The on_load function for module crypto returned {error,
                                                 {load,
                                                  "Library load-call unsuccessful."}}



port installed erlang
The following ports are currently installed:
  erlang @17.1_0+hipe+ssl
  erlang @17.3_0+hipe+ssl (active)

Change History (8)

comment:1 Changed 10 years ago by larryv (Lawrence Velázquez)

Description: modified (diff)
Owner: changed from macports-tickets@… to ciserlohn@…
Port: @17.3_0+hipe+ssl removed
Priority: HighNormal
Summary: Erlang can't load crypto libraryerlang @17.3_0+hipe+ssl: can't load crypto library

Thanks for the report. In the future, please Cc relevant port maintainers (port info --maintainers erlang) and avoid setting the Priority field (it’s reserved for MacPorts developers).

comment:2 Changed 10 years ago by ci42

It works on my machine (OS X 10.9.5):

bash-4.3$ erl
Erlang/OTP 17 [erts-6.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V6.2  (abort with ^G)
1> crypto:start().
ok
2>

It looks like the bug described here although the fix mentioned there is contained in erlang 17.3.

Could you check if the any of the described workarounds works for you?

If I did any of: calling crypto:start() a second time, or waiting a few seconds before calling it, or evaluating another shell command before crypto:start() , it would work just fine.

And please provide the output of:

$ otool -L /opt/local/lib/erlang/lib/crypto-3.4.1/priv/lib/crypto.so

and:

$ port installed openssl
Last edited 10 years ago by ci42 (previous) (diff)

comment:3 Changed 10 years ago by dedalo@…

otool -L /opt/local/lib/erlang/lib/crypto-3.4.1/priv/lib/crypto.so

/opt/local/lib/erlang/lib/crypto-3.4.1/priv/lib/crypto.so:
	/opt/local/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
port installed openssl

The following ports are currently installed:
  openssl @1.0.1i_0 (active)

comment:4 in reply to:  3 Changed 10 years ago by ci42

Replying to dedalo@…:

otool -L /opt/local/lib/erlang/lib/crypto-3.4.1/priv/lib/crypto.so

/opt/local/lib/erlang/lib/crypto-3.4.1/priv/lib/crypto.so:
	/opt/local/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
port installed openssl

The following ports are currently installed:
  openssl @1.0.1i_0 (active)

Ok, there is nothing suspicious.

Could you please try the workarounds mentioned upstream:

If I did any of: calling crypto:start() a second time, or waiting a few seconds before calling it, or evaluating another shell command before crypto:start() , it would work just fine.

and report the results.

comment:5 Changed 10 years ago by dedalo@…

I have tried it, I have just forgot to mention it. It didn't work, I got the same error twice. :-(

comment:6 Changed 10 years ago by dedalo@…

Just a fast update. I have restarted the system and CouchDB (it's built on Erlang) didn't start. The log shows the same error above. So I have reverted to 17.1 version and it works. If there is something I can do to help further let me know. Anyway the bug exists and it's just related to 17.3. The 17.1 release instead works fine. You might check the difference between 17.1 and 17.3 to figure out the problem.

comment:7 Changed 9 years ago by bakki

I am running into this problem on OSX 10.7.5 but with Erlang erlang @17.4_0+hipe+ssl and openssl @1.0.2_0. Also I get,

otool -L /opt/local/lib/erlang/lib/crypto-3.4.2/priv/lib/crypto.so /opt/local/lib/erlang/lib/crypto-3.4.2/priv/lib/crypto.so:

/opt/local/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

The error: Eshell V6.3 (abort with G)

1> crypto:start().

=ERROR REPORT==== 15-Feb-2015::01:16:37 === Unable to load crypto library. Failed with error: "load, Library load-call unsuccessful." OpenSSL might not be installed on this system.

=ERROR REPORT==== 15-Feb-2015::01:16:37 === The on_load function for module crypto returned {error,

{load,

"Library load-call unsuccessful."}}

exception error: undefined function crypto:start/0

comment:8 Changed 9 years ago by zany_macports@…

Seems to be a conflict when loading the native libs from the NIF. I enabled debug output and got

CRYPTO: INCOMPATIBLE SSL VERSION lib=90819f header=1000201f

Looks to me that the Erlang port compiled against the OpenSSL port (@1.0.2a) but somehow pulls in the old pre-installed version (0.9.8).

Setting DYLD_PRINT_LIBRARIES I see that the NIF /opt/local/lib/erlang/lib/crypto-3.5/priv/lib/crypto.so pulls in /opt/local/lib/libcrypto.1.0.0.dylib as wanted. However the Eshell pulls in /usr/lib/libcrypto.0.9.8.dylib way before that point and that takes precedence.

A quick check shows ApplicationServices framework, PasswordServer framework, and libsasl linking in the old version. Well no way around that then.

My Solution here is to hide the current OpenSSL (i.e. move the pkgconfig -- you might be better off to uninstall but there are a lot of ports dependent on OpenSSL...) then install Erlang from source (-s flag).

A slightly better fix might be to change the port to compile Erlang against the pre-installed system version of OpenSSL always.

Note: See TracTickets for help on using tickets.