# Building Erlang OTP-24 + JIT + Observer + Elixir latest



## steveoc64 (May 22, 2021)

Just a heads up.

Getting Erlang running on FreeBSD 12.2, with the latest release - including the JIT compiler, and the WX Graphics with observer. 

It can be done !  and its pretty straightforward

Pulling the latest code from git :

https://github.com:erlang/otp   to get the Erlang code.

Latest code on master is for OTP-25, so checkout the maint-24 branch.  I tried playing with OTP-25, but fell in a hole building Elixir against the bleeding edge Erlang, so fell back to OTP-24 for my own sanity.

Use clang instead of gcc - so set the CC / CXX / CPP vars to match your clang install.

A relatively up to date clang is needed to even compile the emulation / JIT asm code. Gcc failed to compile, but at least a vanilla clang works all the way.

./configure  ... add options to suit  (--with-dynamic-trace=dtrace etc)   The new JIT compiler is configured by default.

Use gmake instead of make.  (I guess the makefiles are full of gnu-isms, dont know, didnt bother to fight it).  Ithink you need GNU autoconf installed, and you will need wx development libs installed if you want the GUI tools too.

`./otp_build autoconf
./configure  --with-dynamic-trace=dtrace
gmake 
doas gmake install`

Puts the binaries in /usr/local/lib/erlang/...    so add /usr/local/lib/erlang/bin  to your PATH

Now its all there, you can run erl, see the options its build with, and check that the observer runs.
`$ erl
Erlang/OTP 24 [erts-12.0.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]

Eshell V12.0.1  (abort with ^G)
1> observer:start().`
Sweet !


For a matching Elixir - pull from git, latest master is 1.13.0-dev ... that works fine with OTP-24, or you might want to checkout branch 1.12 for something relatively stable)









						GitHub - elixir-lang/elixir: Elixir is a dynamic, functional language designed for building scalable and maintainable applications
					

Elixir is a dynamic, functional language designed for building scalable and maintainable applications - GitHub - elixir-lang/elixir: Elixir is a dynamic, functional language designed for building s...




					github.com
				





`gmake clean test
doas gmake install`

then run iex -S mix to get an Elixir shell against a running project, again you can see the versions of everything set, you can see that JIT is enabled, and then fire off the observer  (using Elixir syntax this time)

`iex -S mix
Erlang/OTP 24 [erts-12.0.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]

Interactive Elixir (1.13.0-dev) - press Ctrl+C to exit (type h() ENTER for help)

iex(1)> :observer.start`

... and it just works.  Very happy - running the latest and greatest on FreeBSD, and being able to keep up to date because Im working straight off git repos.  Actually easier than messing around with Ubuntu / apt / snap, or Homebrew on the Mac.









This is all very good, but "whats the point ?" you might well ask.

Well, this isnt exactly the place to try to advocate for obscure non-mainstream tech after all.  

Just saying - if you love building robust systems, and you haven't got your hands dirty with Erlang, or Elixir, or OTP, or LiveView, or NIFs written in C and Rust and Zig ... then its worth having a look for sure.  Its really really worth having a look


----------



## toronja (May 23, 2021)

works perfectly! thanks a lot!


----------



## jdp_03 (May 23, 2021)

I was keen to try this out, since I couldn't get observer to work with 23.3.2 when I built using kerl.

Thanks to your write up, version 24 works for me  with wxgtk30 (3.0.5), but fails against wxgtk31 (3.1.5) - observer complains of an undefined symbol.  

The build process runs /usr/local/bin/wx-config to find the wx libraries.  I soft linked this to /usr/local/bin/wxgtk3u-3.0-config.
Although the observer works, it throws a number of errors in the repl, but it doesn't seem to affect the appearance of observer itself.

If anybody has it working against 3.1.5 I would appreciate knowing if there is anything specific that needs to be set in the build configuration.  Otherwise, I hope that the info I have provided might save others some time.

Thanks, again, steveoc64.


----------



## steveoc64 (May 24, 2021)

Good point - I had to do that softlink hack to get wx-config working as well - forgot to document that.

Earlier attempts to get observer working were throwing all sorts of weird errors about failing to locate symbols in the wx shared lib.


----------



## marschro (Aug 16, 2021)

Hi steveoc64 - thanks for this heads up 
I honestly have only an idea about what you are doing and which steps you undergo . But I just followed what you did and now I have OTP 24 

Currently the version provided in ports and pkg is


```
Erlang/OTP 21 [erts-10.3.5.19] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.11.3 (compiled with Erlang/OTP 21)
```

Which is a bit behind OTP 24 and elixir 1.12.2.
With OTP 23 a lot of good news were introduced, we currently use in our application and build process.

Does anyone have an insight on the roadmap on when this will be available in pkg or ports?
And more general question, why is pkg often so behind latest - is this part of security strategy - or just manpower - can one get involved and support someone in order to help maintaining those things?

cheers
Martin


----------



## Les Ferguson (Oct 24, 2021)

The current packages are erlang-24.1.1 and elixir-1.12.3.
Are these ok to use now?


----------

