{"id":1136,"date":"2025-08-16T15:09:34","date_gmt":"2025-08-16T13:09:34","guid":{"rendered":"https:\/\/pcmacb.de\/?page_id=1136"},"modified":"2025-10-12T12:41:03","modified_gmt":"2025-10-12T10:41:03","slug":"qemu","status":"publish","type":"page","link":"https:\/\/pcmacb.de\/?page_id=1136","title":{"rendered":"QEMU"},"content":{"rendered":"\n<p>Umgebung f\u00fcr virtuelle Maschinen<\/p>\n\n\n\n<p>Abh\u00e4ngigkeiten vorbereiten<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>brew update\nbrew install pkg-config glib pixman libpng jpeg spice-protocol spice-gtk gnutls ninja meson gtk+3 libusb sdl2 gnutls libslirp llvm<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">Compile QEMU with SPICE<\/h1>\n\n\n\n<p>Download the latest QEMU source (e.g., 9.0.2 or newer; check <a href=\"https:\/\/www.qemu.org\/download\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.qemu.org\/download\/<\/a> for the current version):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -O https:\/\/download.qemu.org\/qemu-10.0.3.tar.xz<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>tar -xJf qemu-10.0.3.tar.xz\ncd qemu-10.0.3<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>brew update\nbrew install pkg-config glib pixman libpng jpeg spice-protocol spice-gtk gnutls ninja meson gtk+3 libusb sdl2 gnutls libslirp llvm<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\/usr\/local\/bin\/python3 -m venv ~\/qemu-venv\nsource ~\/qemu-venv\/bin\/activate\npip install distlib<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>pip show distlib<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>source ~\/qemu-venv\/bin\/activate<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>which python3<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\/usr\/local\/opt\/llvm\/bin\/clang --version<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>export PATH=\"\/usr\/local\/opt\/llvm\/bin:$PATH\"\nexport CC=\"\/usr\/local\/opt\/llvm\/bin\/clang\"\nexport CXX=\"\/usr\/local\/opt\/llvm\/bin\/clang++\"<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>which clang<\/code><\/pre>\n\n\n\n<p>Should show \/usr\/local\/opt\/llvm\/bin\/clang<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo 'export PATH=\"\/usr\/local\/opt\/llvm\/bin:$PATH\"' &gt;&gt; ~\/.zshrc\necho 'export CC=\"\/usr\/local\/opt\/llvm\/bin\/clang\"' &gt;&gt; ~\/.zshrc\necho 'export CXX=\"\/usr\/local\/opt\/llvm\/bin\/clang++\"' &gt;&gt; ~\/.zshrc\nsource ~\/.zshrc<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>export PKG_CONFIG_PATH=\"\/usr\/local\/opt\/openssl@3\/lib\/pkgconfig:\/usr\/local\/lib\/pkgconfig:$PKG_CONFIG_PATH\"\nexport LDFLAGS=\"-L\/usr\/local\/opt\/openssl@3\/lib -L\/usr\/local\/lib\"\nexport CPPFLAGS=\"-I\/usr\/local\/opt\/openssl@3\/include -I\/usr\/local\/include\"<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>source ~\/qemu-venv\/bin\/activate<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Configure<\/strong> with SPICE and other options (this enables SPICE via the installed spice-server, targets x86_64 for your host\/guest, and includes macOS-friendly flags):<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/configure --enable-spice --enable-usb-redir --enable-coreaudio --enable-cocoa --enable-opengl --enable-sdl --enable-gnutls --enable-hvf --enable-virtfs --enable-tpm --enable-libusb --enable-avx2 --enable-gtk --enable-slirp --target-list=x86_64-softmmu --prefix=\/usr\/local --cc=\/usr\/local\/opt\/llvm\/bin\/clang --cxx=\/usr\/local\/opt\/llvm\/bin\/clang++ --extra-cxxflags=\"-std=c++17\"<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If configure complains about missing SPICE, verify pkg-config &#8211;exists spice-server returns nothing (success) or check paths.<\/li>\n\n\n\n<li>Add &#8211;disable-capstone if you get errors about it (optional dependency).<\/li>\n<\/ul>\n\n\n\n<p>Check output for:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>spice support: yes<\/code><\/pre>\n\n\n\n<p>to be sure:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export PKG_CONFIG_PATH=\"\/usr\/local\/opt\/openssl@3\/lib\/pkgconfig:$PKG_CONFIG_PATH\"<br>export LDFLAGS=\"-L\/usr\/local\/opt\/openssl@3\/lib\"<br>export CPPFLAGS=\"-I\/usr\/local\/opt\/openssl@3\/include\"<\/code><\/pre>\n\n\n\n<p>Build and install:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make -j$(sysctl -n hw.logicalcpu)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo make install<\/code><\/pre>\n\n\n\n<p>Verify SPICE support:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>qemu-system-x86_64 --version  # Should show your compiled version\nqemu-system-x86_64 -display help  # Look for \"spice\" or \"spice-app\" in the list\nqemu-system-x86_64 -display spice-app  # If no error, SPICE is enabled<\/code><\/pre>\n\n\n\n<p>VM starten (muss vorher da sein oder installiert werden \ud83d\ude09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>qemu-system-x86_64 \\\n  -m 4G \\  # Allocate 4GB RAM (half your host's for safety)\n  -smp 4 \\  # 4 CPU cores\n  -cpu host \\  # Pass through host CPU for better perf\n  -accel hvf \\  # macOS hardware acceleration\n  -drive file=opensuse.qcow2,format=qcow2 \\\n  -cdrom \/path\/to\/OpenSUSE-Leap-15.6-DVD-x86_64.iso \\\n  -vga qxl \\\n  -spice port=5900,addr=127.0.0.1,disable-ticketing=on \\\n  -device virtio-serial-pci \\\n  -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 \\\n  -chardev spicevmc,id=spicechannel0,name=vdagent \\\n  -usb -device usb-tablet  # Better mouse input<\/code><\/pre>\n\n\n\n<p>This starts SPICE on localhost port 5900. Connect to the VM display in another Terminal tab:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>spicy -h 127.0.0.1 -p 5900<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>zypper install spice-vdagent qemu-guest-agent\nsystemctl enable --now spice-vdagentd\nsystemctl enable --now qemu-guest-agent<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Troubleshooting<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>SPICE slow\/refresh issues<\/strong>: SPICE on macOS can be laggy; try -vga virtio instead of qxl for better perf, or use -display cocoa as fallback (no SPICE).<\/li>\n\n\n\n<li><strong>Errors during compile<\/strong>: Paste the exact error for help. Ensure Xcode Command Line Tools are installed (xcode-select &#8211;install).<\/li>\n\n\n\n<li><strong>No sound\/graphics<\/strong>: Add -soundhw hda for audio. For full-screen\/resolution auto-adjust, ensure spice-vdagent is running in guest.<\/li>\n\n\n\n<li><strong>Host resources<\/strong>: With 16GB RAM, limit VM to 8GB max to avoid host slowdowns.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">UNINSTALL<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>cd ~\/.src\/qemu-10.0.3\nsudo make uninstall<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo rm -rf \/usr\/local\/bin\/qemu*\nsudo rm -rf \/usr\/local\/libexec\/qemu*\nsudo rm -rf \/usr\/local\/share\/qemu*\nsudo rm -rf \/usr\/local\/lib\/qemu*\nsudo rm -rf \/usr\/local\/include\/qemu*<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Umgebung f\u00fcr virtuelle Maschinen Abh\u00e4ngigkeiten vorbereiten Compile QEMU with SPICE Download the latest QEMU source (e.g., 9.0.2 or newer; check https:\/\/www.qemu.org\/download\/ for the current version): Should show \/usr\/local\/opt\/llvm\/bin\/clang Check output for: to be sure: Build and install: Verify SPICE support: <a class=\"more-link\" href=\"https:\/\/pcmacb.de\/?page_id=1136\">weiterlesen&#8230;<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"class_list":["post-1136","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/pcmacb.de\/index.php?rest_route=\/wp\/v2\/pages\/1136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pcmacb.de\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/pcmacb.de\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/pcmacb.de\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/pcmacb.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1136"}],"version-history":[{"count":34,"href":"https:\/\/pcmacb.de\/index.php?rest_route=\/wp\/v2\/pages\/1136\/revisions"}],"predecessor-version":[{"id":1404,"href":"https:\/\/pcmacb.de\/index.php?rest_route=\/wp\/v2\/pages\/1136\/revisions\/1404"}],"wp:attachment":[{"href":"https:\/\/pcmacb.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}