commit:     ced2f28eb782e273f62d34cd4c1aa08408869826
Author:     Jeremi Piotrowski <jpiotrowski <AT> microsoft <DOT> com>
AuthorDate: Tue Mar 12 09:35:48 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 16 04:05:10 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ced2f28e

go-env.eclass: Export PKG_CONFIG

Go files may have cgo specifiers that use pkg-config to search for libraries to
link. An example of this is:

    // #cgo pkg-config: gpgme

One case where this occurs is when building one of the go deps of
app-containers/podman-4.9.2.

If the ebuild doesn't export the correct PKG_CONFIG, this results in build
failures during cross-compilation. Go will find the host (CBUILD) pkg-config
instead of the CHOST version which performs the lookup in the correct sysroot.

Fix cross-compilation by exporting PKG_CONFIG in go-env_set_compile_environment.

Signed-off-by: Jeremi Piotrowski <jpiotrowski <AT> microsoft.com>
Closes: https://github.com/gentoo/gentoo/pull/35721
Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/go-env.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/go-env.eclass b/eclass/go-env.eclass
index 1f950db06930..08cb6380e48a 100644
--- a/eclass/go-env.eclass
+++ b/eclass/go-env.eclass
@@ -27,7 +27,7 @@ inherit toolchain-funcs
 # (e.g. "emerge-aarch64-cross-linux-gnu foo" run on x86_64 will emerge "foo" 
for x86_64
 #  instead of aarch64)
 go-env_set_compile_environment() {
-       tc-export CC CXX
+       tc-export CC CXX PKG_CONFIG
 
        export GOARCH="$(go-env_goarch)"
        use arm && export GOARM=$(go-env_goarm)

Reply via email to