erlang / otp

Erlang/OTP
http://erlang.org
Apache License 2.0
11.38k stars 2.95k forks source link

Building with make FLAVOR=emu fails #4722

Open rnowak opened 3 years ago

rnowak commented 3 years ago

Describe the bug Building with make FLAVOR=emu fails.

[...]
 MAKE   secondary_bootstrap_build
make[1]: Entering directory '/home/rn/temp/otp-24.0-rc2/lib'
make[2]: Entering directory '/home/rn/temp/otp-24.0-rc2/lib/parsetools'
=== Entering application parsetools
make[3]: Entering directory '/home/rn/temp/otp-24.0-rc2/lib/parsetools/src'
 ERLC   ../ebin/leex.beam
 ERLC   ../ebin/yecc.beam
 ERLC   ../ebin/yeccparser.beam
 ERLC   ../ebin/yeccscan.beam
 VSN    ../ebin/parsetools.app
 VSN    ../ebin/parsetools.appup
erlexec: The emulator 'smp' does not exist.
erlexec: The emulator 'smp' does not exist.
make[3]: *** [/home/rn/temp/otp-24.0-rc2/make/x86_64-pc-linux-gnu/otp.mk:133: ../ebin/leex.beam] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [/home/rn/temp/otp-24.0-rc2/make/x86_64-pc-linux-gnu/otp.mk:133: ../ebin/yecc.beam] Error 1
erlexec: The emulator 'smp' does not exist.
make[3]: *** [/home/rn/temp/otp-24.0-rc2/make/x86_64-pc-linux-gnu/otp.mk:133: ../ebin/yeccscan.beam] Error 1
erlexec: The emulator 'smp' does not exist.
make[3]: *** [/home/rn/temp/otp-24.0-rc2/make/x86_64-pc-linux-gnu/otp.mk:133: ../ebin/yeccparser.beam] Error 1
make[3]: Leaving directory '/home/rn/temp/otp-24.0-rc2/lib/parsetools/src'
make[2]: *** [/home/rn/temp/otp-24.0-rc2/make/otp_subdir.mk:29: opt] Error 2
make[2]: Leaving directory '/home/rn/temp/otp-24.0-rc2/lib/parsetools'
make[1]: *** [/home/rn/temp/otp-24.0-rc2/make/otp_subdir.mk:29: opt] Error 2
make[1]: Leaving directory '/home/rn/temp/otp-24.0-rc2/lib'
make: *** [Makefile:609: secondary_bootstrap_build] Error 2

To Reproduce

git clone https://github.com/erlang/otp.git --depth 1 -b OTP-24.0-rc2 otp-24.0-rc2
cd otp-24.0-rc2
./otp_build autoconf
./configure --prefix=/opt/erlang/24.0-rc2-emu
make FLAVOR=emu

Expected behavior The documentation suggests that this should be possible: http://erlang.org/documentation/doc-12.0-rc2/erts-12.0/doc/html/BeamAsm.html#is-the-interpreter-still-available-

Or you can build the interpreter using make FLAVOR=emu and then run it using erl -emu_flavor emu.

It is possible to have both the JIT and interpreter available at the same time.

Affected versions OTP-24.0-rc2

garazdawi commented 3 years ago
git clone https://github.com/erlang/otp.git --depth 1 -b OTP-24.0-rc2 otp-24.0-rc2
cd otp-24.0-rc2
./otp_build autoconf
./configure --prefix=/opt/erlang/24.0-rc2-emu
make
make FLAVOR=emu

You need to first build a normal system, then you can build the emu flavor. A patch to make this clearer in the documentation would be most welcome.

rnowak commented 3 years ago

It seemingly builds fine with the above instructions; both make invocations go through without any errors. However, I don't seem to be able to start it as described.

$ /opt/erlang/24.0-rc2-emu/bin/erl -emu_flavor emu
erlexec: Invalid emulator type or flavor. Available combinations are:
  -emu_flavor smp

Starting it with smp seems to start the JIT version:

$ /opt/erlang/24.0-rc2-emu/bin/erl -emu_flavor smp
Erlang/OTP 24 [RELEASE CANDIDATE 2] [erts-12.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

Eshell V12.0  (abort with ^G)
1> erlang:system_info(emu_flavor).
jit
garazdawi commented 3 years ago

Could be that it only works in the source tree and not when doing a make install. It is really only meant to be a debugging feature to be able to build both. If you need a non-jit version, the best way is to build using --disable-jit.

rnowak commented 3 years ago

From within the source tree:

$ bin/erl -emu_flavor emu
Erlang/OTP 24 [RELEASE CANDIDATE 2] [erts-12.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]

Eshell V12.0  (abort with ^G)
1> erlang:system_info(emu_flavor).
emu

That works indeed.

I didn't realize this was meant to only be a debugging feature. "It is possible to have both the JIT and interpreter available at the same time." made it sound like this was intended for normal usage, at least to me.

Thank you very much for the help. I will see if I can suggest documentation improvements over the weekend.

garazdawi commented 3 years ago

I didn't realize this was meant to only be a debugging feature. "It is possible to have both the JIT and interpreter available at the same time." made it sound like this was intended for normal usage, at least to me.

Yes, it could have been clearer. My thought was that the fact that it is only mentioned in the internal documentation section of erts would imply this, but better so be extra clear on these things.

depressed-pho commented 2 years ago

$ /opt/erlang/24.0-rc2-emu/bin/erl -emu_flavor emu erlexec: Invalid emulator type or flavor. Available combinations are: -emu_flavor smp

This is because beam.emu is not installed in your $PREFIX/lib/erlang/erts-*/bin. I could get around the problem by doing this:

./configure
make
make FLAVOR=emu
make install
make install FLAVOR=emu