Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 647570 - app-emulation/qemu-2.11.0 should have USE=capstone
Summary: app-emulation/qemu-2.11.0 should have USE=capstone
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo QEMU Project
Depends on:
Reported: 2018-02-13 22:24 UTC by RB
Modified: 2018-03-18 20:02 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---

Patch fixing capstone.h path (0001-capstone-path-fix.patch,264 bytes, patch)
2018-02-17 19:29 UTC, Andrej Rode
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description RB 2018-02-13 22:24:17 UTC
In upgrading app-emulation/qemu-2.10.1-r1 to 2.11.0 on a system with dev-util/radare2 (and therefore dev-libs/capstone), I kept encountering a build error complaining about missing capstone.h:

x86_64-pc-linux-gnu-gcc -I/var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0/softmmu-build/. -I. -I/var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0/tcg -I/var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0/tcg/i386 -I/var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0/linux-headers -I/var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0/softmmu-build/linux-headers -I. -I/var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0 -I/var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0/accel/tcg -I/var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0/include -I/usr/include/pixman-1  -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DNCURSES_WIDECHAR -D_GNU_SOURCE -I/usr/include/ncursesw -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv  -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong  -I/usr/include/libpng16   -I../linux-headers -I.. -I/var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0/target/i386 -DNEED_CPU_H -I/var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0/include -MMD -MP -MT disas.o -MF ./disas.d -Os -pipe -march=native  -c -o disas.o /var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0/disas.c
In file included from /var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0/disas.c:9:0:
/var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0/include/disas/capstone.h:6:10: fatal error: capstone.h: No such file or directory
 #include <capstone.h>
compilation terminated.
make[1]: *** [/var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0/rules.mak:66: disas.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0/softmmu-build/x86_64-softmmu'
make: *** [Makefile:383: subdir-x86_64-softmmu] Error 2
 * ERROR: app-emulation/qemu-2.11.0::gentoo failed (compile phase):
 *   emake failed
 * If you need support, post the output of `emerge --info '=app-emulation/qemu-2.11.0::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=app-emulation/qemu-2.11.0::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/app-emulation/qemu-2.11.0/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/app-emulation/qemu-2.11.0/temp/environment'.
 * Working directory: '/var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0/softmmu-build'
 * S: '/var/tmp/portage/app-emulation/qemu-2.11.0/work/qemu-2.11.0'

I was able to bypass the bug by uninstalling capstone, which suggests qemu is picking up an automagic dependency on system-capstone.  I don't have the opportunity to dig into qemu to see if there's an easy fix, but disabling USE=system-capstone on radare2 does at least sidestep the issue.
Comment 1 Andrej Rode 2018-02-17 19:29:37 UTC
Created attachment 519902 [details, diff]
Patch fixing capstone.h path
Comment 2 Rick Farina (Zero_Chaos) gentoo-dev 2018-02-17 19:30:20 UTC
I have modified the current qemu ebuilds to simply disable capstone as it clearly wasn't working.  Maintainers please add support for USE=capstone or close this bug refusing, either way, probably look at my commit and edit as you see fit.  Thanks!
Comment 3 Andrej Rode 2018-02-17 19:31:41 UTC
Snap, my comment disappeared. I've attached a patch before which fixes the include path. Not sure if that's the right way or patching the build system to add `capstone/` to the include path.
Comment 4 Rick Farina (Zero_Chaos) gentoo-dev 2018-02-17 19:32:14 UTC
thanks for the patch.  I'll not contaminate the qemu ebuild futher but this looks sane to add the patch at the use flag.
Comment 5 RB 2018-03-09 16:03:41 UTC
Note that the latest release (app-emulation/qemu-2.11.1) doesn't have Rick's --disable-capstone change, it appears to have been released after his change.
Comment 6 Larry the Git Cow gentoo-dev 2018-03-18 20:02:01 UTC
The bug has been closed via the following commit(s):

commit 46d903c2665d2910a22d78656c5f7bafdf702135
Author:     Matthias Maier <>
AuthorDate: 2018-03-18 19:08:44 +0000
Commit:     Matthias Maier <>
CommitDate: 2018-03-18 20:01:49 +0000

    app-emulation/qemu: 2.11.1: New binary blob pinning, CVE patches, maintenance
     * new binary blobs pinning
       keyword ebuild
     * fix include path for capstone, bug 647570
     * add USE=capstone support, bug 647570
     * apply patch for CVE-2018-7550
    Package-Manager: Portage-2.3.24, Repoman-2.3.6

 app-emulation/qemu/Manifest                                 |  1 +
 .../qemu/files/qemu-2.11.1-capstone_include_path.patch      | 11 +++++++++++
 app-emulation/qemu/metadata.xml                             |  1 +
 .../qemu/{qemu-2.11.1-r50.ebuild => qemu-2.11.1-r51.ebuild} | 13 ++++++-------
 4 files changed, 19 insertions(+), 7 deletions(-)

Additionally, it has been referenced in the following commit(s):

commit 927222f7ee40d2289d759ea2bceee1cc68d81a32
Author:     Matthias Maier <>
AuthorDate: 2018-03-18 19:33:04 +0000
Commit:     Matthias Maier <>
CommitDate: 2018-03-18 20:01:50 +0000

    app-emulation/qemu: 2.11.1: apply security patches
         * disable capstone
         * apply patch for CVE-2018-7550
    Package-Manager: Portage-2.3.24, Repoman-2.3.6

 app-emulation/qemu/qemu-2.11.1-r1.ebuild | 805 +++++++++++++++++++++++++++++++
 1 file changed, 805 insertions(+)}