Opened 4 years ago

Closed 3 years ago

#62116 closed defect (fixed)

Unable to install QEMU on Apple M1 Silicon

Reported by: Silve2611 Owned by: raimue (Rainer Müller)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: arm64 Cc: anahata0108, FaradayLight (Faraday Light), mascguy (Christopher Nielsen)
Port: qemu

Description

I am unable to install QEMU on the new Apple M1 Silicon.

I am getting a Fatal error:

:info:build In file included from ../qemu-5.2.0/target/i386/cpu.h:26:
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0/include/exec/cpu-defs.h:29:10: fatal error: 'tcg-target.h' file not found
:info:build #include "tcg-target.h"
:info:build          ^~~~~~~~~~~~~~
:info:build 1 error generated.
:info:build [742/2317] /usr/bin/clang -Ilibqemu-i386-softmmu.fa.p -I. -I../qemu-5.2.0 -Itarget/i386 -I../qemu-5.2.0/target/i386 -Iqapi -Itrace -Iui -Iui/shader -I/opt/local/include/pixman-1 -I/opt/local/include -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -std=gnu99 -O2 -g -DOS_OBJECT_USE_OBJC=0 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0/tcg/unknown -iquote . -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0 -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0/accel/tcg -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0/include -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0/disas/libvixl -D_REENTRANT -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -arch arm64 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -DNEED_CPU_H '-DCONFIG_TARGET="i386-softmmu-config-target.h"' '-DCONFIG_DEVICES="i386-softmmu-config-devices.h"' -MD -MQ libqemu-i386-softmmu.fa.p/hw_i386_pc_piix.c.o -MF libqemu-i386-softmmu.fa.p/hw_i386_pc_piix.c.o.d -o libqemu-i386-softmmu.fa.p/hw_i386_pc_piix.c.o -c ../qemu-5.2.0/hw/i386/pc_piix.c
:info:build FAILED: libqemu-i386-softmmu.fa.p/hw_i386_pc_piix.c.o 
:info:build /usr/bin/clang -Ilibqemu-i386-softmmu.fa.p -I. -I../qemu-5.2.0 -Itarget/i386 -I../qemu-5.2.0/target/i386 -Iqapi -Itrace -Iui -Iui/shader -I/opt/local/include/pixman-1 -I/opt/local/include -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -std=gnu99 -O2 -g -DOS_OBJECT_USE_OBJC=0 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0/tcg/unknown -iquote . -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0 -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0/accel/tcg -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0/include -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0/disas/libvixl -D_REENTRANT -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -arch arm64 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -DNEED_CPU_H '-DCONFIG_TARGET="i386-softmmu-config-target.h"' '-DCONFIG_DEVICES="i386-softmmu-config-devices.h"' -MD -MQ libqemu-i386-softmmu.fa.p/hw_i386_pc_piix.c.o -MF libqemu-i386-softmmu.fa.p/hw_i386_pc_piix.c.o.d -o libqemu-i386-softmmu.fa.p/hw_i386_pc_piix.c.o -c ../qemu-5.2.0/hw/i386/pc_piix.c
:info:build In file included from ../qemu-5.2.0/hw/i386/pc_piix.c:43:
:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0/include/sysemu/kvm.h:254:
:info:build In file included from ../qemu-5.2.0/target/i386/cpu.h:26:
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0/include/exec/cpu-defs.h:29:10: fatal error: 'tcg-target.h' file not found
:info:build #include "tcg-target.h"
:info:build          ^~~~~~~~~~~~~~
:info:build 1 error generated.
:info:build [743/2317] /usr/bin/clang -Ilibblockdev.fa.p -I. -I../qemu-5.2.0 -Iqapi -Itrace -Iui -Iui/shader -I/opt/local/include -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -std=gnu99 -O2 -g -DOS_OBJECT_USE_OBJC=0 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0/tcg/unknown -iquote . -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0 -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0/accel/tcg -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0/include -iquote /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/qemu-5.2.0/disas/libvixl -D_REENTRANT -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -arch arm64 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -MD -MQ libblockdev.fa.p/nbd_server.c.o -MF libblockdev.fa.p/nbd_server.c.o.d -o libblockdev.fa.p/nbd_server.c.o -c ../qemu-5.2.0/nbd/server.c
:info:build ninja: build stopped: subcommand failed.
:info:build make: *** [run-ninja] Error 1
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/build'
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/work/build" && /usr/bin/make -j8 -w all V=1 
:info:build Exit code: 2
:error:build Failed to build qemu: command execution failed
:debug:build Error code: CHILDSTATUS 831 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec build"
:debug:build     (procedure "portbuild::build_main" line 8)
:debug:build     invoked from within
:debug:build "$procedure $targetname"
:error:build See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_emulators_qemu/qemu/main.log for details.

