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

Bug 923414

Summary: sys-fs/bcachefs-tools Add USE flag "static"
Product: Gentoo Linux Reporter: Paul Sopka <psopka>
Component: Current packagesAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED INVALID    
Severity: enhancement CC: csfore, eschwartz93, kangie, psopka
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Paul Sopka 2024-01-31 10:58:08 UTC
Please add a USE flag "static", making it easier to add  sys-fs/bcachefs-tools to the initramfs.
Comment 1 Eli Schwartz 2024-01-31 17:26:15 UTC
I don't understand the feature request.

The initramfs builder will already include dependencies as needed?
Comment 2 Eli Schwartz 2024-01-31 17:30:39 UTC
readelf -d /sbin/bcachefs | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libblkid.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libuuid.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [liburcu-common.so.8]
 0x0000000000000001 (NEEDED)             Shared library: [liburcu.so.8]
 0x0000000000000001 (NEEDED)             Shared library: [libsodium.so.26]
 0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [liblz4.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libzstd.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libudev.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libkeyutils.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libaio.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]



This is a whole bunch of libraries, all of which need to be available statically *first*.

It is generally totally impractical to rebuild an entire gentoo statically just so the tools in an initramfs will be static. This is precisely why initramfs builders already resolve library dependencies and add them to the initramfs.
Comment 3 Christopher Fore 2024-01-31 17:59:56 UTC
This is not possible anyway because it links against udev and systemd has already had static-libs removed due upstream not wanting to support it.

https://github.com/systemd/systemd/issues/20600
Comment 4 Paul Sopka 2024-01-31 18:12:28 UTC
Thats unfortunate, everything else needed is availible statically on Gentoo.
Anyway, thank you all for your effort!
Comment 5 Christopher Fore 2024-01-31 18:26:21 UTC
No problem! I had brought it up to the dev of bcachefs in IRC when I was trying this a week or two ago and even he said it was something he didn't want to fight with. 

That said, I went through the source code when I hit the udev issue and I think their code only uses udev for one function, so it might be possible to switch it to use libblockdev and drop udev if someone wants to do the work to convert it. (imo I don't see a positive net gain out of this since static compilation isn't really required for much)


https://github.com/koverstreet/bcachefs-tools/blob/f15633cce1b79e708e9debc21c7b8772df7c7a29/src/commands/cmd_mount.rs#L110
Comment 6 Paul Sopka 2024-01-31 18:39:32 UTC
Thank you for this information, unfortunately I do not have the qualification to do a conversion like this.