Please add a USE flag "static", making it easier to add sys-fs/bcachefs-tools to the initramfs.
I don't understand the feature request. The initramfs builder will already include dependencies as needed?
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.
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
Thats unfortunate, everything else needed is availible statically on Gentoo. Anyway, thank you all for your effort!
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
Thank you for this information, unfortunately I do not have the qualification to do a conversion like this.