How to install Elixir 1.16.2 on GNU Guix System?

Hello,

I am trying to install the latest Elixir on my newly installed GNU Guix System box. However, the version offered by Guix is 1.14.0. I have tried setting up ASDF, but I can’t install Erlang v26.2.3 due to OpenSSL and ODBC not being found (even though they were installed with guix install). Any help is greatly appreciated. Thanks!

erlang in asdf is built using kerl.

If you don’t need odbc I’d suggest disabling it: GitHub - kerl/kerl: Easy building and installing of Erlang/OTP instances

Openssl is a more commonly needed dependency of crypto. You can manually define a path if it cannot be automatically found. For that see GitHub - kerl/kerl: Easy building and installing of Erlang/OTP instances

1 Like

I tried adding ~/.guix-profile/include/openssl to the --with-ssl option of KERL_CONFIGURE_OPTIONS, but it still isnt’ compiling:

➜  src export KERL_CONFIGURE_OPTIONS="--disable-debug --disable-silent-rules --without-javac --enable-shared-zlib --enable-dynamic-ssl-lib --enable-hipe --enable-sctp --enable-smp-support --enable-threads --enable-kernel-poll --enable-wx --enable-darwin-64bit --with-ssl=/home/djaouen/.guix-profile/include/openssl"
➜  src asdf install erlang 26.2.3
asdf_26.2.3 is not a kerl-managed Erlang/OTP installation
The asdf_26.2.3 build has been deleted
Extracting source code
Building Erlang/OTP 26.2.3 (asdf_26.2.3), please wait...
[packages] Unknown Linux distro guix; not checking build packages.
Configure failed.
checking for linker flags for loadable drivers... -shared -Wl,-Bsymbolic
checking for 'runtime library path' linker flag... -Wl,-R
checking for multiarch directory... not found
checking size of void *... 8
checking for static zlib... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /run/current-system/profile/bin/grep
checking for egrep... /run/current-system/profile/bin/grep -E
checking for OpenSSL header in /home/djaouen/.guix-profile/include/openssl... configure: error: no OpenSSL header found in /home/djaouen/.guix-profile/include/openssl
ERROR: /home/djaouen/.asdf/plugins/erlang/kerl-home/builds/asdf_26.2.3/otp_src_26.2.3/lib/crypto/configure failed!

Please see /home/djaouen/.asdf/plugins/erlang/kerl-home/builds/asdf_26.2.3/otp_build_26.2.3.log for full details.

Inside of ~/.guix-profile/include/openssl, I do see an OpenSSL header:

➜  src find ~/.guix-profile/include/openssl/ -iname "openssl*.h"
/home/djaouen/.guix-profile/include/openssl/opensslconf.h
/home/djaouen/.guix-profile/include/openssl/opensslv.h

Is it not finding it because it is named opensslv.h instead of openssl.h? I am unsure how to proceed.

Hmm, it seems to find it if I give --with-ssl=~/.guix-profile. But now I am seeing a new error:

gcc  -Werror=undef -Werror=implicit -Werror=return-type  -fno-strict-aliasing -fno-common -g  -O3 -fno-omit-frame-pointer -I/home/djaouen/.asdf/plugins/erlang/kerl-home/builds/asdf_26.2.3/otp_src_26.2.3/erts/x86_64-pc-linux-gnu    -D_GNU_SOURCE  -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes -Wdeclaration-after-statement -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS   -DBEAMASM=1 -Ix86_64-pc-linux-gnu/opt/jit -Ibeam -Isys/unix -Isys/common -Ix86_64-pc-linux-gnu -Ipcre -Iryu -Iopenssl/include -I../include -I../include/x86_64-pc-linux-gnu -I../include/internal -I../include/internal/x86_64-pc-linux-gnu -Ibeam/jit -Ibeam/jit/x86 -c beam/erl_bif_lists.c -o obj/x86_64-pc-linux-gnu/opt/jit/erl_bif_lists.o
make[4]: *** [x86_64-pc-linux-gnu/Makefile:960: x86_64-pc-linux-gnu/opt/jit/asmjit/asmjit.hpp.gch] Error 1
make[4]: *** Waiting for unfinished jobs....
make[4]: Leaving directory '/home/djaouen/.asdf/plugins/erlang/kerl-home/builds/asdf_26.2.3/otp_src_26.2.3/erts/emulator'
make[3]: *** [/home/djaouen/.asdf/plugins/erlang/kerl-home/builds/asdf_26.2.3/otp_src_26.2.3/make/run_make.mk:35: opt] Error 2
make[3]: Leaving directory '/home/djaouen/.asdf/plugins/erlang/kerl-home/builds/asdf_26.2.3/otp_src_26.2.3/erts/emulator'
make[2]: *** [Makefile:45: opt] Error 2
make[2]: Leaving directory '/home/djaouen/.asdf/plugins/erlang/kerl-home/builds/asdf_26.2.3/otp_src_26.2.3/erts'
make[1]: *** [Makefile:60: jit] Error 2
make[1]: Leaving directory '/home/djaouen/.asdf/plugins/erlang/kerl-home/builds/asdf_26.2.3/otp_src_26.2.3/erts'
make: *** [Makefile:503: emulator] Error 2

