Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 957178 - sys-kernel/genkernel fails to build initramfs with dev-build/cmake-4.0.2-r1
Summary: sys-kernel/genkernel fails to build initramfs with dev-build/cmake-4.0.2-r1
Status: UNCONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard: cmake without cmake.eclass
Keywords: PATCH
Depends on:
Blocks: cmake-4 cmake-4-stable
  Show dependency tree
 
Reported: 2025-06-05 17:04 UTC by Weezer
Modified: 2025-06-11 09:32 UTC (History)
5 users (show)

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


Attachments
genkernel log with error msg (genkernel.log.xz,82.56 KB, application/x-xz)
2025-06-05 17:07 UTC, Weezer
Details
fix json-c build in genkernel with cmake 4 (file_957178.txt,405 bytes, patch)
2025-06-06 17:20 UTC, Chris Pfuhl
Details | Diff
fixed json-c-0.17_cmake4 patch using tabbed indentation (json-c-0.17_cmake4.patch,364 bytes, patch)
2025-06-07 09:08 UTC, jeremy mills
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Weezer 2025-06-05 17:04:56 UTC
After kernel compilation, when creating an initramfs with genkernel-4.3.16-r5, it is failing with errors.  Had to downgrade to cmake-3.31.7-r1 in order to successfully create the initramfs.  Also tried downgrading genkernel to v4.3.16-r4 and the failures persisted.  Two machines tested with same results. 

Reproducible: Always

Steps to Reproduce:
1.Compile kernel
2.Create initramfs with genkernel and cmake-4.0.2-r1
3.Downgrade cmake to 3.31.7-r1, create initramfs successfully.
Comment 1 Weezer 2025-06-05 17:07:09 UTC
Created attachment 930391 [details]
genkernel log with error msg
Comment 2 Weezer 2025-06-05 17:11:48 UTC
Here is the screen output in then event of easy diagnosis:

-----

* ERROR: Command 'cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_APPS=OFF -DDISABLE_EXTRA_LIBS=ON -DDISABLE_WERROR=ON -DENABLE_RDRAND=no -DENABLE_THREADING=no -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_LIBDIR=lib ../json-c-0.17' failed!
* ERROR: create_initramfs(): append_data(): append_luks(): populate_binpkg(): populate_binpkg(): gkbuild(): Failed to create binpkg of json-c-0.17!
* Please consult '/var/log/genkernel.log' for more information and any
* errors that were reported above.
* 
* Report any genkernel bugs to bugs.gentoo.org and
* assign your bug to genkernel@gentoo.org. Please include
* as much information as you can in your bug report; attaching
* '/var/log/genkernel.log' so that your issue can be dealt with effectively.
* 
* Please do *not* report kernel compilation failures as genkernel bugs!

-----
Comment 3 Chris Pfuhl 2025-06-06 17:19:20 UTC
made a patch which adds -DCMAKE_POLICY_VERSION_MINIMUM=3.5  to the json-c gkbuild file as the failing genkernel output suggests. this fixes the error for me with genkernel 4.3.16-r5 and cmake-4.0.2-r1
Comment 4 Chris Pfuhl 2025-06-06 17:20:34 UTC
Created attachment 930406 [details, diff]
fix json-c build in genkernel with cmake 4
Comment 5 jeremy mills 2025-06-07 06:34:10 UTC
(In reply to Chris Pfuhl from comment #3)
> made a patch which adds -DCMAKE_POLICY_VERSION_MINIMUM=3.5  to the json-c
> gkbuild file as the failing genkernel output suggests. this fixes the error
> for me with genkernel 4.3.16-r5 and cmake-4.0.2-r1

this could also be fixed but upgrading json-c to 0.18 or above. this change would take place in the ebuild. im not sure of an automated way to do this though because the json-c gkbuid needs to be updated too (copying son-c-0.17.gkbuild to json-c-0.18.gkbuild works fine). that change needs to take place in the genkernel git repository though or maybe we could do a copy operation at the very end of the ebuild. im not sure. i just made the changes locally for the time being. the location of these file son the file system would be /usr/share/genkernel/gkbuilds
Comment 6 jeremy mills 2025-06-07 09:05:03 UTC
(In reply to Chris Pfuhl from comment #4)
> Created attachment 930406 [details, diff] [details, diff]
> fix json-c build in genkernel with cmake 4

i also tried your patch. for some reason it wouldnt apply. seems like its possibly an issue with spaces vs tabs. i recreated the patch locally with git diff and that applied properly. the only difference between the 2 was spaces  vs tabs for indentation. the original file in git uses tabbed indentation.
Comment 7 jeremy mills 2025-06-07 09:08:36 UTC
Created attachment 930937 [details, diff]
fixed json-c-0.17_cmake4 patch using tabbed indentation

this patch is identical to the one already posted. the only change is tabbed indentation. this one works for me the previous one did not.
Comment 8 Weezer 2025-06-07 17:34:47 UTC
Tested both patches and had the same issue with the first.  The second one did apply successfully for me.

Was able to build an initramfs using cmake-4 with the patch applied.
Comment 9 Larry the Git Cow gentoo-dev 2025-06-10 16:15:32 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=30744c2709ef988a58b89c8988ca0bc2872c0f98

commit 30744c2709ef988a58b89c8988ca0bc2872c0f98
Author:     Ben Kohler <bkohler@gentoo.org>
AuthorDate: 2025-06-10 15:06:03 +0000
Commit:     Ben Kohler <bkohler@gentoo.org>
CommitDate: 2025-06-10 15:06:03 +0000

    gkbuilds: add json-c-0.18
    
    Same as 0.17 but still separate from the unversioned one for now.
    
    Bug: https://bugs.gentoo.org/957178
    Signed-off-by: Ben Kohler <bkohler@gentoo.org>

 gkbuilds/json-c-0.18.gkbuild | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
Comment 10 Larry the Git Cow gentoo-dev 2025-06-10 16:29:05 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a84760409cc3b31a2fa15db5ba7d7bb03135d2d4

commit a84760409cc3b31a2fa15db5ba7d7bb03135d2d4
Author:     Ben Kohler <bkohler@gentoo.org>
AuthorDate: 2025-06-10 16:27:27 +0000
Commit:     Ben Kohler <bkohler@gentoo.org>
CommitDate: 2025-06-10 16:28:47 +0000

    sys-kernel/genkernel: bump to 4.3.17
    
    Adds new json-c-0.18 & includes backported fixes
    
    Bug: https://bugs.gentoo.org/957178
    Signed-off-by: Ben Kohler <bkohler@gentoo.org>

 sys-kernel/genkernel/Manifest                |   2 +
 sys-kernel/genkernel/genkernel-4.3.17.ebuild | 288 +++++++++++++++++++++++++++
 sys-kernel/genkernel/genkernel-9999.ebuild   |  31 +--
 3 files changed, 308 insertions(+), 13 deletions(-)
Comment 11 Andreas Sturmlechner gentoo-dev 2025-06-10 18:38:29 UTC
Apart from the awful practice of manually calling cmake in the first place, it also fails to declare it as BDEPEND.
Comment 12 Weezer 2025-06-11 09:32:22 UTC
Tested genkernel-4.3.17 with cmake-4.0.2-r1 and successfully created initramfs.

I could close this as "Resolved", "Fixed for me" or "Fixed", but not sure if I should?  Still listed as unconfirmed and work seems to be continuing...

Will leave open for now, but if an admin or maintainer wants to close it, feel free.  Simply not sure of the protocol here.