Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux-cachyos{,-rc}: Conditionally add clang-llvm to headers dependencies #352

Merged
merged 3 commits into from
Dec 6, 2024

Conversation

1Naim
Copy link
Member

@1Naim 1Naim commented Dec 5, 2024

Since we are compiling the default kernel with clang rather than GCC, we need to pull clang as a dependency
to ensure functionality with building out-of-tree kernel modules. For CachyOS users, this is already seamless
because our dkms package is dependent on clang, but AUR users and non-CachyOS users can suffer from this.

Note that this generates a bogus .SRCINFO when !_is_clang_kernel() but that doesn't matter for 100% of usecases
because it's default True (unless some third party repository defaults to GCC in which case they should fix it
on their own).

Depends on #354

@1Naim 1Naim requested a review from ptr1337 December 5, 2024 19:43
@sirlucjan
Copy link
Member

Probably doesn't work properly:

lucjan at cachyos ~/Pobrane/linux-cachyos/linux-cachyos-gcc 20:52:44    
❯ ls -la
.rw-r--r-- 2,6k lucjan  5 gru 20:51 .SRCINFO
.rwxr-xr-x 1,5k lucjan 18 lis 15:41 auto-cpu-optimization.sh
.rw-r--r-- 281k lucjan  5 gru 19:10 config
.rw-r--r--  31k lucjan  5 gru 20:51 PKGBUILD
lucjan at cachyos ~/Pobrane/linux-cachyos/linux-cachyos-gcc 20:52:47    
❯ cat .SRCINFO                         
# Generated by makepkg 7.0.0
# Thu Dec  5 19:51:58 UTC 2024
pkgbase = linux-cachyos-gcc
        pkgdesc = Linux BORE + LTO + AutoFDO Cachy Sauce Kernel by CachyOS with other patches and improvements.
        pkgver = 6.12.2
        pkgrel = 1
        url = https://github.com/CachyOS/linux-cachyos
        arch = x86_64
        license = GPL-2.0-only
        makedepends = bc
        makedepends = cpio
        makedepends = gettext
        makedepends = libelf
        makedepends = pahole
        makedepends = perl
        makedepends = python
        makedepends = tar
        makedepends = xz
        makedepends = zstd
        options = !strip
        options = !debug
        options = !lto
        source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.12.2.tar.xz
        source = config
        source = auto-cpu-optimization.sh
        source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.12/all/0001-cachyos-base-all.patch
        source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.12/sched/0001-bore-cachy.patch
        b2sums = 3161f791e13156a97215b14ed9d0a18dfd69324e7fa516df2a9385678ba2a2cd67196aa9efd82f7d9f1cb2c91b8733a095ced66c491f3a80c8c70eec1dc703d8
        b2sums = 8924e8e84d1a898fa14c8a14b5facc20fb44d5809d6eca45db9dd67ece7d233b9dfecd48181bc88392a227b63e757025e83a8709cace6fe55684c27b707ba701
        b2sums = b1e964389424d43c398a76e7cee16a643ac027722b91fe59022afacb19956db5856b2808ca0dd484f6d0dfc170482982678d7a9a00779d98cd62d5105200a667
        b2sums = d290e958f4870002d5ec6616fa45d9259277bbb7a92b0ff1b093d001bea45be5736f44ecfdeaa4d6fc40c4580ac954b41187b57a323c8b6e4c142f71c9d94724
        b2sums = 09e70082f6e1a5e969c545f123f3ecb74880f9b5ef4ad81a64ffd59a105d589fd9aa24699fd9088422c61b961eca647519a66e6893df120aa079e45fc7761702

pkgname = linux-cachyos-gcc
        pkgdesc = The Linux BORE + LTO + AutoFDO Cachy Sauce Kernel by CachyOS with other patches and improvements. kernel and modules
        depends = coreutils
        depends = kmod
        depends = initramfs
        optdepends = wireless-regdb: to set the correct wireless channels of your country
        optdepends = linux-firmware: firmware images needed for some devices
        optdepends = modprobed-db: Keeps track of EVERY kernel module that has ever been probed - useful for those of us who make localmodconfig
        optdepends = scx-scheds: to use sched-ext schedulers
        provides = VIRTUALBOX-GUEST-MODULES
        provides = WIREGUARD-MODULE
        provides = KSMBD-MODULE
        provides = UKSMD-BUILTIN
        provides = NTSYNC-MODULE

pkgname = linux-cachyos-gcc-headers
        pkgdesc = Headers and scripts for building modules for the Linux BORE + LTO + AutoFDO Cachy Sauce Kernel by CachyOS with other patches and improvements. kernel
        depends = pahole
        depends = linux-cachyos-gcc
        depends = clang
        depends = llvm
        depends = lld

Even building with GCC requires CLANG

