I’m trying to install Erlang 22.0 with asdf, but it fails. I’m using Ubuntu 22.04 and followed the before install steps here
asdf install erlang 22.0
asdf_22.0 is not a kerl-managed Erlang/OTP installation
The asdf_22.0 build has been deleted
Extracting source code
Building Erlang/OTP 22.0 (asdf_22.0), please wait...
Build failed.
gmake[4]: *** [x86_64-unknown-linux-gnu/Makefile:669: /home/sauronnikko/.asdf/plugins/erlang/kerl-home/builds/asdf_22.0/otp_src_22.0/lib/erl_interface/bin/x86_64-unknown-linux-gnu/erl_call] Error 1
gmake[4]: *** Waiting for unfinished jobs....
gmake[4]: Leaving directory '/home/sauronnikko/.asdf/plugins/erlang/kerl-home/builds/asdf_22.0/otp_src_22.0/lib/erl_interface/src'
gmake[3]: *** [Makefile:31: opt] Error 2
gmake[3]: Leaving directory '/home/sauronnikko/.asdf/plugins/erlang/kerl-home/builds/asdf_22.0/otp_src_22.0/lib/erl_interface/src'
gmake[2]: *** [/home/sauronnikko/.asdf/plugins/erlang/kerl-home/builds/asdf_22.0/otp_src_22.0/make/otp_subdir.mk:29: opt] Error 2
gmake[2]: Leaving directory '/home/sauronnikko/.asdf/plugins/erlang/kerl-home/builds/asdf_22.0/otp_src_22.0/lib/erl_interface'
gmake[1]: *** [/home/sauronnikko/.asdf/plugins/erlang/kerl-home/builds/asdf_22.0/otp_src_22.0/make/otp_subdir.mk:29: opt] Error 2
gmake[1]: Leaving directory '/home/sauronnikko/.asdf/plugins/erlang/kerl-home/builds/asdf_22.0/otp_src_22.0/lib'
gmake: *** [Makefile:490: libs] Error 2
Please see /home/sauronnikko/.asdf/plugins/erlang/kerl-home/builds/asdf_22.0/otp_build_22.0.log for full details.
Here are the contents of the log file: https://gist.github.com/sauronnikko/5b85263ec5294b403e27e41012f9a23f
Can you help me fix this? Thanks
The “multiple definitions” error in your log file matches the one in this issue exactly:
opened 05:50PM - 10 Aug 20 UTC
closed 02:59PM - 24 Aug 21 UTC
I'm trying to install some older erlang versions to ensure compatibility but I'm… running into issues.
I'm trying to install erlang 21.3 with:
`asdf install erlang 21.3.8.17`
But it is failing with:
```
Build failed.
make[4]: *** [x86_64-unknown-linux-gnu/Makefile:665: /home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/bin/x86_64-unknown-linux-gnu/erl_call] Error 1
make[4]: *** Waiting for unfinished jobs....
make[4]: Leaving directory '/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/src'
make[3]: *** [Makefile:30: opt] Error 2
make[3]: Leaving directory '/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/src'
make[2]: *** [/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/make/otp_subdir.mk:29: opt] Error 2
make[2]: Leaving directory '/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface'
make[1]: *** [/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/make/otp_subdir.mk:29: opt] Error 2
make[1]: Leaving directory '/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib'
make: *** [Makefile:490: libs] Error 2
```
Looking at the build log it looks like the issue is that `ld` is failing:
```
/usr/bin/ld: /home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/obj/x86_64-unknown-linux-gnu/libei.a(eirecv.o):/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/src/misc/ei_portio.h:50: multiple definition of `ei_default_socket_callbacks'; /home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/obj/x86_64-unknown-linux-gnu/libei.a(ei_connect.o):/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/src/misc/ei_portio.h:50: first defined here
/usr/bin/ld: /home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/obj/x86_64-unknown-linux-gnu/libei.a(send.o):/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/src/misc/ei_portio.h:50: multiple definition of `ei_default_socket_callbacks'; /home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/obj/x86_64-unknown-linux-gnu/libei.a(ei_connect.o):/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/src/misc/ei_portio.h:50: first defined here
/usr/bin/ld: /home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/obj/x86_64-unknown-linux-gnu/libei.a(send_reg.o):/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/src/misc/ei_portio.h:50: multiple definition of `ei_default_socket_callbacks'; /home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/obj/x86_64-unknown-linux-gnu/libei.a(ei_connect.o):/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/src/misc/ei_portio.h:50: first defined here
/usr/bin/ld: /home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/obj/x86_64-unknown-linux-gnu/libei.a(epmd_port.o):/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/src/misc/ei_portio.h:50: multiple definition of `ei_default_socket_callbacks'; /home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/obj/x86_64-unknown-linux-gnu/libei.a(ei_connect.o):/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/src/misc/ei_portio.h:50: first defined here
/usr/bin/ld: /home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/obj/x86_64-unknown-linux-gnu/libei.a(ei_portio.o):/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/src/misc/ei_portio.h:50: multiple definition of `ei_default_socket_callbacks'; /home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/obj/x86_64-unknown-linux-gnu/libei.a(ei_connect.o):/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/src/misc/ei_portio.h:50: first defined here
RANLIB /home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/obj/x86_64-unknown-linux-gnu/liberl_interface.a
collect2: error: ld returned 1 exit status
make[4]: *** [x86_64-unknown-linux-gnu/Makefile:665: /home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/bin/x86_64-unknown-linux-gnu/erl_call] Error 1
make[4]: *** Waiting for unfinished jobs....
make[4]: Leaving directory '/home/jason/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.8.17/otp_src_21.3.8.17/lib/erl_interface/src'
make[3]: *** [Makefile:30: opt] Error 2
```
This seems relevant: http://erlang.org/doc/apps/erl_interface/notes.html#erl_interface-3.13.2
> Fix link error "multiple definition of `ei_default_socket_callbacks'" for gcc version 10 or when built with gcc option -fno-common. Error exists since OTP-21.3.
>
> Own Id: OTP-16412 Aux Id: PR-2503
It looks like the bug was fixed in https://github.com/erlang/otp/pull/2503 (although I can't find a link for OTP-16412 anywhere). However it looks like that fix was only included in 22.3 which means that I may be unable to build any erlang versions earlier than 22.3 (which is what I seem to have been encountering).
Is it possible to work-around this issue in asdf-erlang? Or should it be fixed in some other way. It seems like maybe we could remove `-fno-common`? Maybe this should be filed in kerl instead?
The linked kerl
issue suggests that switching to GCC 9 or Clang may help.
Eiji
July 27, 2022, 5:26pm
3
Analyse
ok, let’s take a look …
Tested Erlang
environments
First of all Erlang
is tested on 10.04
- 20-04
. It should be fine with 22.04
as well, but it’s worth to mention and keep in mind that according to documentation it wasn’t officially tested against this version of Ubuntu
…
Why Bob
?
You may wonder why I mention Bob
? That’s because I’m using it’s builds in all of my development environments. Obviously installing prebuilt package speeds up setup environment process, so for me it’s the fastest and safest way.
Bob
’s prebuilt packages
Since Erlang
does not provides any prebuilt packages for other os than Windows
, we can take a look at Bob
’s page. It lists a prebuilt packages for Erlang
for Ubuntu
versions 14.04
- 20.04
and even not all Erlang
versions are “supported” (by Bob
’s page) for all Ubuntu
versions. I guess it’s just nobody asked for triggering old OTP
builds who for most people are unnecessary …
Bob
’s prebuilt packages on Hex
However this is not all. We still have a complete lists of Bob
’s builds hosted on hex and there we can find a builds for Ubuntu 22.04
, but only for OTP-24.2
and above.
Results
Official support
Since I do not know any other source of Erlang
builds I guess that our communities does not provide Erlang 22.0
builds for Ubuntu 22.04
. The reason for it may be compilation problems like yours or as said just no trigger happen for previous Erlang
versions … In any case “officially” there are no tested support and prebuilt builds even provided by community.
My recommendation
Having above in mind in first place I would verify your environment following Erlang
documentation and Bob
’s build process. Meanwhile I would also ask @ericmj (the first and top of Bob
’s contributor) if he knows about any problems or if he can trigger a build for said version. I guess that Bob
have enough well-tested environment, so that we can confirm if any issue like this happens only in specific cases (like not met all requirements) or it’s a common problem.
Possible workaround
We have an Erlang
plugin for prebuilt packages, but unfortunately it needs to follow Hex
’s build list. However there is a workaround. You can install plugin for Erlang
prebuilt packages for previous Ubuntu
versions (like 20.04
) - I have just tested it and iex
works as expected, but keep in mind that’s not a “safe way” and it never would be recommended.
asdf plugin-add erlang-ubuntu-20 https://github.com/michallepicki/asdf-erlang-prebuilt-ubuntu-20.04.git
asdf install erlang-ubuntu-20 22.0
Helpful resouces
Erlang/OTP test architectures
Bob’s List page and Github page
Fully Hex
’s list of OTP
builds for Ubuntu 22.04
Building and Installing Erlang/OTP
Bob
’s build scripts
The initial Bob
’s commit and Top `Bob’s contributors page
List of Michał Łępicki
’s asdf
repositories for various Ubuntu
versions
3 Likes
Ubuntu 22.04 comes with OpenSSL 3.0 only, and earlier versions are not available in apt
repositories. Erlang prior to 24.2 does not even build with OpenSSL 3.0. You can either look into installing OpenSSL 1.x from source, and passing its path to asdf / kerl / erlang configuration… Or upgrading to Erlang 24.2 or newer
1 Like
jbz3n
September 27, 2022, 4:31pm
5
iex doesn’t show problems at first with that prebuilt version.
But when trying to install hex, I got the openssl 1.1 dependency error under Ubuntu 22.04.
You need to downgrade openssl packages to the 20.04 versions, or compile them manually as mentioned.
If you wanna to risk your distro here’s quickest way to do it :
wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1f-1ubuntu2.16_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/openssl_1.1.1f-1ubuntu2.16_amd64.deb
sudo dpkg -i *.deb
Ubuntu 22.04 itself seems to run fine with this, but upgrade your app’s support for newer Erlang/elixir versions just in case, and avoid openssl headaches overall.