[OE-core] Fwd: [PATCH] qemu: Use capstone version included via git submodule

Jon Szymaniak jon.szymaniak.foss at gmail.com
Tue Jun 26 01:52:29 UTC 2018


I'm sorry for the duplicate email Bruce. Resending because I failed to
include the list.

On Mon, Jun 25, 2018 at 3:52 PM, Bruce Ashfield
<bruce.ashfield at gmail.com> wrote:
>
>
> On Mon, Jun 25, 2018 at 1:50 PM, Jon Szymaniak
> <jon.szymaniak.foss at gmail.com> wrote:
>>
>> An optional dependency upon the capstone disassembler was introduced
>> in QEMU v2.11.0-rc0. The necessary version of capstone is included
>> in the QEMU repository as a git submodule.
>>
>> The QEMU configure script uses pkg-config to determine if an
>> installation of capstone already exists on the system, and defaults to
>> this, if found. However, there does not appear to be any capstone
>> version or API compatibility checks.
>>
>> To avoid any potential version conflicts or API incompatibility issues
>> in the future, use the `--enable-capstone=git` argument to force the use
>> of the capstone version included by QEMU as a git submodule.
>
>
> How exactly does that work when the default qemu recipe is a tar.bz2
> download ?

The tar.bz2 fetched by the current recipe actually contains a git
repo, with the capstone submodule already present in this archive.

> We can't have the recipe going out to the 'net and fetching / downloading
> source code .. and looking at the option, that appears to be what it would
> do. Or maybe I'm missing where the code is being fetched into place.

Understood and agreed. I don't *think* it's actually going out and
fetching anything, but I would certainly need to double check this.

Nonetheless, what I've proposed here doesn't seem like the right
approach to pursue anyway...

> This is something that looks like it could be controlled via packageconfig,
> or similar mechanism, versus being hard coded into the configure line.

I had been noticing that the $pkg_config invocation of qemu's
configure script (line 4594) was picking up the bleeding edge version
of capstone installed on my build machine, which I had been actively
hacking on for something unrelated. Ultimately the issues I was
experiencing with this were a case of PEBKAC. However, this new-ish
capstone dependency still struck me as something worth having another
pair of eyes on to avoid future headaches down the road.

The --enable-capstone=git configuration appeared to be the only
exposed option to skip the $pkg_config invocation in 4592-4612 and
still allow lines 4616-4627 to pick up the submodule.

Usually, if one does not have capstone installed on their build
system, this appears to fall back to using the included git submodule.

Reflecting on it further -- what I've proposed here is a gross hack.
Ultimately I just wanted to ensure that the capstone dependency
shipped in the tar.bz2 is always what's used, assuming that's what the
QEMU team tested and deemed adequate.

How would you advise moving forward with a packageconfig solution?
Does it seem like some change is required to prevent the QEMU
configure script from diving into the build hosts pkg-config path, or
is this the desired behavior?

What do you think about instead patching the configure script to just
set the default to capstone=internal?

> Also, the patch is missing your Signed-off-by:
Whoops! Noted, thank you! :)



More information about the Openembedded-core mailing list