Failed to compile Erlang 25.0.2 on Redhat7

Hi guys,

I’m trying to compile Erlang 25.0.2 on Redhat7 but got this error:

[...]
gmake[3]: Entering directory '/home/zab/.kerl/builds/25.0.2/otp_src_25.0.2/lib/os_mon/src'
 ERLC   ../ebin/disksup.beam
 ERLC   ../ebin/memsup.beam
 ERLC   ../ebin/cpu_sup.beam
Function: cpu_util_rel/3
Sub pass ssa_opt_type_start
cpu_sup.erl: internal error in pass beam_ssa_opt:
exception error: no function clause matching beam_types:make_float(NaN,NaN)
  in function  beam_ssa_type:'-normalized_types/2-lc$^0/1-0-'/2
  in call from beam_ssa_type:simplify/2
  in call from beam_ssa_type:simplify/5
  in call from beam_ssa_type:sig_is/7
  in call from beam_ssa_type:sig_bs/8
  in call from beam_ssa_type:sig_function_1/4
  in call from beam_ssa_type:do_sig_function/4
gmake[3]: *** [/home/zab/.kerl/builds/25.0.2/otp_src_25.0.2/make/x86_64-pc-linux-gnu/otp.mk:129: ../ebin/cpu_sup.beam] Error 1
gmake[3]: Leaving directory '/home/zab/.kerl/builds/25.0.2/otp_src_25.0.2/lib/os_mon/src'
gmake[2]: *** [/home/zab/.kerl/builds/25.0.2/otp_src_25.0.2/make/otp_subdir.mk:29:

My config:

  • gcc: 11.2.1
  • lsb_release: Redhat 7.9

Note: compiling 24.3.4.2 went fine

Help appreciated.

1 Like

Try a git bisect. NaNs and Infs are strictly prohibited in the Erlang VM (unless that changed recently and I failed to notice).

Is that you own gcc installation? AFAIK stock RHEL-7.9 should have a much older 4.8.something gcc.

1 Like

Hi Mikael
That’s correct, RH7 is shipped with an old gcc v4.8.
We don’t use it because Redhat also offers devtoolset-11 (gcc 11.2.1).
All our builds 22,23,24 compile just fine with gcc 11.2.1.

1 Like

Same error on Ubuntu 20.04LTS:

$ tail /home/zab/.kerl/builds/25.0.2/otp_build_git.log
make[3]: Leaving directory '/home/zab/.kerl/builds/25.0.2/otp_src_git/lib/crypto/c_src'
make[3]: Entering directory '/home/zab/.kerl/builds/25.0.2/otp_src_git/lib/crypto/doc/src'
make[3]: Nothing to be done for 'opt'.
make[3]: Leaving directory '/home/zab/.kerl/builds/25.0.2/otp_src_git/lib/crypto/doc/src'
=== Leaving application crypto
make[2]: Leaving directory '/home/zab/.kerl/builds/25.0.2/otp_src_git/lib/crypto'
make[2]: Entering directory '/home/zab/.kerl/builds/25.0.2/otp_src_git/lib/os_mon'
=== Entering application os_mon
make[3]: Entering directory '/home/zab/.kerl/builds/25.0.2/otp_src_git/lib/os_mon/src'
 ERLC   ../ebin/disksup.beam
 ERLC   ../ebin/memsup.beam
 ERLC   ../ebin/cpu_sup.beam
Function: cpu_util_rel/3
Sub pass ssa_opt_type_start
cpu_sup.erl: internal error in pass beam_ssa_opt:
exception error: no function clause matching beam_types:make_float(NaN,NaN)
  in function  beam_ssa_type:'-normalized_types/2-lc$^0/1-0-'/2
  in call from beam_ssa_type:simplify/2
  in call from beam_ssa_type:simplify/5
  in call from beam_ssa_type:sig_is/7
  in call from beam_ssa_type:sig_bs/8
  in call from beam_ssa_type:sig_function_1/4
  in call from beam_ssa_type:do_sig_function/4
make[3]: *** [/home/zab/.kerl/builds/25.0.2/otp_src_git/make/x86_64-pc-linux-gnu/otp.mk:129: ../ebin/cpu_sup.beam] Error 1
make[3]: Leaving directory '/home/zab/.kerl/builds/25.0.2/otp_src_git/lib/os_mon/src'
make[2]: *** [/home/zab/.kerl/builds/25.0.2/otp_src_git/make/otp_subdir.mk:29: opt] Error 2
make[2]: Leaving directory '/home/zab/.kerl/builds/25.0.2/otp_src_git/lib/os_mon'
make[1]: *** [/home/zab/.kerl/builds/25.0.2/otp_src_git/make/otp_subdir.mk:29: opt] Error 2
make[1]: Leaving directory '/home/zab/.kerl/builds/25.0.2/otp_src_git/lib'
make: *** [Makefile:511: libs] Error 2
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:        20.04
Codename:       focal
$  gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

My .kerlrc config:

export ERTS_OPCODE_COUNTER_SUPPORT=1
export CFLAGS="-march=x86-64 -O3 -fstack-protector -fomit-frame-pointer -fexpensive-optimizations"

Have anyone succeed compiling 25.0.2?

OK guys. Dropping “-fexpensive-optimizations” from CFLAGS makes it compile just fine.
Thanks for your help

3 Likes