OK, now I tried running the install with CC="gcc -I/home/djaouen/.guix-profile/include -L/home/djaouen/.guix-profile/lib" asdf install erlang 23.2.3 and am seeing a new error:

/run/current-system/profile/bin/install -c -d ../priv/lib/x86_64-unknown-linux-gnu
gcc -I/home/djaouen/.guix-profile/include -L/home/djaouen/.guix-profile/lib -shared -Wl,-Bsymbolic -o ../priv/lib/x86_64-unknown-linux-gnu/otp_test_engine.so ../priv/obj/x86_64-unknown-linux-gnu/otp_test_engine.o  -Wl,-R/home/djaouen/.guix-profile/lib -Wl,-R/usr/local/lib64 -Wl,-R/usr/sfw/lib64 -Wl,-R/usr/lib64 -Wl,-R/opt/local/lib64 -Wl,-R/usr/pkg/lib64 -Wl,-R/usr/local/openssl/lib64 -Wl,-R/usr/lib/openssl/lib64 -Wl,-R/usr/openssl/lib64 -Wl,-R/usr/local/ssl/lib64 -Wl,-R/usr/lib/ssl/lib64 -Wl,-R/usr/ssl/lib64 -Wl,-R/lib64 -Wl,-R/usr/local/lib -Wl,-R/usr/sfw/lib -Wl,-R/usr/lib -Wl,-R/opt/local/lib -Wl,-R/usr/pkg/lib -Wl,-R/usr/local/openssl/lib -Wl,-R/usr/lib/openssl/lib -Wl,-R/usr/openssl/lib -Wl,-R/usr/local/ssl/lib -Wl,-R/usr/lib/ssl/lib -Wl,-R/usr/ssl/lib -Wl,-R/lib -L/home/djaouen/.guix-profile/lib -lcrypto
cc1: some warnings being treated as errors
make[4]: *** [x86_64-unknown-linux-gnu/Makefile:179: ../priv/obj/x86_64-unknown-linux-gnu/pkey.o] Error 1
make[4]: Leaving directory '/home/djaouen/.asdf/plugins/erlang/kerl-home/builds/asdf_23.2.3/otp_src_23.2.3/lib/crypto/c_src'
make[3]: *** [/home/djaouen/.asdf/plugins/erlang/kerl-home/builds/asdf_23.2.3/otp_src_23.2.3/make/run_make.mk:35: opt] Error 2
make[3]: Leaving directory '/home/djaouen/.asdf/plugins/erlang/kerl-home/builds/asdf_23.2.3/otp_src_23.2.3/lib/crypto/c_src'
make[2]: *** [/home/djaouen/.asdf/plugins/erlang/kerl-home/builds/asdf_23.2.3/otp_src_23.2.3/make/otp_subdir.mk:29: opt] Error 2
make[2]: Leaving directory '/home/djaouen/.asdf/plugins/erlang/kerl-home/builds/asdf_23.2.3/otp_src_23.2.3/lib/crypto'
make[1]: *** [/home/djaouen/.asdf/plugins/erlang/kerl-home/builds/asdf_23.2.3/otp_src_23.2.3/make/otp_subdir.mk:29: opt] Error 2
make[1]: Leaving directory '/home/djaouen/.asdf/plugins/erlang/kerl-home/builds/asdf_23.2.3/otp_src_23.2.3/lib'
make: *** [Makefile:505: libs] Error 2

I installed gcc-toolchain from Guix guix install gcc-toolchain and now that command works. Thanks for everyone’s help!

Hello,

you can use my own Guix channel which contains up-to-date erlang and elixir packages, here it is:

3 Likes

This is useful, thanks!

Have you tried it? Any success?

By the way, this elixir package also makes LSP possible to work (i.e. go-to-definition feature) against included elixir source code out-of-box.

1 Like

I haven’t tried it yet as I have been too busy to review the source code to see if it fits my needs. I will do that when I find the time and let you know if I encounter any issues. Thanks! :slight_smile:

1 Like

OK, I tried installing Elixir from your channel, but I still can’t seem to get ElixirLS working. I don’t know, I will have to do some more research and get this figured out. Thanks again for this!

Wait, I finally got it working by doing a mix do deps.get, compile and then downloading and unzipping the release on the ElixirLS GitHub page (rather than doing a mix elixir_ls.release2 -o release. Thanks for your help! Do you have a donation page so I can donate to you?

1 Like

By the way, this elixir package also makes LSP possible to work (i.e. go-to-definition feature) against included elixir source code out-of-box.

Ok, I will try to explain it with another words due to probable misunderstanding what I mean.
Any LS works more or less fine with the upstream Elixir packages from Guix (Debian’s package also applies) out-of-box when you work with your project and its’ dependences source trees, but if you try to dive into any Elixir standard library function (i.e. Map.get/3) definition it fails because module meta data points to some nonexistent compile-time location on the file system where is no Elixir sources. So why sometimes it is recommended to use Elixir compiled from source or asdf, both variants seem to solve the problem. I have no idea, if someone also needs to navigate into Elixir’s standard functions, but I do and do it quite frequently.

1 Like

OK, I think I got it. Thanks for the clarification. :slight_smile:

1 Like