* [PATCH] perf: synchronize unistd.h between libc-headers and perf source
@ 2019-03-08 6:35 bruce.ashfield
2019-03-08 6:38 ` Martin Jansa
0 siblings, 1 reply; 3+ messages in thread
From: bruce.ashfield @ 2019-03-08 6:35 UTC (permalink / raw)
To: richard.purdie; +Cc: openembedded-core
From: Bruce Ashfield <bruce.ashfield@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@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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf: synchronize unistd.h between libc-headers and perf source
2019-03-08 6:35 [PATCH] perf: synchronize unistd.h between libc-headers and perf source bruce.ashfield
@ 2019-03-08 6:38 ` Martin Jansa
2019-03-08 13:31 ` Bruce Ashfield
0 siblings, 1 reply; 3+ messages in thread
From: Martin Jansa @ 2019-03-08 6:38 UTC (permalink / raw)
To: Bruce Ashfield; +Cc: Patches and discussions about the oe-core layer
[-- Attachment #1: Type: text/plain, Size: 2575 bytes --]
Why not use STAGING_INCDIR ?
On Fri, Mar 8, 2019 at 7:36 AM <bruce.ashfield@gmail.com> wrote:
> From: Bruce Ashfield <bruce.ashfield@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@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@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
[-- Attachment #2: Type: text/html, Size: 3698 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf: synchronize unistd.h between libc-headers and perf source
2019-03-08 6:38 ` Martin Jansa
@ 2019-03-08 13:31 ` Bruce Ashfield
0 siblings, 0 replies; 3+ messages in thread
From: Bruce Ashfield @ 2019-03-08 13:31 UTC (permalink / raw)
To: Martin Jansa; +Cc: Patches and discussions about the oe-core layer
On Fri, Mar 8, 2019 at 1:38 AM Martin Jansa <martin.jansa@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@gmail.com> wrote:
>>
>> From: Bruce Ashfield <bruce.ashfield@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@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@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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-08 13:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-08 6:35 [PATCH] perf: synchronize unistd.h between libc-headers and perf source bruce.ashfield
2019-03-08 6:38 ` Martin Jansa
2019-03-08 13:31 ` Bruce Ashfield
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox