[Slackbuilds-users] qemu and capstone

Luiz Carlos Ramos lramos.prof at yahoo.com.br
Mon Feb 25 10:06:35 UTC 2019


recently I got a problem when building qemu (3.1.0). Basically, the
compilation stops with this message:

/tmp/SBo/qemu-3.1.0/include/disas/capstone.h:6:22: fatal error:
capstone.h: Arquivo ou diretório não encontrado

("Arquivo ou diretório não encontrado": in Portuguese it means "File or
directory not found")

After some research I found that an additional include path should be
added, that is, to /usr/include/capstone.

About the environment: Slackware 14.2 multi-lib with a lot of
slackbuilds installed. capstone is present in this machine.

I could fix this issue changing qemu SlackBuild to have a better control
of the capstone dependency. A variable was created ("CAPSTONE_ENABLE")
which is "no" by default but can be set externally to "yes", allowing
the build with capstone.

I tested both cases in my machine and it worked. Additional tests may be
necessary, that is, building in a machine without capstone.

Below a patch which can be applied to qemu is included.

Many thanks,

Luiz Ramos
lramos.prof at yahoo dot com dot br
São Paulo - Brazil

--- patch start ---------------------------------
diff --git a/system/qemu/README b/system/qemu/README
index 5a93f4648b..cd6b700334 100644
--- a/system/qemu/README
+++ b/system/qemu/README
@@ -34,6 +34,11 @@ users to use extended networking capabilities, do this:
   BRIDGE_HELPER_SETUID=yes ./qemu.SlackBuild
+Build with capstone is disabled by default. To build a version with
+capstone enabled, one should use this command:
+  CAPSTONE_ENABLE=yes ./qemu.SlackBuild
 Don't forget to load the 'kvm-intel' or 'kvm-amd' module (depending on
 your processor) prior to launching qemu-system-ARCH with kvm enabled.
 For older/unmaintained qemu frontends, this build also creates a symlink
diff --git a/system/qemu/qemu.SlackBuild b/system/qemu/qemu.SlackBuild
index 3f8fe1a59b..8be7e06153 100644
--- a/system/qemu/qemu.SlackBuild
+++ b/system/qemu/qemu.SlackBuild
@@ -54,6 +54,7 @@
 # 4.4	17-Feb-2018	version update to 2.11.x release, Spectre/Meltdown mitigation
 # 4.5   03-Jun-2018     version update to 2.12.0 release, note new deps: sdl2, gtk+3
 # 5.0   14-Dec-2018	verion update to 3.1.0 release, note minimum dependency versions on release notes
+# 5.1   24-Feb-2019	added switch to better control dependency on capstone
@@ -63,6 +64,7 @@ TAG=${TAG:-_SBo}
@@ -132,6 +134,11 @@ else
+# To allow compilation with capstone, use CAPSTONE_ENABLE=yes
+with_capstone=$(test "$CAPSTONE_ENABLE" == "yes" \
+	&& echo "--enable-capstone --extra-cflags=-I/usr/include/capstone --extra-cxxflags=-I/usr/include/capstone" \
+	|| echo "--disable-capstone")
 ./configure \
@@ -150,6 +157,7 @@ CXXFLAGS="$SLKCFLAGS" \
   --enable-nettle \
   --audio-drv-list=${AUDIODRIVERS} \
   $with_vnc \
+  $with_capstone \
 # Make these first; otherwise make won't run in parallel.
--- patch end -----------------------------------

More information about the SlackBuilds-users mailing list