Summary: | dev-libs/libsecp256k1 fails to compile without GCC installed | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Agostino Sarubbo <ago> |
Component: | Current packages | Assignee: | Matt Whitlock <gentoo> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | gentoo, luke-jr+gentoobugs, proxy-maint |
Priority: | Normal | Keywords: | PullRequest |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: | https://github.com/gentoo/gentoo/pull/39227 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | 942990 | ||
Bug Blocks: | 408963 | ||
Attachments: |
build.log
other.tar.bz2 |
Description
Agostino Sarubbo
![]() Created attachment 646790 [details]
build.log
build log and emerge --info
Created attachment 646792 [details]
other.tar.bz2
other logs
This is using AX_PROG_CC_FOR_BUILD to determine the correct compiler to target the build system (in case of cross compiling). This is needed because it runs custom code at build time to pre-generate data for the final library. How are other packages that use AX_PROG_CC_FOR_BUILD being fixed? I don't see any commits upstream relating to clang...? FTR gcc is installed here, I'm just using clang by setting the relative env variables. (In reply to Agostino Sarubbo from comment #4) > FTR gcc is installed here, I'm just using clang by setting the relative env > variables. Must not be in PATH or something? (In reply to Luke-Jr from comment #5) > (In reply to Agostino Sarubbo from comment #4) > > FTR gcc is installed here, I'm just using clang by setting the relative env > > variables. > > Must not be in PATH or something? yes, I have gcc-config with USE="-native-symlinks" If you want to use Clang as your system-wide compiler, then you probably should be setting the *_FOR_BUILD env vars as well. Those ought to be set in profiles/features/llvm/make.defaults, but I see they presently are not. When I set CPP=x86_64-pc-linux-gnu-clang-cpp-19 CC=x86_64-pc-linux-gnu-clang-19 CXX=x86_64-pc-linux-gnu-clang-19 CPP_FOR_BUILD="${CPP}" CC_FOR_BUILD="${CC}" CXX_FOR_BUILD="${CXX}" then dev-libs/libsecp256k1-0.3.0 compiles using Clang and doesn't touch GCC at all. I think the root of the issue is that AX_PROG_CC_FOR_BUILD and AX_PROG_CXX_FOR_BUILD work by monkey-patching all the variable names to have "_FOR_BUILD" suffixes and then running the standard AC_PROG_CC or AC_PROG_CXX. The gotcha with this is that the standard macros will then be looking to pull default values from environment variables suffixed with "_FOR_BUILD", and the unsuffixed variables won't be examined at all. Arguably, the *_FOR_BUILD macros should be prepopulating any unset _FOR_BUILD variables using the values of the unsuffixed variables when the build is not cross-compiling, prior to running the usual auto-detection logic that typically defaults to GCC. Until that day, though, you can make it work by setting the _FOR_BUILD variables yourself to specify explicitly which compiler you want to use to generate objects to run on the build system. Correction: CXX=x86_64-pc-linux-gnu-clang++-19 The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cacc52acc43245c2aa286f482e9d79f87ca632e3 commit cacc52acc43245c2aa286f482e9d79f87ca632e3 Author: Matt Whitlock <gentoo@mattwhitlock.name> AuthorDate: 2024-11-12 17:43:46 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-12-01 11:49:24 +0000 dev-libs/libsecp256k1: set build-machine toolchain environment The dev-libs/libsecp256k1 build uses AX_PROG_CC_FOR_BUILD from dev-build/autoconf-archive to detect the toolchain to use for compiling tools to run on the build machine during the build. Portage does not export the expected *_FOR_BUILD environment variables by default, so we have to call tc-export_build_env to set them. Closes: https://bugs.gentoo.org/729888 Signed-off-by: Matt Whitlock <gentoo@mattwhitlock.name> Closes: https://github.com/gentoo/gentoo/pull/39227 Signed-off-by: Sam James <sam@gentoo.org> dev-libs/libsecp256k1/libsecp256k1-0.5.1.ebuild | 6 +++++- dev-libs/libsecp256k1/libsecp256k1-0.6.0.ebuild | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) |