diff mbox series

[1/1] package/environment-setup: export pkgconf's evironment variables

Message ID 20240913115319.169625-1-antoine.coutant@smile.fr
State New
Headers show
Series [1/1] package/environment-setup: export pkgconf's evironment variables | expand

Commit Message

Antoine Coutant Sept. 13, 2024, 11:53 a.m. UTC
pkgconf can not find libraries outside of the default sysroot without
PKG_CONFIG_PATH and PKG_CONFIG_PATH properly set.

Make environment-setup export those variables so that pkgconf can
look for libraries in the buildroot sysroot.

Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
The issue can be reproduced by searching for libraries using buildroot's
pkgconf after sourcing environment-setup.

I found the issue when compiling using meson. The meson "dependency"
keyword uses pkgconf to find libraries, which uses pkgconf
(and other programs) [1].

[1]: https://mesonbuild.com/Dependencies.html

Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
 package/environment-setup/environment-setup.mk | 2 ++
 1 file changed, 2 insertions(+)

Comments

Thomas Petazzoni Sept. 14, 2024, 7:49 a.m. UTC | #1
Hello,

On Fri, 13 Sep 2024 13:53:19 +0200
Antoine Coutant via buildroot <buildroot@buildroot.org> wrote:

> pkgconf can not find libraries outside of the default sysroot without
> PKG_CONFIG_PATH and PKG_CONFIG_PATH properly set.
> 
> Make environment-setup export those variables so that pkgconf can
> look for libraries in the buildroot sysroot.
> 
> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
> ---
> The issue can be reproduced by searching for libraries using buildroot's
> pkgconf after sourcing environment-setup.
> 
> I found the issue when compiling using meson. The meson "dependency"
> keyword uses pkgconf to find libraries, which uses pkgconf
> (and other programs) [1].
> 
> [1]: https://mesonbuild.com/Dependencies.html
> 
> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>

This patch shouldn't be needed I believe. We install
HOST_DIR/bin/pkg-config which properly defines those variables. Why are
you using HOST_DIR/bin/pkgconf directly and not HOST_DIR/bin/pkg-config
?

Best regards,

Thomas
diff mbox series

Patch

diff --git a/package/environment-setup/environment-setup.mk b/package/environment-setup/environment-setup.mk
index 069ee25f9f..2e0dbe071a 100644
--- a/package/environment-setup/environment-setup.mk
+++ b/package/environment-setup/environment-setup.mk
@@ -32,6 +32,8 @@  define HOST_ENVIRONMENT_SETUP_INSTALL_CMDS
 		$(ENVIRONMENT_SETUP_FILE)
 	printf "export \"PATH=\$$SDK_PATH/bin:\$$SDK_PATH/sbin:\$$PATH\"\n" \
 		>> $(ENVIRONMENT_SETUP_FILE)
+	printf "export \"PKG_CONFIG_PATH=\$$STAGING_DIR/usr/lib/pkgconfig\"\n" >> $(ENVIRONMENT_SETUP_FILE)
+	printf "export \"PKG_CONFIG_SYSROOT_DIR=\$$STAGING_DIR\"\n" >> $(ENVIRONMENT_SETUP_FILE)
 
 	$(if $(BR2_LINUX_KERNEL),\
 		printf "export \"KERNELDIR=$(LINUX_BUILDDIR)\"\n" \