Ubuntu elixir build/install with erlang in non-default location

Hi,

I’ve been having some trouble getting a working elixir dev env.

I started with the Ubuntu repository version, but had lots of issues following some tutorials.

I tried downloading binaries and putting them in my path, but they crash for various reasons.

I’ve gotten a little tired of cleaning this up on my machine, so I’m now trying to build/install elixir from source.

erlang is installed at /build/erlang/27.0.1 and I have added it to my PATH.

elixir source is at /build/elixir/elixir-1.17.2.

When I run make in the source directory I get the following:

Crash: error:undef
[{yecc,compile,
[“/build/elixir/elixir-1.17.2/lib/elixir/src/elixir_parser”,
“/build/elixir/elixir-1.17.2/lib/elixir/src/elixir_parser”,
{options,,“/build/elixir/elixir-1.17.2”,undefined,,1,false,999,
[{report,true},{verbose,true}],
“/build/elixir/elixir-1.17.2/lib/elixir/src/elixir_parser.erl”,
“/build/elixir/elixir-1.17.2”}],
},
{erl_compile,compile_file,4,[{file,“erl_compile.erl”},{line,290}]},
{erl_compile,compile3,3,[{file,“erl_compile.erl”},{line,277}]},
{erl_compile,compile,2,[{file,“erl_compile.erl”},{line,60}]},
{erl_compile,‘-compile_cmdline1/1-fun-0-’,2,
[{file,“erl_compile.erl”},{line,73}]}]
make: *** [Makefile:81: lib/elixir/src/elixir_parser.erl] Error 2

I then downloaded the elixir binaries for elixir-otp-27. If I run iex in the bin directory, I get the following output:

024-07-15 23:45:18.754727 crash_report #{label=>{proc_lib,crash},report=>[[{initial_call,{supervisor_bridge,user_sup,[‘Argument__1’]}},{pid,<0.61.0>},{registered_name,},{error_info,{error,undef,[{elixir,start,,},{user_sup,start_user,3,[{file,“user_sup.erl”},{line,100}]},{user_sup,init,1,[{file,“user_sup.erl”},{line,49}]},{supervisor_bridge,init,1,[{file,“supervisor_bridge.erl”},{line,82}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,374}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,342}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,249}]}]}},{ancestors,[kernel_sup,<0.46.0>]},{message_queue_len,0},{messages,},{links,[<0.48.0>]},{dictionary,},{trap_exit,true},{status,running},{heap_size,987},{stack_size,27},{reductions,288}],]}
2024-07-15 23:45:18.754676 Loading of ~ts failed: ~p

"/build/elixir/elixir-otp-27/bin/../lib/elixir/ebin/elixir.beam"
badfile

2024-07-15 23:45:18.754813 supervisor_report #{label=>{supervisor,start_error},report=>[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,{undef,[{elixir,start,,},{user_sup,start_user,3,[{file,“user_sup.erl”},{line,100}]},{user_sup,init,1,[{file,“user_sup.erl”},{line,49}]},{supervisor_bridge,init,1,[{file,“supervisor_bridge.erl”},{line,82}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,374}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,342}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,249}]}]}},{offender,[{pid,undefined},{id,user},{mfargs,{user_sup,start,}},{restart_type,temporary},{shutdown,2000},{child_type,supervisor}]}]}
2024-07-15 23:45:18.754665 ~s~n
“beam/beam_load.c(1876): Error loading module elixir:\n This BEAM file was compiled for a later version of the run-time system than 22.\n To fix this, please recompile this module with an 22 compiler.\n (Use of opcode 178; this emulator supports only up to 168.)\n”
2024-07-15 23:45:18.759125 crash_report #{label=>{proc_lib,crash},report=>[[{initial_call,{application_master,init,[‘Argument__1’,‘Argument__2’,‘Argument__3’,‘Argument__4’]}},{pid,<0.45.0>},{registered_name,},{error_info,{exit,{{shutdown,{failed_to_start_child,user,{undef,[{elixir,start,,},{user_sup,start_user,3,[{file,“user_sup.erl”},{line,100}]},{user_sup,init,1,[{file,“user_sup.erl”},{line,49}]},{supervisor_bridge,init,1,[{file,“supervisor_bridge.erl”},{line,82}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,374}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,342}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,249}]}]}}},{kernel,start,[normal,]}},[{application_master,init,4,[{file,“application_master.erl”},{line,138}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,249}]}]}},{ancestors,[<0.44.0>]},{message_queue_len,1},{messages,[{‘EXIT’,<0.46.0>,normal}]},{links,[<0.44.0>,<0.43.0>]},{dictionary,},{trap_exit,true},{status,running},{heap_size,987},{stack_size,27},{reductions,184}],]}
2024-07-15 23:45:18.761144 std_info #{label=>{application_controller,exit},report=>[{application,kernel},{exited,{{shutdown,{failed_to_start_child,user,{undef,[{elixir,start,,},{user_sup,start_user,3,[{file,“user_sup.erl”},{line,100}]},{user_sup,init,1,[{file,“user_sup.erl”},{line,49}]},{supervisor_bridge,init,1,[{file,“supervisor_bridge.erl”},{line,82}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,374}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,342}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,249}]}]}}},{kernel,start,[normal,]}}},{type,permanent}]}
{“Kernel pid terminated”,application_controller,“{application_start_failure,kernel,{{shutdown,{failed_to_start_child,user,{undef,[{elixir,start,,},{user_sup,start_user,3,[{file,"user_sup.erl"},{line,100}]},{user_sup,init,1,[{file,"user_sup.erl"},{line,49}]},{supervisor_bridge,init,1,[{file,"supervisor_bridge.erl"},{line,82}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,374}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,342}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}}},{kernel,start,[normal,]}}}”}
Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,user,{undef,[{elixir,start,,},{user_sup,start_user,3,[{file,“user_sup.erl”},{lin

Crash dump is being written to: erl_crash.dump…done

Are there some additional environment variables that need to be set? A pointer in the right direction on this would be much appreciated.

Thanks,
-S

Sadly, this is not that straightforward as copying the binaries from one place to another.

I might not be up to date as I did this years ago, however you need to run install script in the directory where you want your erlang installation to be located, at least this is true if you are compiling OTP from source:

$ ./Install [-cross] [-minimal|-sasl] <ERL_ROOT>

Hi,

Thanks for the response. I’m afraid that I already did that. I configured with --prefix and did make install.

Thanks,
-S