Message ID | 20250305105253.3545398-1-martin.jansa@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [meta-oe] uutils-coreutils: use correct variables | expand |
Hi Martin, regarding SELINUX_INCLUDE_DIR, it was definitely needed as I implemented the recipe. During implementation I submitted this patch to selinux-sys ( https://github.com/koutheir/selinux-sys/commit/a6667c404ecc33266f66e9516bb8e30150c41ec2 ) to correctly use this variable, and was getting a build error without this fix because the rust crate selinux-sys was not finding the selinux header-file (specifically, the bindgen tool). However, this was in 2022, and since then there has been this patch in selinux-sys: https://github.com/koutheir/selinux-sys/commit/d3ea4674e18c5240918348bea4ec6248e50516e5 , and it seems that the variable is not needed any more. At least I'm not able to reproduce the build error which I was getting, even with commenting out SELINUX_LIB_DIR and SELINUX_INCLUDE_DIR. The header-file is used for generating rust code from the C header-file using bindgen, so I don't think it makes a difference whether the native version or the target version is used. This is the old build error I was getting: process didn't exit successfully: `/workdir/build/tmp-glibc/work/armv8a-linux/uutils-coreutils/0.0.14.AUTOINC+43a5b8c7d7-r0/build/target/release/build/selinux-sys-0849198bc1fef4a4/build-script-build` (exit status: 101) --- stdout cargo:root=/workdir/build/tmp-glibc/work/armv8a-linux/uutils-coreutils/0.0.14.AUTOINC+43a5b8c7d7-r0/build/target/aarch64-snap-linux/release/build/selinux-sys-d96748d49908959f/out cargo:rerun-if-env-changed=SELINUX_STATIC_aarch64-snap-linux cargo:rerun-if-env-changed=SELINUX_STATIC_aarch64_snap_linux cargo:rerun-if-env-changed=TARGET_SELINUX_STATIC | --- stderr | src/selinux-sys.h:1:10: fatal error: 'selinux/selinux.h' file not found | src/selinux-sys.h:1:10: fatal error: 'selinux/selinux.h' file not found, err: true Étienne On Wed, Mar 5, 2025 at 11:53 AM Martin Jansa <martin.jansa@gmail.com> wrote: > * use STAGING_LIBDIR_NATIVE variable for LIBCLANG_PATH and SELINUX_LIB_DIR > and STAGING_INCDIR_NATIVE variable for SELINUX_INCLUDE_DIR > not sure why it uses native version and not target, but at least use > correct variable > > * hardcoding: > ${WORKDIR}/recipe-sysroot-native${libdir} > is just wrong when there is a better variable > > * This path won't be correct for multilib builds where target ${libdir} > might be e.g. /usr/lib32 while native libdir is /usr/lib. > > * even with meta-selinux added to my builds I don't see any failure > maybe these variables aren't really used? > > * use STAGING_LIBDIR_NATIVE variable which uses correct ${libdir_native} > > OE qemuarm64-multilib@ /OE/build/oe-core $ bitbake-getvar LIBCLANG_PATH > -r uutils-coreutils > # > # $LIBCLANG_PATH [2 operations] > # exported > /OE/build/oe-core/meta-openembedded/meta-oe/recipes-core/uutils-coreutils/ > uutils-coreutils_0.0.29.bb:33 > # [export] "1" > # set > /OE/build/oe-core/meta-openembedded/meta-oe/recipes-core/uutils-coreutils/ > uutils-coreutils_0.0.29.bb:33 > # "${WORKDIR}/recipe-sysroot-native${libdir}" > # pre-expansion value: > # "${WORKDIR}/recipe-sysroot-native${libdir}" > export > LIBCLANG_PATH="/OE/build/oe-core/tmp/work/cortexa57-oe-linux/uutils-coreutils/0.0.29/recipe-sysroot-native/usr/lib64" > > OE qemuarm64-multilib@ /OE/build/oe-core $ bitbake-getvar > STAGING_LIBDIR_NATIVE -r uutils-coreutils > # > # $STAGING_LIBDIR_NATIVE > # set /OE/build/oe-core/openembedded-core/meta/conf/bitbake.conf:425 > # "${STAGING_DIR_NATIVE}${libdir_native}" > > STAGING_LIBDIR_NATIVE="/OE/build/oe-core/tmp/work/cortexa57-oe-linux/uutils-coreutils/0.0.29/recipe-sysroot-native/usr/lib" > > OE qemuarm64-multilib@ /OE/build/oe-core $ bitbake-getvar LIBCLANG_PATH > -r lib32-uutils-coreutils > # > # $LIBCLANG_PATH [2 operations] > # exported > /OE/build/oe-core/meta-openembedded/meta-oe/recipes-core/uutils-coreutils/ > uutils-coreutils_0.0.29.bb:33 > # [export] "1" > # set > /OE/build/oe-core/meta-openembedded/meta-oe/recipes-core/uutils-coreutils/ > uutils-coreutils_0.0.29.bb:33 > # "${WORKDIR}/recipe-sysroot-native${libdir}" > # pre-expansion value: > # "${WORKDIR}/recipe-sysroot-native${libdir}" > export > LIBCLANG_PATH="/OE/build/oe-core/tmp/work/armv7at2-neon-oemllib32-linux-gnueabi/lib32-uutils-coreutils/0.0.29/recipe-sysroot-native/usr/lib32" > > OE qemuarm64-multilib@ /OE/build/oe-core $ bitbake-getvar > STAGING_LIBDIR_NATIVE -r lib32-uutils-coreutils > # > # $STAGING_LIBDIR_NATIVE > # set /OE/build/oe-core/openembedded-core/meta/conf/bitbake.conf:425 > # "${STAGING_DIR_NATIVE}${libdir_native}" > > STAGING_LIBDIR_NATIVE="/OE/build/oe-core/tmp/work/armv7at2-neon-oemllib32-linux-gnueabi/lib32-uutils-coreutils/0.0.29/recipe-sysroot-native/usr/lib" > > Signed-off-by: Martin Jansa <martin.jansa@gmail.com> > --- > .../uutils-coreutils/uutils-coreutils_0.0.29.bb | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/meta-oe/recipes-core/uutils-coreutils/ > uutils-coreutils_0.0.29.bb b/meta-oe/recipes-core/uutils-coreutils/ > uutils-coreutils_0.0.29.bb > index 19d628f735..d0a7532984 100644 > --- a/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb > +++ b/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb > @@ -30,9 +30,9 @@ CARGO_BUILD_FLAGS += > "${@bb.utils.contains('PACKAGECONFIG', 'selinux', '--featur > > DEPENDS += "${@bb.utils.contains('PACKAGECONFIG', 'selinux', > 'clang-native libselinux-native', '', d)}" > > -export LIBCLANG_PATH = "${WORKDIR}/recipe-sysroot-native${libdir}" > -export SELINUX_LIB_DIR = "${WORKDIR}/recipe-sysroot-native${libdir}" > -export SELINUX_INCLUDE_DIR = > "${WORKDIR}/recipe-sysroot-native${includedir}" > +export LIBCLANG_PATH = "${STAGING_LIBDIR_NATIVE}" > +export SELINUX_LIB_DIR = "${STAGING_LIBDIR_NATIVE}" > +export SELINUX_INCLUDE_DIR = "${STAGING_INCDIR_NATIVE}" > > # The code which follows is strongly inspired from the GNU coreutils > bitbake recipe: > > -- > 2.48.1 > >
Hi Etienne, I've tried to remove all 3 variables and it still builds for me fine. I'll send review to do that shortly, please test it in your setup as I don't use uutils-coreutils, I was updating it just to prevent people copy-pasting ${WORKDIR}/recipe-sysroot-native${libdir} like Robert did in thin-provisioning-tools: https://lists.openembedded.org/g/openembedded-devel/message/115743 On Wed, Mar 5, 2025 at 3:28 PM Etienne Cordonnier <ecordonnier@snap.com> wrote: > > Hi Martin, > regarding SELINUX_INCLUDE_DIR, it was definitely needed as I implemented the recipe. During implementation I submitted this patch to selinux-sys ( https://github.com/koutheir/selinux-sys/commit/a6667c404ecc33266f66e9516bb8e30150c41ec2 ) to correctly use this variable, and was getting a build error without this fix because the rust crate selinux-sys was not finding the selinux header-file (specifically, the bindgen tool). > > However, this was in 2022, and since then there has been this patch in selinux-sys: https://github.com/koutheir/selinux-sys/commit/d3ea4674e18c5240918348bea4ec6248e50516e5 , and it seems that the variable is not needed any more. > At least I'm not able to reproduce the build error which I was getting, even with commenting out SELINUX_LIB_DIR and SELINUX_INCLUDE_DIR. > > The header-file is used for generating rust code from the C header-file using bindgen, so I don't think it makes a difference whether the native version or the target version is used. > > This is the old build error I was getting: > process didn't exit successfully: `/workdir/build/tmp-glibc/work/armv8a-linux/uutils-coreutils/0.0.14.AUTOINC+43a5b8c7d7-r0/build/target/release/build/selinux-sys-0849198bc1fef4a4/build-script-build` (exit status: 101) > --- stdout > cargo:root=/workdir/build/tmp-glibc/work/armv8a-linux/uutils-coreutils/0.0.14.AUTOINC+43a5b8c7d7-r0/build/target/aarch64-snap-linux/release/build/selinux-sys-d96748d49908959f/out > cargo:rerun-if-env-changed=SELINUX_STATIC_aarch64-snap-linux > cargo:rerun-if-env-changed=SELINUX_STATIC_aarch64_snap_linux > cargo:rerun-if-env-changed=TARGET_SELINUX_STATIC > > | --- stderr > | src/selinux-sys.h:1:10: fatal error: 'selinux/selinux.h' file not found > | src/selinux-sys.h:1:10: fatal error: 'selinux/selinux.h' file not found, err: true > > Étienne > > > On Wed, Mar 5, 2025 at 11:53 AM Martin Jansa <martin.jansa@gmail.com> wrote: >> >> * use STAGING_LIBDIR_NATIVE variable for LIBCLANG_PATH and SELINUX_LIB_DIR >> and STAGING_INCDIR_NATIVE variable for SELINUX_INCLUDE_DIR >> not sure why it uses native version and not target, but at least use >> correct variable >> >> * hardcoding: >> ${WORKDIR}/recipe-sysroot-native${libdir} >> is just wrong when there is a better variable >> >> * This path won't be correct for multilib builds where target ${libdir} >> might be e.g. /usr/lib32 while native libdir is /usr/lib. >> >> * even with meta-selinux added to my builds I don't see any failure >> maybe these variables aren't really used? >> >> * use STAGING_LIBDIR_NATIVE variable which uses correct ${libdir_native} >> >> OE qemuarm64-multilib@ /OE/build/oe-core $ bitbake-getvar LIBCLANG_PATH -r uutils-coreutils >> # >> # $LIBCLANG_PATH [2 operations] >> # exported /OE/build/oe-core/meta-openembedded/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb:33 >> # [export] "1" >> # set /OE/build/oe-core/meta-openembedded/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb:33 >> # "${WORKDIR}/recipe-sysroot-native${libdir}" >> # pre-expansion value: >> # "${WORKDIR}/recipe-sysroot-native${libdir}" >> export LIBCLANG_PATH="/OE/build/oe-core/tmp/work/cortexa57-oe-linux/uutils-coreutils/0.0.29/recipe-sysroot-native/usr/lib64" >> >> OE qemuarm64-multilib@ /OE/build/oe-core $ bitbake-getvar STAGING_LIBDIR_NATIVE -r uutils-coreutils >> # >> # $STAGING_LIBDIR_NATIVE >> # set /OE/build/oe-core/openembedded-core/meta/conf/bitbake.conf:425 >> # "${STAGING_DIR_NATIVE}${libdir_native}" >> STAGING_LIBDIR_NATIVE="/OE/build/oe-core/tmp/work/cortexa57-oe-linux/uutils-coreutils/0.0.29/recipe-sysroot-native/usr/lib" >> >> OE qemuarm64-multilib@ /OE/build/oe-core $ bitbake-getvar LIBCLANG_PATH -r lib32-uutils-coreutils >> # >> # $LIBCLANG_PATH [2 operations] >> # exported /OE/build/oe-core/meta-openembedded/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb:33 >> # [export] "1" >> # set /OE/build/oe-core/meta-openembedded/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb:33 >> # "${WORKDIR}/recipe-sysroot-native${libdir}" >> # pre-expansion value: >> # "${WORKDIR}/recipe-sysroot-native${libdir}" >> export LIBCLANG_PATH="/OE/build/oe-core/tmp/work/armv7at2-neon-oemllib32-linux-gnueabi/lib32-uutils-coreutils/0.0.29/recipe-sysroot-native/usr/lib32" >> >> OE qemuarm64-multilib@ /OE/build/oe-core $ bitbake-getvar STAGING_LIBDIR_NATIVE -r lib32-uutils-coreutils >> # >> # $STAGING_LIBDIR_NATIVE >> # set /OE/build/oe-core/openembedded-core/meta/conf/bitbake.conf:425 >> # "${STAGING_DIR_NATIVE}${libdir_native}" >> STAGING_LIBDIR_NATIVE="/OE/build/oe-core/tmp/work/armv7at2-neon-oemllib32-linux-gnueabi/lib32-uutils-coreutils/0.0.29/recipe-sysroot-native/usr/lib" >> >> Signed-off-by: Martin Jansa <martin.jansa@gmail.com> >> --- >> .../uutils-coreutils/uutils-coreutils_0.0.29.bb | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb b/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb >> index 19d628f735..d0a7532984 100644 >> --- a/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb >> +++ b/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb >> @@ -30,9 +30,9 @@ CARGO_BUILD_FLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'selinux', '--featur >> >> DEPENDS += "${@bb.utils.contains('PACKAGECONFIG', 'selinux', 'clang-native libselinux-native', '', d)}" >> >> -export LIBCLANG_PATH = "${WORKDIR}/recipe-sysroot-native${libdir}" >> -export SELINUX_LIB_DIR = "${WORKDIR}/recipe-sysroot-native${libdir}" >> -export SELINUX_INCLUDE_DIR = "${WORKDIR}/recipe-sysroot-native${includedir}" >> +export LIBCLANG_PATH = "${STAGING_LIBDIR_NATIVE}" >> +export SELINUX_LIB_DIR = "${STAGING_LIBDIR_NATIVE}" >> +export SELINUX_INCLUDE_DIR = "${STAGING_INCDIR_NATIVE}" >> >> # The code which follows is strongly inspired from the GNU coreutils bitbake recipe: >> >> -- >> 2.48.1 >>
diff --git a/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb b/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb index 19d628f735..d0a7532984 100644 --- a/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb +++ b/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb @@ -30,9 +30,9 @@ CARGO_BUILD_FLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'selinux', '--featur DEPENDS += "${@bb.utils.contains('PACKAGECONFIG', 'selinux', 'clang-native libselinux-native', '', d)}" -export LIBCLANG_PATH = "${WORKDIR}/recipe-sysroot-native${libdir}" -export SELINUX_LIB_DIR = "${WORKDIR}/recipe-sysroot-native${libdir}" -export SELINUX_INCLUDE_DIR = "${WORKDIR}/recipe-sysroot-native${includedir}" +export LIBCLANG_PATH = "${STAGING_LIBDIR_NATIVE}" +export SELINUX_LIB_DIR = "${STAGING_LIBDIR_NATIVE}" +export SELINUX_INCLUDE_DIR = "${STAGING_INCDIR_NATIVE}" # The code which follows is strongly inspired from the GNU coreutils bitbake recipe:
* use STAGING_LIBDIR_NATIVE variable for LIBCLANG_PATH and SELINUX_LIB_DIR and STAGING_INCDIR_NATIVE variable for SELINUX_INCLUDE_DIR not sure why it uses native version and not target, but at least use correct variable * hardcoding: ${WORKDIR}/recipe-sysroot-native${libdir} is just wrong when there is a better variable * This path won't be correct for multilib builds where target ${libdir} might be e.g. /usr/lib32 while native libdir is /usr/lib. * even with meta-selinux added to my builds I don't see any failure maybe these variables aren't really used? * use STAGING_LIBDIR_NATIVE variable which uses correct ${libdir_native} OE qemuarm64-multilib@ /OE/build/oe-core $ bitbake-getvar LIBCLANG_PATH -r uutils-coreutils # # $LIBCLANG_PATH [2 operations] # exported /OE/build/oe-core/meta-openembedded/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb:33 # [export] "1" # set /OE/build/oe-core/meta-openembedded/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb:33 # "${WORKDIR}/recipe-sysroot-native${libdir}" # pre-expansion value: # "${WORKDIR}/recipe-sysroot-native${libdir}" export LIBCLANG_PATH="/OE/build/oe-core/tmp/work/cortexa57-oe-linux/uutils-coreutils/0.0.29/recipe-sysroot-native/usr/lib64" OE qemuarm64-multilib@ /OE/build/oe-core $ bitbake-getvar STAGING_LIBDIR_NATIVE -r uutils-coreutils # # $STAGING_LIBDIR_NATIVE # set /OE/build/oe-core/openembedded-core/meta/conf/bitbake.conf:425 # "${STAGING_DIR_NATIVE}${libdir_native}" STAGING_LIBDIR_NATIVE="/OE/build/oe-core/tmp/work/cortexa57-oe-linux/uutils-coreutils/0.0.29/recipe-sysroot-native/usr/lib" OE qemuarm64-multilib@ /OE/build/oe-core $ bitbake-getvar LIBCLANG_PATH -r lib32-uutils-coreutils # # $LIBCLANG_PATH [2 operations] # exported /OE/build/oe-core/meta-openembedded/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb:33 # [export] "1" # set /OE/build/oe-core/meta-openembedded/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.29.bb:33 # "${WORKDIR}/recipe-sysroot-native${libdir}" # pre-expansion value: # "${WORKDIR}/recipe-sysroot-native${libdir}" export LIBCLANG_PATH="/OE/build/oe-core/tmp/work/armv7at2-neon-oemllib32-linux-gnueabi/lib32-uutils-coreutils/0.0.29/recipe-sysroot-native/usr/lib32" OE qemuarm64-multilib@ /OE/build/oe-core $ bitbake-getvar STAGING_LIBDIR_NATIVE -r lib32-uutils-coreutils # # $STAGING_LIBDIR_NATIVE # set /OE/build/oe-core/openembedded-core/meta/conf/bitbake.conf:425 # "${STAGING_DIR_NATIVE}${libdir_native}" STAGING_LIBDIR_NATIVE="/OE/build/oe-core/tmp/work/armv7at2-neon-oemllib32-linux-gnueabi/lib32-uutils-coreutils/0.0.29/recipe-sysroot-native/usr/lib" Signed-off-by: Martin Jansa <martin.jansa@gmail.com> --- .../uutils-coreutils/uutils-coreutils_0.0.29.bb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)