[OE-core] [PATCH] perf: synchronize unistd.h between libc-headers and perf source

Bruce Ashfield bruce.ashfield at gmail.com
Fri Mar 8 13:31:59 UTC 2019


On Fri, Mar 8, 2019 at 1:38 AM Martin Jansa <martin.jansa at gmail.com> wrote:
>
> Why not use STAGING_INCDIR ?

No reason. Except that it was almost 2am and I was chasing this for 6
hours (and of course, a one line fix!!).

I'll do a v2 with STAGING_INCDIR, I just built up that path from
components that I knew and knew would
fix it, but the incdir variable is better for future proofing.

I'm doing a build test now and will resend when it passes.

Bruce

>
> On Fri, Mar 8, 2019 at 7:36 AM <bruce.ashfield at gmail.com> wrote:
>>
>> From: Bruce Ashfield <bruce.ashfield at gmail.com>
>>
>> During the build for some architectures, perf generates a program
>> which executes on the host to dump the syscall table.
>>
>> The generation of that program uses the cross compiler + sysroot
>> to expand unistd.h. As such, we are getting the contents of that
>> file from linux-libc-headers.
>>
>> The compilation of that generated program uses the host compiler
>> and a restricted include path to the perf source code. In the
>> perf source there is a captured unistd.h, as such it will be used
>> when compiling the host executable. The perf source code is copied
>> from the kernel version that is being built .. so we have a
>> mismatch between the generation and the compilation of the host
>> program.
>>
>> Normally this mismatch is fine, but if the libc-headers are
>> newer than the kernel, we'll have syscalls (and their syscall
>> numbers) that are not defined in the perf source code. This
>> leads to a compiler error and a cascading failure of the perf
>> build due to a missing generated file.
>>
>> To fix this, we can copy unistd.h from the recipe-sysroot
>> into the perf source code and they will always be in sync.
>>
>> Signed-off-by: Bruce Ashfield <bruce.ashfield at gmail.com>
>> ---
>>
>> Richard,
>>
>> This should fix the perf build failure with 4.19 and the 5.0
>> libc-headers.
>>
>> It also builds fine in the other combinations I was able to
>> test. No sense sitting on this, it can use some AB combinations
>> for more testing.
>>
>> Bruce
>>
>>  meta/recipes-kernel/perf/perf.bb | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
>> index 9120766858..2f85006ee1 100644
>> --- a/meta/recipes-kernel/perf/perf.bb
>> +++ b/meta/recipes-kernel/perf/perf.bb
>> @@ -235,6 +235,9 @@ do_configure_prepend () {
>>      for s in `find ${S}/tools/perf/scripts/python/ -name '*.py'`; do
>>          sed -i 's,/usr/bin/python2,/usr/bin/env python,' "${s}"
>>      done
>> +
>> +    # cp from the sysroot unistd.h to the perf unistd.h
>> +    cp ${RECIPE_SYSROOT}/usr/include/asm-generic/unistd.h ${S}/tools/include/uapi/asm-generic/unistd.h
>>  }
>>
>>  python do_package_prepend() {
>> --
>> 2.19.1
>>
>> --
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core at lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core



-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


More information about the Openembedded-core mailing list