taylor / kiex

Elixir version manager
http://taylor.github.io/kiex/
MIT License
766 stars 65 forks source link

Error when installing using erlang installed with kerl in CentosOS #7

Closed tinat closed 9 years ago

tinat commented 10 years ago

This is the error I got when I ran "kiex install 0.12.4" (using bash shell)

HEAD is now at 543dfde... Release v0.12.4 cd lib/elixir && ../../rebar clean Uncaught error in rebar_core: {'EXIT', {undef, [{crypto,start,[],[]}, {rebar,run_aux,2, [{file,"src/rebar.erl"},{line,163}]}, {rebar,main,1, [{file,"src/rebar.erl"},{line,58}]}, {escript,run,2, [{file,"escript.erl"},{line,747}]}, {escript,start,1, [{file,"escript.erl"},{line,277}]}, {init,start_it,1,[]}, {init,start_em,1,[]}]}} make: * [clean] Error 1 Uncaught error in rebar_core: {'EXIT', {undef, [{crypto,start,[],[]}, {rebar,run_aux,2, [{file,"src/rebar.erl"},{line,163}]}, {rebar,main,1, [{file,"src/rebar.erl"},{line,58}]}, {escript,run,2, [{file,"escript.erl"},{line,747}]}, {escript,start,1, [{file,"escript.erl"},{line,277}]}, {init,start_it,1,[]}, {init,start_em,1,[]}]}} make: * [erlang] Error 1

Conditions: CentosOS 6, erlang in $HOME/packages/erlang_r16b03, activated with command ". $HOME/packages/erlang_r16b03/activate"

I have erlang installed in $HOME/packages/erlang with the regular "configure; make; make install" commands and if I removed all the environment settings from the kerl activate command and just set my PATH to include $HOME/packages/erlang then "kiex install 0.12.4" works fine.

One difference between the kerl installed erlang directory and the "configure; make;make-install directory" is the bin directory contains symbolic links to the lib directory and what is in the kerl package lib directory is actually found in lib/erlang

What confuses me is that "kiex install 0.12.4" works fine on my Mac OSX machine with both the kerl activated versions of erlang.and the "configure; make; make install" version.

Thanks, Tina

taylor commented 10 years ago

Mmm... looks like a dependency issue with crypt libs. Did configure for Erlang tell you anything about that?

tinat commented 10 years ago

Hi Taylor,

I have libgcrypt-1.4.5 and libgcrypt-devel-1.4.5 installed. Erlang built fine with configure -- it found crypto. kerl did not complain about the erlang build either and there are obj, beam and lib files in the build directory ~/.kerl/builds/r16b03/release_R16B03/lib/crypto-3.2 and also in the installed directory ~/packages/erlang_r16b03/lib/crypto-3.2

I was able to compile iex fine with make against erlang compiled with configure. I also built with kiex fine against erlang compiled with configure. It's only when I build with kiex and the activated kerl installation that I get the above error.

Thanks for your attention, Tina

taylor commented 10 years ago

I get similar errors trying to build rebar using erlang bulit with kerl:

Recompile: src/rebar_xref
Uncaught error in rebar_core: {'EXIT',
                               {undef,
                                [{crypto,start,[],[]},
                                 {rebar,run_aux,2,
                                  [{file,"src/rebar.erl"},{line,165}]},
                                 {rebar,main,1,
                                  [{file,"src/rebar.erl"},{line,58}]},
                                 {erl_eval,do_apply,6,
                                  [{file,"erl_eval.erl"},{line,569}]},
                                 {escript,eval_exprs,5,
                                  [{file,"escript.erl"},{line,856}]},
                                 {erl_eval,local_func,5,
                                  [{file,"erl_eval.erl"},{line,467}]},
                                 {escript,interpret,4,
                                  [{file,"escript.erl"},{line,774}]},
                                 {escript,start,1,
                                  [{file,"escript.erl"},{line,277}]}]}}

There seems to be changes upstream in the openssl package. This Erlang thread for Centos 6.4+ goes into it:

https://groups.google.com/forum/#!topic/erlang-programming/wW6Uuz4VO2w

It appears that some distros have updated OpenSSL to this non-working (for erlang) version, but have yet to include a patch similar to RedHat's errata patch which fixes it.

http://rhn.redhat.com/errata/RHBA-2013-1751.html

taylor commented 10 years ago

A working erlang gives the following:

