tytso/e2fsprogs

Unable to compile on Ubuntu 24.04 LTS

Closed this issue · 8 comments

recently i upgraded my OS to Ubuntu 24.04 LTS and now i am not able to compile it.
Previously, i was on Ubuntu 22.04.4 and i can confirm its still building fine on my previous PC with 22.04.4.

GCC used in 22.04.4: 11.4.0
GCC used in 24.04: 13.2.0

Error i encountered on 24.04 is

plausible.c: In function ‘check_partition_table’: plausible.c:132:9: error: unknown type name ‘blkid_probe’ 132 | blkid_probe pr; | ^~~~~~~~~~~ plausible.c:136:14: warning: implicit declaration of function ‘blkid_new_probe_from_filename’ [-Wimplicit-function-declaration] 136 | pr = blkid_new_probe_from_filename(device);

image

The blkid_probe typedef is defined by the include file blkid/blkid.h. That can either be from /usr/include/blkid/blkid.h, or it can be in lin/blkid/blkid.h if you are using the built-in blkid library shipped with the e2fsprogs sources.

So things to try. (1) Make sure you have the latest version of the libblkid-dev package installed. (2) Run "make distclean" and then rerun the configure, and then try rebuilding e2fsprogs. if that doesn't work, you'll need to where the compiler is finding the blkid.h file, and if that's an invalid / wrong version, you'll want to uninstall or update the package, or delete the header file or package.

In any case, this is almost certainly a configuration problem, not an e2fsprogs bug. We are running continuous integration (CI) tests on github building e2fsprogs using Ubuntu 22.04 (as it happens). See https://github.com/tytso/e2fsprogs/actions/workflows/ci.yml for the latest success build logs. We are also doing CI test builds for Debian unstable: https://salsa.debian.org/tytso/e2fsprogs/-/jobs

i just checked and i have libblkid-dev pkg version 2.39.3-9ubuntu6 installed already. i even reinstalled util-linux pkg yesterday thinking it has outdated header file but no luck. With all same pkgs installed on my old laptop which has 22.04.4, i am able to compile it fine too but whats messed up on 24.04, i dont understand.
I found that there are 2 blkid.h files i found, 1 from system and other one from e2fsprogs, how i can set default?

image

The lib/blkid/blkid.h is probably left over from an older build. If "make distclean" didn't remove it, try running "git clean -xdf".

correction! After uninstalling libblkid-dev pkg, i can compile e2fsprogs fine on 24.04. seems like newer blkid.h from newer pkg is not compatible, i hope to see a fix from e2fsprogs on it soon ;) we can have support for both cases or force usage of included blkid.h file

The lib/blkid/blkid.h is probably left over from an older build. If "make distclean" didn't remove it, try running "git clean -xdf".

this also worked, i have reinstalled libblkid-dev pkg and rerun everything and it compiled all well

Building with either the internal blkid or the external system-provided blkid library should work. But you need to make sure that you arne't using half one and half the other. Again, this is not an e2fsprogs bug; this is purely a faulty build configuration.

yes i understand now, the leftover file is already removed with git clean command, and now its compiling fine. Cheers

Finally, note that the system-provided blkid library has more featuers/functionality than the internally-supplied blkid library. We include an internal blkid library for use when compiling on NetBSD, FreeBSD, MacOS, and Android. You can use the internal blkid library on Ubuntu, Debian, Fedora, etc., systems; but there will be some minor things like mke2fs warning before overwriting more exotic file system or partition table, etc., that won't be covered by the internal blkid library.

Also, you can use a separate build directory (e.g., rm -rf build ; mkdir build ; cd build ; ../configure ; make) which will avoid the sort of problem that you ran into. The other thing to consider doing is to use "dpkg-buildpackage" to build the e2fsprogs if you are planning on using e2fsorigs on your Ubuntu system. This will make sure you have the same compile flags and options (including security hardening) that us used for building the official packages for Debian and Ubuntu. It will also handle making sure that things are built using the correct build dependencies.

If you want to be even more careful in terms of using a hermetic build environment you can use a build chroot using schroot[1], sbuild[2] or git-buildpackage[3] (which is how I build the official release packages for Debian).

[1] https://wiki.debian.org/Schroot
[2] https://wiki.debian.org/sbuild
[3] https://wiki.debian.org/PackagingWithGit