timdoug's tidbits


2021-09-06

Compile QEMU on macOS without tons of dependencies, M1 / Big Sur edition

An update to the 2020 documentation.

$ export QEMU_INSTALL=/path/to/qemu/install
$ brew install pkg-config pixman pcre
$ python3 -m venv qemu_install_venv
$ source qemu_install_venv/bin/activate
(qemu_install_venv) $ pip install --upgrade pip setuptools wheel
(qemu_install_venv) $ pip install ninja meson
(qemu_install_venv) $ curl -LO https://download.gnome.org/sources/glib/2.69/glib-2.69.2.tar.xz
(qemu_install_venv) $ tar xf glib-2.69.2.tar.xz && cd glib-2.69.2
(qemu_install_venv) $ meson --prefix=${QEMU_INSTALL} _build
(qemu_install_venv) $ ninja -C _build
(qemu_install_venv) $ ninja -C _build install
(qemu_install_venv) $ cd .. && curl -LO https://download.qemu.org/qemu-6.1.0.tar.xz
(qemu_install_venv) $ tar xf qemu-6.1.0.tar.xz && cd qemu-6.1.0
(qemu_install_venv) $ PKG_CONFIG_PATH=${QEMU_INSTALL}/lib/pkgconfig/ ./configure --enable-hvf --enable-cocoa --target-list=x86_64-softmmu --prefix=${QEMU_INSTALL}
(qemu_install_venv) $ PKG_CONFIG_PATH=${QEMU_INSTALL}/lib/pkgconfig/ make install
Ahh, much better:
$ otool -L ${QEMU_INSTALL}/bin/qemu-system-x86_64 | grep -vE '^\W+(/usr/lib/|/System/Library/)'
/Users/timdoug/qemu_install/bin/qemu-system-x86_64:
	/Users/timdoug/.homebrew/opt/pixman/lib/libpixman-1.0.dylib (compatibility version 41.0.0, current version 41.0.0)
	/Users/timdoug/qemu_install/lib/libgio-2.0.0.dylib (compatibility version 6903.0.0, current version 6903.0.0)
	/Users/timdoug/qemu_install/lib/libgobject-2.0.0.dylib (compatibility version 6903.0.0, current version 6903.0.0)
	/Users/timdoug/qemu_install/lib/libglib-2.0.0.dylib (compatibility version 6903.0.0, current version 6903.0.0)
	/Users/timdoug/qemu_install/lib/libgmodule-2.0.0.dylib (compatibility version 6903.0.0, current version 6903.0.0)
$

[/osx] permanent link


© 2006-24 timdoug | email: "me" at this domain
So necessary