➔  erl
Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.4  (abort with ^G)
1> crypto:start().
ok

while an non-working (for crypto) will show some thing similar to:

# erl
Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.4  (abort with ^G)
1> crypto:start().
** exception error: undefined function crypto:start/0
2> 
=ERROR REPORT==== 1-Apr-2014::00:34:19 ===
Unable to load crypto library. Failed with error:
"load_failed, Failed to load NIF library: '/root/package/erlang_r16b03-1/lib/crypto-3.2/priv/lib/crypto.so: undefined symbol: EC_GROUP_new_curve_GF2m'"
OpenSSL might not be installed on this system.

=ERROR REPORT==== 1-Apr-2014::00:34:19 ===
The on_load function for module crypto returned {error,
                                                 {load_failed,
                                                  "Failed to load NIF library: '/root/package/erlang_r16b03-1/lib/crypto-3.2/priv/lib/crypto.so: undefined symbol: EC_GROUP_new_curve_GF2m'"}}

You can quickly test with

erl -eval "crypto:start(), halt()." -noshell

which will exit w/o issue if erlang is built correctly other-wise it will give a crash dump.

Andy-Richards commented 10 years ago

After some googling, setting CFLAGS="-DOPENSSL_NO_EC=1" when compiling Erlang resolved the issue for me. If your using kerl add...

export CFLAGS="-DOPENSSL_NO_EC=1"

...to your ~/.kerlrc file before re-building Erlang.

Andy.

taylor commented 10 years ago

Okay great. It seemed to be something like that. I'll add that to the README and close this issue if you feel this resolves it.

On Fri, Apr 25, 2014 at 10:16 AM, Andy Richards notifications@github.comwrote:

After some googling, setting CFLAGS="-DOPENSSL_NO_EC=1" when compiling Erlang resolved the issue for me. If your using kerl add...

export CFLAGS="-DOPENSSL_NO_EC=1"

...to your ~/.kerlrc file before re-building Erlang.

Andy.

— Reply to this email directly or view it on GitHubhttps://github.com/taylor/kiex/issues/7#issuecomment-41404058 .

Andy-Richards commented 10 years ago

Yes if @tinat is happy for the issue to be closed. I just came across this issue and as the above resolved the issue for me I thought I would share my experience :-)

taylor commented 10 years ago

Let me know what you think @tinat. I'll leave it open for a bit longer.

On Fri, Apr 25, 2014 at 10:33 AM, Andy Richards notifications@github.comwrote:

Yes if @tinat https://github.com/tinat is happy for the issue to be closed. I just came across this issue and as the above resolved the issue for me I thought I would share my experience :-)

— Reply to this email directly or view it on GitHubhttps://github.com/taylor/kiex/issues/7#issuecomment-41406075 .

sinabz commented 10 years ago

I am using OpenSUSE 13.1 as my OS. I had the same error but the solution by Andy did not work for me. I searched over my packages and I found I have package libopenssl1_0_0 installed. I also installed libopenssl0_9_8 and everything went ok.

jmarkbrooks commented 9 years ago

Thanks for this. Somebody needs to make a note of it at the kerl site, because I have Mint 17.1 and the error confused me. The CFLAGS addition to my .kerlrc fixed the problem.

merkerxu commented 9 years ago

I met the same problem, and I solved it according to: http://stackoverflow.com/questions/6618233/openssl-error-building-erlang-otp-from-source

yaohuaxin commented 8 years ago

For PPC64LE: ./configure --prefix=/home/huaxin/huaxin/toolsInstalled/ --build=ppc64le CFLAGS="-D_GNU_SOURCE -DOPENSSL_NO_EC=1" then make then make install

alexshavelev commented 8 years ago

adding KERL_CONFIGURE_OPTIONS="--with-ssl=/usr/lib/ssl" and rebuild also works

wingleungchoi commented 6 years ago

There is related issue opened in Kerl and the solution is there add --with-ssl=/usr/local/opt/openssl to KERL_CONFIGURE_OPTIONS in ~/.kerlrc

export KERL_CONFIGURE_OPTIONS="--with-ssl=/usr/local/opt/openssl"

https://github.com/kerl/kerl/issues/103

jadeallenx commented 6 years ago

For the record the problem is that Red Hat has refused to ship elliptic curve crypto for OpenSSL for well over 10 years because Red Hat believes ECC is covered by patents. There is a tracking ticket in kerl: https://github.com/kerl/kerl/issues/212