Message ID | 20250920000821.3374061-1-hongxu.jia@windriver.com |
---|---|
State | Accepted, archived |
Commit | 0a886fcacaab0fbce1306c0f99d482f940a8f705 |
Headers | show |
Series | perf: Fix reproducibility issue | expand |
On Sat Sep 20, 2025 at 2:08 AM CEST, Hongxu Jia wrote: > Perf's build process generates two copies of its internal headers, > one at tools/lib/perf/include/internal and one at libperf/include/internal > with files like core.h. Although the files are identical, the binaries including > them would see them at different paths and have different debuginfo data. [1] > > The reason is the order of include dir `tools/lib/perf/include' and > `libperf/include' is not stable, such as > > $ x86_64-poky-linux-gcc ... \ > -Ipath-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/tools/lib/perf/include \ > -Ipath-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/libperf/include \ > -c -o path-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/libperf/core.o core.c > > $ recipe-sysroot-native/usr/bin/dwarfsrcfiles sources/perf-1.0/libperf/core.o > /usr/src/debug/perf/1.0/tools/lib/perf/core.c > ... > /usr/src/debug/perf/1.0/tools/lib/perf/include/perf/core.h > /usr/src/debug/perf/1.0/tools/lib/perf/include/internal/lib.h > ... > > $ x86_64-poky-linux-gcc ... \ > -Ipath-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/libperf/include \ > -Ipath-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/tools/lib/perf/include \ > -c -o path-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/libperf/core.o core.c > > $ recipe-sysroot-native/usr/bin/dwarfsrcfiles sources/perf-1.0/libperf/core.o > /usr/src/debug/perf/1.0/tools/lib/perf/core.c > ... > /usr/src/debug/perf/1.0/libperf/include/perf/core.h > /usr/src/debug/perf/1.0/libperf/include/internal/lib.h > ... > > This commit explicitly removes `tools/lib/perf/include' to assure only `libperf/include' > is used > > Also enable verbose for compile to trace the detail of build > > [1] https://git.openembedded.org/openembedded-core/commit/?id=0a886fcacaab0fbce1306c0f99d482f940a8f705 > > Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> > --- Hi, Thanks for your patch. I believe this is breaking the perf build in various configurations: ERROR: Logfile of failure stored in: /srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/perf/1.0/temp/log.do_compile.1058247 ... | x86_64-poky-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -O2 -g -ffile-prefix-map=/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/perf/1.0/sources/perf-1.0=/usr/src/debug/perf/1.0 -ffile-prefix-map=/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/perf/1.0/sources/perf-1.0=/usr/src/debug/perf/1.0 -ffile-prefix-map=/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/perf/1.0/recipe-sysroot= -ffile-prefix-map=/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/perf/1.0/recipe-sysroot-native= -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/perf/1.0/recipe-sysroot -Wp,-MD,/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/perf/1.0/sources/perf-1.0/libperf/.lib.o.d -Wp,-MT,/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/perf/1.0/sources/perf-1.0/libperf/lib.o -ldw -I/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/perf/1.0/sources/perf-1.0 -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -Wno-type-limits -Wstrict-aliasing=3 -Wshadow -Werror -Wall -fPIC -I/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/perf/1.0/sources/perf-1.0/tools/lib/ -I/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/perf/1.0/sources/perf-1.0/tools/include -I/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/perf/1.0/sources/perf-1.0/tools/arch/x86/include/ -I/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/perf/1.0/sources/perf-1.0/tools/arch/x86/include/uapi -I/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/perf/1.0/sources/perf-1.0/tools/include/uapi -fvisibility=hidden -D"BUILD_STR(s)=#s" -c -o /srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/perf/1.0/sources/perf-1.0/libperf/lib.o lib.c | cpumap.c:2:10: fatal error: perf/cpumap.h: No such file or directory | 2 | #include <perf/cpumap.h> | | ^~~~~~~~~~~~~~~ | compilation terminated. ... https://autobuilder.yoctoproject.org/valkyrie/#/builders/4/builds/2431 And lot of other children of https://autobuilder.yoctoproject.org/valkyrie/#/builders/29/builds/2414 Can you have a look a these failures, please? Thanks, Mathieu
diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb index 98dffd1cc9..d0e144aa3f 100644 --- a/meta/recipes-kernel/perf/perf.bb +++ b/meta/recipes-kernel/perf/perf.bb @@ -174,8 +174,8 @@ do_compile() { # There are two copies of internal headers such as: # libperf/include/internal/xyarray.h and tools/lib/perf/include/internal/xyarray.h # For reproducibile binaries, we need to find one copy, hence force libperf to be created first - oe_runmake ${B}/libperf/libperf.a - oe_runmake all + oe_runmake ${B}/libperf/libperf.a V=1 + oe_runmake all V=1 } do_install() { @@ -377,6 +377,10 @@ do_configure:prepend () { sed -i -e "s,#!.*python.*,#!${USRBINPATH}/env python3," ${s} done + if [ -e ${S}/tools/lib/perf/Makefile ]; then + sed -i 's#-I$(srctree)/tools/lib/perf/include##g' ${S}/tools/lib/perf/Makefile + fi + # unistd.h can be out of sync between libc-headers and the captured version in the perf source # so we copy it from the sysroot unistd.h to the perf unistd.h install -D -m0644 ${STAGING_INCDIR}/asm-generic/unistd.h ${S}/tools/include/uapi/asm-generic/unistd.h
Perf's build process generates two copies of its internal headers, one at tools/lib/perf/include/internal and one at libperf/include/internal with files like core.h. Although the files are identical, the binaries including them would see them at different paths and have different debuginfo data. [1] The reason is the order of include dir `tools/lib/perf/include' and `libperf/include' is not stable, such as $ x86_64-poky-linux-gcc ... \ -Ipath-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/tools/lib/perf/include \ -Ipath-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/libperf/include \ -c -o path-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/libperf/core.o core.c $ recipe-sysroot-native/usr/bin/dwarfsrcfiles sources/perf-1.0/libperf/core.o /usr/src/debug/perf/1.0/tools/lib/perf/core.c ... /usr/src/debug/perf/1.0/tools/lib/perf/include/perf/core.h /usr/src/debug/perf/1.0/tools/lib/perf/include/internal/lib.h ... $ x86_64-poky-linux-gcc ... \ -Ipath-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/libperf/include \ -Ipath-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/tools/lib/perf/include \ -c -o path-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/libperf/core.o core.c $ recipe-sysroot-native/usr/bin/dwarfsrcfiles sources/perf-1.0/libperf/core.o /usr/src/debug/perf/1.0/tools/lib/perf/core.c ... /usr/src/debug/perf/1.0/libperf/include/perf/core.h /usr/src/debug/perf/1.0/libperf/include/internal/lib.h ... This commit explicitly removes `tools/lib/perf/include' to assure only `libperf/include' is used Also enable verbose for compile to trace the detail of build [1] https://git.openembedded.org/openembedded-core/commit/?id=0a886fcacaab0fbce1306c0f99d482f940a8f705 Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> --- meta/recipes-kernel/perf/perf.bb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)