vivier / qemu-m68k

Other
41 stars 7 forks source link

Illegal instruction when trying to build erlang #25

Closed glaubitz closed 6 years ago

glaubitz commented 7 years ago

Trying to build erlang results in an illegal instruction encounter at some point:

megaco_ber_media_gateway_control_v1:
erlc -W  -bber +noobj +legacy_erlang_types +asn1config megaco_ber_media_gateway_control_v1.set.asn
megaco_ber_media_gateway_control_v2:
erlc -W  -bber +noobj +legacy_erlang_types +asn1config megaco_ber_media_gateway_control_v2.set.asn
megaco_ber_media_gateway_control_prev3a:
erlc -W  -bber +noobj +legacy_erlang_types +asn1config megaco_ber_media_gateway_control_prev3a.set.asn
megaco_ber_media_gateway_control_prev3b:
erlc -W  -bber +noobj +legacy_erlang_types +asn1config megaco_ber_media_gateway_control_prev3b.set.asn
megaco_ber_media_gateway_control_prev3c:
erlc -W  -bber +noobj +legacy_erlang_types +asn1config megaco_ber_media_gateway_control_prev3c.set.asn
erlc -W  +debug_info -Dmegaco_parser_inline -pa /<<BUILDDIR>>/erlang-19.3.1+dfsg/lib/et/ebin -pa /<<BUILDDIR>>/erlang-19.3.1+dfsg/lib/megaco/ebin +'{parse_transform,sys_pre_attributes}' +'{attribute,insert,app_vsn,"megaco-3.18.1"}'  -I../../include -o../../ebin megaco_per_encoder.erl
megaco_ber_media_gateway_control_v3:
erlc -W  -bber +noobj +legacy_erlang_types +asn1config megaco_ber_media_gateway_control_v3.set.asn
megaco_per_media_gateway_control_v1:
erlc -W  -bper +noobj +legacy_erlang_types megaco_per_media_gateway_control_v1.set.asn
megaco_per_media_gateway_control_v2:
erlc -W  -bper +noobj +legacy_erlang_types megaco_per_media_gateway_control_v2.set.asn
megaco_per_media_gateway_control_prev3a:
erlc -W  -bper +noobj +legacy_erlang_types megaco_per_media_gateway_control_prev3a.set.asn
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
depend.mk:66: recipe for target 'megaco_per_media_gateway_control_v1.erl' failed
make[5]: *** [megaco_per_media_gateway_control_v1.erl] Illegal instruction
make[5]: *** Deleting file 'megaco_per_media_gateway_control_v1.erl'
make[5]: *** Waiting for unfinished jobs....
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
depend.mk:87: recipe for target 'megaco_per_media_gateway_control_v2.erl' failed
make[5]: *** [megaco_per_media_gateway_control_v2.erl] Illegal instruction
make[5]: *** Deleting file 'megaco_per_media_gateway_control_v2.erl'
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
depend.mk:109: recipe for target 'megaco_per_media_gateway_control_prev3a.erl' failed
make[5]: *** [megaco_per_media_gateway_control_prev3a.erl] Illegal instruction
make[5]: *** Deleting file 'megaco_per_media_gateway_control_prev3a.erl'
make[5]: Leaving directory '/<<BUILDDIR>>/erlang-19.3.1+dfsg/lib/megaco/src/binary'
/<<BUILDDIR>>/erlang-19.3.1+dfsg/make/otp_subdir.mk:29: recipe for target 'opt' failed
make[4]: *** [opt] Error 2
make[4]: Leaving directory '/<<BUILDDIR>>/erlang-19.3.1+dfsg/lib/megaco/src'
/<<BUILDDIR>>/erlang-19.3.1+dfsg/make/otp_subdir.mk:29: recipe for target 'opt' failed
make[3]: *** [opt] Error 2
make[3]: Leaving directory '/<<BUILDDIR>>/erlang-19.3.1+dfsg/lib/megaco'

The issue is 100% reproducible in a manual build:

root@pacman:/builg/lib/megaco/src/binary# /lib/megaco/src/binary# erlc -W  -bper +noobj +legacy_erlang_types megaco_per_mtrol_prev3a.set.asnbper +noobj +legacy_erlang_types megaco_per_m
Illegal instruction (core dumped)
root@pacman:/build/erlang/erlang-20.0+dfsg/lib/megaco/src/binary#

Tarball with build root can be found here: https://people.debian.org/~glaubitz/erlang.tgz

To reproduce:

# apt build-dep --arch-only erlang
# mkdir /build
# mv erlang.tgz /build
# cd /build
# tar xf erlang.tgz
# export PATH=$PATH:/build/erlang/erlang-20.0+dfsg/bin/m68k-unknown-linux-gnu:/build/erlang/erlang-20.0+dfsg/bootstrap/bin
# cd erlang-20.0+dfsg/lib/megaco/src/binary/
# erlc -W  -bper +noobj +legacy_erlang_types megaco_per_media_gateway_control_prev3a.set.asn
Illegal instruction (core dumped)
#
vivier commented 7 years ago

The missing instruction is flog2x, I'm going to add it.

IN: 0xf6784480: linkw %fp,#0 0xf6784484: fmoved %fp@(8),%fp0 0xf678448a: flog2x %fp0,%fp0 Disassembler disagrees with translator over instruction decoding Please report this to qemu-devel@nongnu.org

qemu: uncaught target signal 4 (Illegal instruction) - core dumped

glaubitz commented 7 years ago

The missing instruction is flog2x, I'm going to add it.

Great, thank you!

glaubitz commented 7 years ago

This has been resolved now. Erlang builds now fine on m68k.

glaubitz commented 6 years ago

Erlang has been building fine for a while now:

https://buildd.debian.org/status/logs.php?pkg=erlang&arch=m68k

Thus, closing.