Hi Folks,
Wonder if you can help me understand why I get this error and how can I overcome it? Thanks.
crypto.c:131:28: fatal error: openssl/chacha.h: No such file or directory
#include <openssl/chacha.h>
^
compilation terminated.
make[4]: *** [x86_64-unknown-linux-gnu/Makefile:136: ../priv/obj/x86_64-unknown-linux-gnu/crypto.o] Error 1
make[4]: Leaving directory '/tmp/erlang_build_MwcZWB/otp_src_19.0/lib/crypto/c_src'
make[3]: *** [/tmp/erlang_build_MwcZWB/otp_src_19.0/make/run_make.mk:35: opt] Error 2
make[3]: Leaving directory '/tmp/erlang_build_MwcZWB/otp_src_19.0/lib/crypto/c_src'
make[2]: *** [/tmp/erlang_build_MwcZWB/otp_src_19.0/make/otp_subdir.mk:29: opt] Error 2
make[2]: Leaving directory '/tmp/erlang_build_MwcZWB/otp_src_19.0/lib/crypto'
make[1]: *** [/tmp/erlang_build_MwcZWB/otp_src_19.0/make/otp_subdir.mk:29: opt] Error 2
make[1]: Leaving directory '/tmp/erlang_build_MwcZWB/otp_src_19.0/lib'
make: *** [Makefile:452: libs] Error 2
I am having the same issue on ArchLinux, I think it is because ArchLinux uses openssl 1.1, but I am not sure how to work around it. I tried to pass --with-ssl and --with-ssl-incl flags to configure to use openssl 1.0, but it did not work for me.
I will update if I find anything interesting.
asdf plugin-update erlang
wget -O /tmp/link-openssl.sh https://gist.githubusercontent.com/tuvistavie/22554261f3e613703d76d882977290f1/raw/0f244ae93e980160492bd9fc9bc84797f16ac10a/archlinux-link-openssl1-0.sh
sudo bash /tmp/link-openssl.sh /usr/local/openssl-1.0
ERLANG_OPENSSL_PATH="/usr/local/openssl-1.0" asdf install erlang 19.3
After trying a few things, here are the results:
--with-ssl flag. The directory structure should be something like DIR/lib/libssl.so for it to work with --with-ssl=DIR, but it is installed at /usr/lib/openssl-1.0/libssl.soLet's assume that we want to have OpenSSL 1.0 in $HOME/.openssl-1.0 (if we want to make this /usr/local/openssl-1.0, or something not inside user home, some steps will require sudo)
First, we need to have OpenSSL 1.0 installed with a a directory structure that Erlang build scripts will understand.
We have two choices:
Compile OpenSSL 1.0 from sources. This can be done with the following steps:
git clone https://github.com/openssl/openssl.git --branch OpenSSL_1_0_2-stable
./config --prefix=$HOME/.openssl-1.0 shared -fPIC
make depend && make && make install
Link the lib and include provided in Arch openssl-1.0 package. This can be done with the following steps:
mkdir -p $HOME/.openssl-1.0
cd $HOME/.openssl.1-0
ln -sf /usr/lib/openssl-1.0 lib
ln -sf /usr/include/openssl-1.0 include
I created a gist with the steps here: https://gist.github.com/tuvistavie/22554261f3e613703d76d882977290f1
I would rather go with the second solution, as it avoids having to maintain an OpenSSL install for no good reason.
Then we need to path --with-ssl to ./configure in Erlang so that it uses OpenSSL 1.0 and not 1.1.
I updated asdf-erlang to support the ERLANG_OPENSSL_PATH environment variable to make this easier, as the --with-ssl option was currently overriden.
Erlang can therefore be installed using:
ERLANG_OPENSSL_PATH="$HOME/.openssl-1.0" asdf install erlang 19.3
Let me know how this works for you.
NOTE: do not forget to run asdf plugin-update erlang before installing anything.
@tuvistavie thanks for the help! That worked fine!
Fedora 27 users can install compat-openssl10-devel.
Thanks for the detailed comment @tuvistavie ! I added it to the asdf-erlang wiki: https://github.com/asdf-vm/asdf-erlang/wiki/OpenSSL-on-ArchLinux
Great, thank you!
I had a problem with version from this manual but works with the latest one without any chanages
asdf install erlang 21.1.3 - now I can do mix deps.get
Most helpful comment
Fedora 27 users can install
compat-openssl10-devel.