Since the update from 20250106 to 20250410 cross-pkg-config has added line 29 -- [ "${0##*/}" = "${REAL_PKG_CONFIG}" ] && error "aborting infinite loop! (make sure to delete uClinux-dist/tools/pkg-config)" This check bails out situations where CBUILD=CHOST which is the case when PORTAGE_CONFIGROOT and ROOT is used to cross build which results in error -- cross-pkg-config: error: aborting infinite loop! (make sure to delete uClinux-dist/tools/pkg-config) Another side effect of this is that even when not using crossdev i.e using emerge directly to crossbuild (with SYSROOT etc... with other environment variables to support the build process), when the user intentionally sets CBUILD=CHOST to make the toolchain assume that it's not cross compiling, cross-pkg-config fails with this error for the same reason. The reason for setting CBUILD=CHOST is because many packages do not cross compile e.g. -- www-servers/varnish: configure: error: cannot run test program while cross compiling dev-vcs/git: ERROR: Can not run test applications in this cross environment. dev-util/ragel: error: cannot check for file existence when cross compiling dev-cpp/clucene: CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately dev-python/numpy: ERROR: Can not run test applications in this cross environment. And may packages which give various errors when cross compiling. etc.. etc.. etc... For these package the common workaround is setting CBUILD=CHOST when building on machines with similar (but not identical) CPU types (for e.g. znver1 on icelake where you cannot even chroot (and even qemu-softmmu cannot do that because does not support all instructions) or situations where building in chroot results in invalid instructions but not with CBUILD=CHOST). With this check in place in cross-pkg-config, this workaround cannot be used. Reproducible: Always
Created attachment 928435 [details] Same failed build log with the crossdev-20250410 installed of unbound. unbound was attempted to build with -- PORTAGE_CONFIGROOT=/usr/x86_64-mypc-linux-gnu/ ROOT=/usr/x86_64-mypc-linux-gnu/ emerge --getbinpkg --keep-going net-dns/unbound The build works with crossdev-20250106.
Your use case is a little strange strange: cross-pkg-config is normally invoked when cross-compiling, but you are not cross-compiling if CBUILD == CHOST. It was not designed to work under that condition. I would be happy to review a patch to resolve the issue, but be aware of bug 948948.
But this also breaks building with ROOT= only -- which is a critical functionality because a LOT of package do not cross compile. ROOT= is supposed to work.
ROOT has nothing to do with it. This is caused by you setting CBUILD equal to CHOST when CBUILD-pkg-config is cross-pkg-config and not a real pkgconf binary.
So what could be done is that if cross-pkg-config sees that ${CBUILD}-pkg-config is a symlink to /usr/bin/cross-pkg-config (which is invalid anyway), it'll set REAL_PKG_CONFIG to /usr/bin/pkg-config. Will that be a viable solution?
Created attachment 928534 [details, diff] Checks if $REAL_PKG_CONFIG symlinks to cross-pkg-config, and fallbacks to pkg-config if that's so. This patch seems to be working.
I'm not crazy about making guesses based on symlinks. I added a link to my own PR. Will that work for you?
I modified crossdev-99999999.ebuild with -- EGIT_REPO_URI="https://github.com/floppym/crossdev" EGIT_BRANCH="bug955822-cbuild" Seems to be working fine. (Unbound works). Let me complete the upgrade and I'll revert if there are issues. Thanks!!
I can confirm that this issues if fixed with https://github.com/floppym/crossdev branch bug955822-cbuild Thanks again for the fix.
Any chance of this being merged to the official project repo?
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=99a3974e9108a231523af6002578682391b26260 commit 99a3974e9108a231523af6002578682391b26260 Author: Mike Gilbert <floppym@gentoo.org> AuthorDate: 2025-05-12 14:57:27 +0000 Commit: Mike Gilbert <floppym@gentoo.org> CommitDate: 2025-05-24 17:11:45 +0000 cross-pkg-config: remember PKG_CONFIG from build time This should avoid recursive cross-pkg-config calls when someone sets CBUILD = CHOST in the cross-emerge environment, which might be useful for building a system image with SYSROOT != /. For sys-devel/crossdev we will call "tc-export PKG_CONFIG" to set a reasonable default for REAL_PKG_CONFIG. This will generally be ${CHOST}-pkg-config, where CBUILD = CHOST and SYSROOT = ROOT = /. In the case we are cross-compiling crossdev itself, we want ${CHOST}-pkg-config for REAL_PKG_CONFIG in SYSROOT/ROOT in case it is later used as a root image on appropriate hardware. We also allow the user to override REAL_PKG_CONFIG via the environment in case some unforseen use case is discovered. Bug: https://bugs.gentoo.org/955822 Signed-off-by: Mike Gilbert <floppym@gentoo.org> wrappers/Makefile | 4 +++- wrappers/cross-pkg-config | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=af5d9197a2903c49426fa999e278c0aa77f98fa6 commit af5d9197a2903c49426fa999e278c0aa77f98fa6 Author: Mike Gilbert <floppym@gentoo.org> AuthorDate: 2025-05-24 17:16:57 +0000 Commit: Mike Gilbert <floppym@gentoo.org> CommitDate: 2025-05-24 17:16:57 +0000 sys-devel/crossdev: export PKG_CONFIG Bug: https://bugs.gentoo.org/955822 Signed-off-by: Mike Gilbert <floppym@gentoo.org> sys-devel/crossdev/crossdev-99999999.ebuild | 4 ++++ 1 file changed, 4 insertions(+)