Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 911987

Summary: genkernel using older version of json-c, breaks clang
Product: Gentoo Hosted Projects Reporter: modularized
Component: genkernelAssignee: Gentoo Genkernel Maintainers <genkernel>
Status: CONFIRMED ---    
Severity: critical CC: anrock623, bkohler, brokendreams1981, erikdenstore+gbugs, lo48576, tero
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: logs from genkernel

Description modularized 2023-08-09 21:12:03 UTC
Created attachment 867525 [details]
logs from genkernel

ello, i am currently facing an issue that banjaxed compiling LUKS on sys-kernel/genkernel-4.3.5 which involves it using an outdated version of json-c (13.1, latest is

# alright whats happening?
i was trying to compile my initramfs with --luks enabled on genkernel and it kept reporting a "tried convert a long to double" error which i felt as if it was a problem with what i was doing so i naturally reported it in the forums, turns out it was a bug...

# what would an ideal situation look like?
if the version would be correct, the double conversion wouldnt give out an error and compiling would succeed.

this is my first issue ever, so if the formatting was poor, thats probably why lol
Comment 1 anrock623 2024-05-23 12:45:13 UTC
Similar situation with genkernel and json-c-0.13.1 but gcc instead of clang and the error is

json_object.c:227:50: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
  227 |         jso = (struct json_object*)calloc(sizeof(struct json_object), 1);
      |                                                  ^~~~~~
Comment 2 Ben Kohler gentoo-dev 2024-05-23 12:48:35 UTC
I've updated most of the genkernel bundled tools but not worked on json-c yet since it has moved to a meson build.  I can work on this soon, but feel free to edit the genkernel ebuild to install 0.17 then hack on /usr/share/genkernel/gkbuilds/json-c.gkbuild and see if you can get 0.17 building.
Comment 3 Ben Kohler gentoo-dev 2024-05-23 12:52:04 UTC
I should note, the current gkbuild is empty because it works well enough with all of the default src_ phases... so to get 0.17 building, we'll need to actually start defining phases.  You can take a look at some of the *other* gkbuilds to see how they look.
Comment 4 jeremy mills 2024-05-23 18:00:58 UTC
Works for me with gcc14 if i Add -Wno-error=calloc-transposed-args

To the end of the DEFAULT_UTILS_CFLAGS line in /usr/share/genkernel/defaults/config.sh

This downgrades it back to a warning (same behavior as gcc13). This isn't the proper fix. Json-c needs patched but I don't quite understand exactly what needs changed. It looks like a few arts just need flipped probably in arraylist.c and json_object.c

A similar fix might work for clang.
Comment 6 Ben Kohler gentoo-dev 2024-05-23 19:17:31 UTC
I've bumped json-c to 0.17 in genkernel-9999, can you give that a try?

Thanks!
Comment 7 jeremy mills 2024-05-23 22:31:36 UTC
(In reply to Ben Kohler from comment #6)
> I've bumped json-c to 0.17 in genkernel-9999, can you give that a try?
> 
> Thanks!

I'll give it a try this evening. I can tell you json-c-0.17 isn't effected by this bug at least not with gcc (coincidently it uses malloc instead of calloc). 

Oddly some of the other utilities built during the initramfs stage prior to building json-c Emmitt the same warning but it's not upgraded to an error. Which is confusing.
Comment 8 jeremy mills 2024-05-24 01:27:08 UTC
(In reply to Ben Kohler from comment #6)
> I've bumped json-c to 0.17 in genkernel-9999, can you give that a try?
> 
> Thanks!

Tested. Builds and boots just fine here now with gcc14. Can't test clang.