timdoug's tidbits


2023-02-25

Compile QEMU on macOS without tons of dependencies, M2 / Ventura edition

A gentle update to the 2021 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.74/glib-2.74.6.tar.xz
(qemu_install_venv) $ tar xf glib-2.74.6.tar.xz && cd glib-2.74.6
(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-7.2.0.tar.xz
(qemu_install_venv) $ tar xf qemu-7.2.0.tar.xz && cd qemu-7.2.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/)'
qemu-system-x86_64:
	${QEMU_INSTALL}/lib/libgio-2.0.0.dylib (compatibility version 7401.0.0, current version 7401.6.0)
	${QEMU_INSTALL}/lib/libglib-2.0.0.dylib (compatibility version 7401.0.0, current version 7401.6.0)
	${QEMU_INSTALL}/lib/libgmodule-2.0.0.dylib (compatibility version 7401.0.0, current version 7401.6.0)
	${QEMU_INSTALL}/lib/libgobject-2.0.0.dylib (compatibility version 7401.0.0, current version 7401.6.0)
	/opt/homebrew/opt/libpng/lib/libpng16.16.dylib (compatibility version 56.0.0, current version 56.0.0)
	/opt/homebrew/opt/libusb/lib/libusb-1.0.0.dylib (compatibility version 4.0.0, current version 4.0.0)
	/opt/homebrew/opt/pixman/lib/libpixman-1.0.dylib (compatibility version 43.0.0, current version 43.2.0)
	/opt/homebrew/opt/sdl2/lib/libSDL2-2.0.0.dylib (compatibility version 2601.0.0, current version 2601.3.0)
$

[/osx] permanent link


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