perf: synchronize unistd.h between libc-headers and perf source
PATCH 1/1 perf: synchronize unistd.h between libc-headers and perf source
From: Bruce Ashfield <[email protected]>
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.
---
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(+)
meta/recipes-kernel/perf/perf.bb +3 -0
@@ -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() {
Signature · 1 line
2.19.1
Why not use STAGING_INCDIR ?
Quoted 68 lines · On Fri, Mar 8, 2019 at 7:36 AM <[email protected]> wrote:
From: Bruce Ashfield <[email protected]>
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.hfrom the recipe-sysroot into the perf source code and they will always be in sync.Signed-off-by Bruce Ashfield <[email protected]>---
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(+)meta/recipes-kernel/perf/ renamed from meta/recipes-kernel/perf/perf.bb +0
-0perf.bb
index 9120766858..2f85006ee1 100644meta/recipes-kernel/perf/perf.bb +3
-0@@ -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
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Quoted 2 lines · Martin Jansa
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
Quoted 68 lines · On Fri, Mar 8, 2019 at 7:36 AM <[email protected]> wrote:
Quoted 66 lines
From: Bruce Ashfield <[email protected]>
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.hfrom the recipe-sysroot into the perf source code and they will always be in sync.Signed-off-by Bruce Ashfield <[email protected]>---
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(+)meta/recipes-kernel/perf/perf.bb +3
-1@@ -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
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II