It seem that he is missing the header file tcg-target.h but I do not know where to find it. It seems that Tiny Code Generator (TCQ) is part of the project.

Change History (9)

comment:1 Changed 4 years ago by jmroot (Joshua Root)

Keywords: arm64 added; apple silicon qemu removed
Owner: set to raimue
Port: qemu added
Status: newassigned

comment:2 Changed 4 years ago by trodemaster (Blake Garner)

I have been looking at this as well. Building qemu 5.2 from source on Apple Silicon works as expected outside of mac ports. When attempting to build qemu via macports on Apple silicon the tcg-target.h files are present but thrown the not found error above. Seems like the include path could be wrong because of the different arch?

/opt/local/var/macports/build/_opt_mports_macports-ports_emulators_qemu/qemu/work/qemu-5.2.0/tcg/aarch64/tcg-target.h
/opt/local/var/macports/build/_opt_mports_macports-ports_emulators_qemu/qemu/work/qemu-5.2.0/tcg/arm/tcg-target.h
/opt/local/var/macports/build/_opt_mports_macports-ports_emulators_qemu/qemu/work/qemu-5.2.0/tcg/i386/tcg-target.h
/opt/local/var/macports/build/_opt_mports_macports-ports_emulators_qemu/qemu/work/qemu-5.2.0/tcg/mips/tcg-target.h
/opt/local/var/macports/build/_opt_mports_macports-ports_emulators_qemu/qemu/work/qemu-5.2.0/tcg/ppc/tcg-target.h
/opt/local/var/macports/build/_opt_mports_macports-ports_emulators_qemu/qemu/work/qemu-5.2.0/tcg/riscv/tcg-target.h
/opt/local/var/macports/build/_opt_mports_macports-ports_emulators_qemu/qemu/work/qemu-5.2.0/tcg/s390/tcg-target.h
/opt/local/var/macports/build/_opt_mports_macports-ports_emulators_qemu/qemu/work/qemu-5.2.0/tcg/sparc/tcg-target.h
/opt/local/var/macports/build/_opt_mports_macports-ports_emulators_qemu/qemu/work/qemu-5.2.0/tcg/tci/tcg-target.h

comment:3 Changed 4 years ago by programmingkidx

I tried building emu-system-i386 and emu-system-x86_64 from source. It failed because the x86_64 version is made. This can't be linked to arm64 libraries. qemu-system-ppc did build as arm64, but it failed to launch with this error message: "Could not allocate dynamic translator buffer". I used the QEMU 5.2 source and the latest git repo version.

comment:4 Changed 4 years ago by anahata0108

Cc: anahata0108 added

comment:5 Changed 4 years ago by raimue (Rainer Müller)

Related pull request for the qemu port: https://github.com/macports/macports-ports/pull/9955

comment:6 Changed 3 years ago by FaradayLight (Faraday Light)

Cc: FaradayLight added

comment:7 Changed 3 years ago by FaradayLight (Faraday Light)

The more recent build of the package - qemu-6.1.0_0 - will build on x86_64 - see: #63525

comment:8 Changed 3 years ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:9 Changed 3 years ago by raimue (Rainer Müller)

Resolution: fixed
Status: assignedclosed

This should no longer be a problem as of qemu @6.2.0.

Note: See TracTickets for help on using tickets.