Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 811600 - sys-fs/zfs-kmod overrides CROSS_COMPILE
Summary: sys-fs/zfs-kmod overrides CROSS_COMPILE
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Georgy Yakovlev
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2021-09-04 18:06 UTC by Luke-Jr
Modified: 2021-09-07 17:32 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke-Jr 2021-09-04 18:06:14 UTC
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.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-09-04 18:18:10 UTC
(No need to CC maintainers as it's done on bug-wrangling anyway.)
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-09-04 18:18:46 UTC
Hm, this seems reasonable to me?

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bcd13e4ff3e443fe350ef73630bb4892c85710d4
Comment 3 Luke-Jr 2021-09-04 18:28:04 UTC
(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.
Comment 4 Mike Gilbert gentoo-dev 2021-09-04 22:57:53 UTC
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.
Comment 5 Mike Gilbert gentoo-dev 2021-09-04 23:33:32 UTC
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.
Comment 6 Luke-Jr 2021-09-05 02:05:01 UTC
(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?
Comment 7 Georgy Yakovlev archtester gentoo-dev 2021-09-05 02:13:01 UTC
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.
Comment 8 Mike Gilbert gentoo-dev 2021-09-05 06:06:53 UTC
(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.
Comment 9 Mike Gilbert gentoo-dev 2021-09-05 15:50:01 UTC
Please give this PR a try.

https://github.com/gentoo/gentoo/pull/22224
Comment 10 Luke-Jr 2021-09-05 16:48:13 UTC
(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.
Comment 11 Larry the Git Cow gentoo-dev 2021-09-07 17:32:23 UTC
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(-)