timdoug's tidbits


2020-08-30

Compile QEMU on macOS without tons of dependencies

brew install qemu unnecessarily brings in Python, a DNS server, two TLS libraries, ....

Instead:

$ brew install pkg-config pixman
$ python3 -m venv qemu_install_venv
$ source qemu_install_venv/bin/activate
(qemu_install_venv) $ pip install ninja meson
(qemu_install_venv) $ curl -LO https://download.gnome.org/sources/glib/2.65/glib-2.65.2.tar.xz
(qemu_install_venv) $ tar xf glib-2.65.2.tar.xz && cd glib-2.65.2
(qemu_install_venv) $ meson --prefix=/path/to/qemu/install -Dinternal_pcre=true _build
(qemu_install_venv) $ ninja -C _build
(qemu_install_venv) $ ninja -C _build install
$ cd .. && curl -LO https://download.qemu.org/qemu-5.1.0.tar.xz
$ tar xf qemu-5.1.0.tar.xz && cd qemu-5.1.0
$ PKG_CONFIG_PATH=/path/to/qemu/install/lib/pkgconfig/ ./configure --enable-hvf --enable-cocoa --target-list=x86_64-softmmu --prefix=/path/to/qemu/install
$ PKG_CONFIG_PATH=/path/to/qemu/install/lib/pkgconfig/ make install
Ahh, much better:
$ otool -L /path/to/qemu/install/bin/qemu-system-x86_64 | grep -vE '^\W+(/usr/lib/|/System/Library/)'
/path/to/qemu/install/bin/qemu-system-x86_64:
	/path/to/qemu/install/lib/libgio-2.0.0.dylib (compatibility version 6503.0.0, current version 6503.0.0)
	/path/to/qemu/install/lib/libgobject-2.0.0.dylib (compatibility version 6503.0.0, current version 6503.0.0)
	/path/to/qemu/install/lib/libglib-2.0.0.dylib (compatibility version 6503.0.0, current version 6503.0.0)
	/path/to/qemu/install/lib/libintl.dylib (compatibility version 0.0.0, current version 0.0.0)
	/path/to/homebrew/opt/pixman/lib/libpixman-1.0.dylib (compatibility version 41.0.0, current version 41.0.0)
	/path/to/qemu/install/lib/libgthread-2.0.0.dylib (compatibility version 6503.0.0, current version 6503.0.0)
$

[/osx] permanent link


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