@ptr1337
Copy link
Member

ptr1337 commented Dec 5, 2024

Probably doesn't work properly:

lucjan at cachyos ~/Pobrane/linux-cachyos/linux-cachyos-gcc 20:52:44    
❯ ls -la
.rw-r--r-- 2,6k lucjan  5 gru 20:51 .SRCINFO
.rwxr-xr-x 1,5k lucjan 18 lis 15:41 auto-cpu-optimization.sh
.rw-r--r-- 281k lucjan  5 gru 19:10 config
.rw-r--r--  31k lucjan  5 gru 20:51 PKGBUILD
lucjan at cachyos ~/Pobrane/linux-cachyos/linux-cachyos-gcc 20:52:47    
❯ cat .SRCINFO                         
# Generated by makepkg 7.0.0
# Thu Dec  5 19:51:58 UTC 2024
pkgbase = linux-cachyos-gcc
        pkgdesc = Linux BORE + LTO + AutoFDO Cachy Sauce Kernel by CachyOS with other patches and improvements.
        pkgver = 6.12.2
        pkgrel = 1
        url = https://github.com/CachyOS/linux-cachyos
        arch = x86_64
        license = GPL-2.0-only
        makedepends = bc
        makedepends = cpio
        makedepends = gettext
        makedepends = libelf
        makedepends = pahole
        makedepends = perl
        makedepends = python
        makedepends = tar
        makedepends = xz
        makedepends = zstd
        options = !strip
        options = !debug
        options = !lto
        source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.12.2.tar.xz
        source = config
        source = auto-cpu-optimization.sh
        source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.12/all/0001-cachyos-base-all.patch
        source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.12/sched/0001-bore-cachy.patch
        b2sums = 3161f791e13156a97215b14ed9d0a18dfd69324e7fa516df2a9385678ba2a2cd67196aa9efd82f7d9f1cb2c91b8733a095ced66c491f3a80c8c70eec1dc703d8
        b2sums = 8924e8e84d1a898fa14c8a14b5facc20fb44d5809d6eca45db9dd67ece7d233b9dfecd48181bc88392a227b63e757025e83a8709cace6fe55684c27b707ba701
        b2sums = b1e964389424d43c398a76e7cee16a643ac027722b91fe59022afacb19956db5856b2808ca0dd484f6d0dfc170482982678d7a9a00779d98cd62d5105200a667
        b2sums = d290e958f4870002d5ec6616fa45d9259277bbb7a92b0ff1b093d001bea45be5736f44ecfdeaa4d6fc40c4580ac954b41187b57a323c8b6e4c142f71c9d94724
        b2sums = 09e70082f6e1a5e969c545f123f3ecb74880f9b5ef4ad81a64ffd59a105d589fd9aa24699fd9088422c61b961eca647519a66e6893df120aa079e45fc7761702

pkgname = linux-cachyos-gcc
        pkgdesc = The Linux BORE + LTO + AutoFDO Cachy Sauce Kernel by CachyOS with other patches and improvements. kernel and modules
        depends = coreutils
        depends = kmod
        depends = initramfs
        optdepends = wireless-regdb: to set the correct wireless channels of your country
        optdepends = linux-firmware: firmware images needed for some devices
        optdepends = modprobed-db: Keeps track of EVERY kernel module that has ever been probed - useful for those of us who make localmodconfig
        optdepends = scx-scheds: to use sched-ext schedulers
        provides = VIRTUALBOX-GUEST-MODULES
        provides = WIREGUARD-MODULE
        provides = KSMBD-MODULE
        provides = UKSMD-BUILTIN
        provides = NTSYNC-MODULE

pkgname = linux-cachyos-gcc-headers
        pkgdesc = Headers and scripts for building modules for the Linux BORE + LTO + AutoFDO Cachy Sauce Kernel by CachyOS with other patches and improvements. kernel
        depends = pahole
        depends = linux-cachyos-gcc
        depends = clang
        depends = llvm
        depends = lld

Even building with GCC requires CLANG

as mentioned - that is just a bug of the .srcinfo generation

@1Naim
Copy link
Member Author

1Naim commented Dec 5, 2024

Probably doesn't work properly:

