For some reason, sys-fs/zfs-kmod overrides CROSS_COMPILE, breaking it in anything but the default scenario. This was added by gyakovlev a year ago as an apparent fix, but I don't see any details of the problem it was intended to fix in the git log.
(No need to CC maintainers as it's done on bug-wrangling anyway.)
Hm, this seems reasonable to me? https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bcd13e4ff3e443fe350ef73630bb4892c85710d4
(In reply to Sam James from comment #2) > Hm, this seems reasonable to me? > > https://gitweb.gentoo.org/repo/gentoo.git/commit/ > ?id=bcd13e4ff3e443fe350ef73630bb4892c85710d4 When userspace and kernel use the same compiler, sure - but in that case, the default will also work. When userspace and kernel need different compilers, this breaks it.
There doesn't seem to be any point in passing HOSTCC and CROSS_COMPILE to make. The hybrid autotools/Kbuild build system seems to use the toolchain(s) passed to configure via --build and --host.
Oh, I missed the fact that HOSTCC and CROSS_COMPILE were being passed in both src_configure and src_compile. Without passing CROSS_COMPILE, the build system defaults to using plain "gcc". This will fail with sys-devel/gcc[-native-symlinks], and will cause bugs to be reported by people running tinderboxes in that configuration.
(In reply to Mike Gilbert from comment #5) > Without passing CROSS_COMPILE, the build system defaults to using plain > "gcc". This will fail with sys-devel/gcc[-native-symlinks], and will cause > bugs to be reported by people running tinderboxes in that configuration. How do those people compile their kernel in the first place? Shouldn't it pick up the correct CROSS_COMPILE from their configuration?
I can make it overridable, but it has to be set by default for more common edge cases. I don't remember all the details, I wish I left a comment lol =) It had something to do with cross and dist-kernels.
(In reply to Luke-Jr from comment #6) > How do those people compile their kernel in the first place? kernel-build.eclass uses similar code to pass CROSS_COMPILE on the make command line. It also defaults to "${CHOST}-". https://gitweb.gentoo.org/repo/gentoo.git/tree/eclass/kernel-build.eclass#n48 > Shouldn't it pick up the correct CROSS_COMPILE from their configuration? I don't think many people use your "GNUmakefile" technique for "configuring" their kernel cross-compiles. It's simply not compatible with how Gentoo's kernel infrastructure works.
Please give this PR a try. https://github.com/gentoo/gentoo/pull/22224
(In reply to Mike Gilbert from comment #9) > Please give this PR a try. > > https://github.com/gentoo/gentoo/pull/22224 It appears to work for me.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b9353f8086431901cbe7593b1da7148134ae2eac commit b9353f8086431901cbe7593b1da7148134ae2eac Author: Mike Gilbert <floppym@gentoo.org> AuthorDate: 2021-09-05 15:47:02 +0000 Commit: Mike Gilbert <floppym@gentoo.org> CommitDate: 2021-09-07 17:31:57 +0000 sys-fs/zfs-kmod: set CROSS_COMPILE in the environment This allows it to be overriden in a local Makefile. Closes: https://bugs.gentoo.org/811600 Signed-off-by: Mike Gilbert <floppym@gentoo.org> sys-fs/zfs-kmod/zfs-kmod-0.8.6.ebuild | 7 +++++-- sys-fs/zfs-kmod/zfs-kmod-2.0.5.ebuild | 7 +++++-- sys-fs/zfs-kmod/zfs-kmod-2.1.0.ebuild | 7 +++++-- sys-fs/zfs-kmod/zfs-kmod-9999.ebuild | 7 +++++-- 4 files changed, 20 insertions(+), 8 deletions(-)