Message ID | 20250908135933.889249-2-dwagenknecht@emlix.com |
---|---|
State | New |
Headers | show |
Series | buildtools-tarball: handle missing host pkg-config gracefully | expand |
On Mon, 8 Sept 2025 at 15:59, Daniel Wagenknecht via lists.openembedded.org <dwagenknecht=emlix.com@lists.openembedded.org> wrote: > --- a/meta/recipes-core/meta/buildtools-tarball.bb > +++ b/meta/recipes-core/meta/buildtools-tarball.bb > @@ -73,7 +73,7 @@ create_sdk_files:append () { > touch $script > echo 'export PATH="${SDKPATHNATIVE}${bindir_nativesdk}:${SDKPATHNATIVE}${sbindir_nativesdk}:${SDKPATHNATIVE}${base_bindir_nativesdk}:${SDKPATHNATIVE}${base_sbindir_nativesdk}:$PATH"' >> $script > echo 'export OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script > - echo 'HOST_PKG_PATH=$(command -p pkg-config --variable=pc_path pkg-config 2>/dev/null)' >>$script > + echo 'HOST_PKG_PATH=$(command -p pkg-config --variable=pc_path pkg-config 2>/dev/null || true)' >>$script It is not clear from this change and the commit message if HOST_PKG_PATH is actually expected to contain useful values somewhere else. It needs additional research, particularly to reassure reviewers that an empty value would not cause problems. Alex
Hello Alex, On Tue, 2025-09-09 at 09:13 +0200, Alexander Kanavin wrote: > It is not clear from this change and the commit message if > HOST_PKG_PATH is actually expected to contain useful values somewhere > else. It needs additional research, particularly to reassure > reviewers that an empty value would not cause problems. I can reassure you that it won't cause issues, due to the same script using it with a fallback default value and then unsetting it: ``` HOST_PKG_PATH=$(command -p pkg-config --variable=pc_path pkg-config 2>/dev/null) export PKG_CONFIG_LIBDIR=[--snip--]:${HOST_PKG_PATH:-/usr/lib/pkgconfig:/usr/share/pkgconfig} unset HOST_PKG_PATH ``` But I'll send a v2 which adresses this directly in the commit message. Sincerely Daniel
diff --git a/meta/recipes-core/meta/buildtools-tarball.bb b/meta/recipes-core/meta/buildtools-tarball.bb index 02117ab84..61b98c738 100644 --- a/meta/recipes-core/meta/buildtools-tarball.bb +++ b/meta/recipes-core/meta/buildtools-tarball.bb @@ -73,7 +73,7 @@ create_sdk_files:append () { touch $script echo 'export PATH="${SDKPATHNATIVE}${bindir_nativesdk}:${SDKPATHNATIVE}${sbindir_nativesdk}:${SDKPATHNATIVE}${base_bindir_nativesdk}:${SDKPATHNATIVE}${base_sbindir_nativesdk}:$PATH"' >> $script echo 'export OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script - echo 'HOST_PKG_PATH=$(command -p pkg-config --variable=pc_path pkg-config 2>/dev/null)' >>$script + echo 'HOST_PKG_PATH=$(command -p pkg-config --variable=pc_path pkg-config 2>/dev/null || true)' >>$script echo 'export PKG_CONFIG_LIBDIR=${SDKPATHNATIVE}/${libdir}/pkgconfig:${SDKPATHNATIVE}/${datadir}/pkgconfig:${HOST_PKG_PATH:-/usr/lib/pkgconfig:/usr/share/pkgconfig}' >>$script echo 'unset HOST_PKG_PATH'
The host might not have pkg-config installed, which is OK when using the buildtools-extended-tarball, since that contains pkg-config. So the command for setting HOST_PKG_PATH is expected to fail in some cases without this being an error. The generated environment-setup-* script might be sourced in a shell with activated `errexit` option. Prevent the expected failure of this command from being treated as an error. Signed-off-by: Daniel Wagenknecht <dwagenknecht@emlix.com> --- meta/recipes-core/meta/buildtools-tarball.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)