lucjan at cachyos ~/Pobrane/linux-cachyos/linux-cachyos-gcc 20:52:44    
❯ ls -la
.rw-r--r-- 2,6k lucjan  5 gru 20:51 .SRCINFO
.rwxr-xr-x 1,5k lucjan 18 lis 15:41 auto-cpu-optimization.sh
.rw-r--r-- 281k lucjan  5 gru 19:10 config
.rw-r--r--  31k lucjan  5 gru 20:51 PKGBUILD
lucjan at cachyos ~/Pobrane/linux-cachyos/linux-cachyos-gcc 20:52:47    
❯ cat .SRCINFO                         
# Generated by makepkg 7.0.0
# Thu Dec  5 19:51:58 UTC 2024
pkgbase = linux-cachyos-gcc
        pkgdesc = Linux BORE + LTO + AutoFDO Cachy Sauce Kernel by CachyOS with other patches and improvements.
        pkgver = 6.12.2
        pkgrel = 1
        url = https://github.com/CachyOS/linux-cachyos
        arch = x86_64
        license = GPL-2.0-only
        makedepends = bc
        makedepends = cpio
        makedepends = gettext
        makedepends = libelf
        makedepends = pahole
        makedepends = perl
        makedepends = python
        makedepends = tar
        makedepends = xz
        makedepends = zstd
        options = !strip
        options = !debug
        options = !lto
        source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.12.2.tar.xz
        source = config
        source = auto-cpu-optimization.sh
        source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.12/all/0001-cachyos-base-all.patch
        source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.12/sched/0001-bore-cachy.patch
        b2sums = 3161f791e13156a97215b14ed9d0a18dfd69324e7fa516df2a9385678ba2a2cd67196aa9efd82f7d9f1cb2c91b8733a095ced66c491f3a80c8c70eec1dc703d8
        b2sums = 8924e8e84d1a898fa14c8a14b5facc20fb44d5809d6eca45db9dd67ece7d233b9dfecd48181bc88392a227b63e757025e83a8709cace6fe55684c27b707ba701
        b2sums = b1e964389424d43c398a76e7cee16a643ac027722b91fe59022afacb19956db5856b2808ca0dd484f6d0dfc170482982678d7a9a00779d98cd62d5105200a667
        b2sums = d290e958f4870002d5ec6616fa45d9259277bbb7a92b0ff1b093d001bea45be5736f44ecfdeaa4d6fc40c4580ac954b41187b57a323c8b6e4c142f71c9d94724
        b2sums = 09e70082f6e1a5e969c545f123f3ecb74880f9b5ef4ad81a64ffd59a105d589fd9aa24699fd9088422c61b961eca647519a66e6893df120aa079e45fc7761702

pkgname = linux-cachyos-gcc
        pkgdesc = The Linux BORE + LTO + AutoFDO Cachy Sauce Kernel by CachyOS with other patches and improvements. kernel and modules
        depends = coreutils
        depends = kmod
        depends = initramfs
        optdepends = wireless-regdb: to set the correct wireless channels of your country
        optdepends = linux-firmware: firmware images needed for some devices
        optdepends = modprobed-db: Keeps track of EVERY kernel module that has ever been probed - useful for those of us who make localmodconfig
        optdepends = scx-scheds: to use sched-ext schedulers
        provides = VIRTUALBOX-GUEST-MODULES
        provides = WIREGUARD-MODULE
        provides = KSMBD-MODULE
        provides = UKSMD-BUILTIN
        provides = NTSYNC-MODULE

pkgname = linux-cachyos-gcc-headers
        pkgdesc = Headers and scripts for building modules for the Linux BORE + LTO + AutoFDO Cachy Sauce Kernel by CachyOS with other patches and improvements. kernel
        depends = pahole
        depends = linux-cachyos-gcc
        depends = clang
        depends = llvm
        depends = lld

Even building with GCC requires CLANG

That's just .SRCINFO generation. Actual package is correct.

Copy link
Member

@sirlucjan sirlucjan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So everything is OK.

1Naim added 3 commits December 6, 2024 20:06
In hindsight, there's not much to be gained by compiling clang without LTO. Faster compile times can be achieved
but the additional time it takes using LTO hardly matters on modern computers.

Forcing this on also makes it simple for the build script we use because the clang-specific features aren't
available on GCC (obviously).

Also refactored the pkgsuffix conditions to use _is_lto_kernel instead to make it cleaner.

Suggested-by: Vasiliy Stelmachenok <[email protected]>
Signed-off-by: Eric Naim <[email protected]>
Since we are compiling the default kernel with clang rather than GCC, we need to pull clang as a dependency
to ensure functionality with building out-of-tree kernel modules. For CachyOS users, this is already seamless
because our dkms package is dependent on clang, but AUR users and non-CachyOS users can suffer from this.

Note that this generates a bogus .SRCINFO when !_is_clang_kernel() but that doesn't matter for 100% of usecases
because it's default True (unless some third party repository defaults to GCC in which case they should fix it
on their own).

Closes #346

Signed-off-by: Eric Naim <[email protected]>
@1Naim 1Naim force-pushed the fix/kernel-clang-deps branch from 3d51457 to d72afd8 Compare December 6, 2024 12:09
@ptr1337 ptr1337 merged commit 1799c8b into master Dec 6, 2024
2 checks passed
@ptr1337 ptr1337 deleted the fix/kernel-clang-deps branch December 6, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants