Skip to content
Advertisement

How to compile *only* uuid from linux utils

I have the linux utils code (can be found here: https://www.kernel.org/pub/linux/utils/util-linux/) and I only need libuuid, nothing else. I’ve tried setting many ‘–disable-‘ flags but it still seems to be compiling things I don’t need.

Here’s my actual configure command:

./configure --disable-libblkid --disable-libmount --disable-mount --disable-losetup --disable-cytune --disable-fsck --disable-partx --disable-uuidd --disable-mountpoint --disable-fallocate --disable-unshare --disable-nsenter --disable-setpriv --disable-eject --disable-agetty --disable-cramfs --disable-bfs --disable-fdformat --disable-hwclock --disable-wdctl --disable-switch_root --disable-pivot_root --disable-kill --disable-last --disable-utmpdump --disable-mesg --disable-raw --disable-rename --disable-login --disable-nologin --disable-sulogin --disable-su --disable-runuser --disable-ul --disable-more --disable-pg --disable-setterm --disable-schedutils --disable-wall --build="$BUILD_ARCH" --host="$HOST_ARCH" --prefix="$outputdir" --exec-prefix="$outputdir" 

and here’s my output:

<...build things including libuuid...>
  CC       fdisks/cfdisk-cfdisk.o
../fdisks/cfdisk.c: In function 'get_string':
../fdisks/cfdisk.c:447:5: warning: implicit declaration of function 'getyx' [-Wimplicit-function-declaration]
../fdisks/cfdisk.c:447:5: warning: nested extern declaration of 'getyx' [-Wnested-externs]
../fdisks/cfdisk.c:447:11: error: 'stdscr' undeclared (first use in this function)
<...>

Is there any way to only build libuuid?

Advertisement

Answer

The easiest approach would be to pull the latest linux-utils tarball from the link you provided, extract it’s contents, and then modify the root-level Makefile.am. Look for the section that looks like this:


include tools/Makemodule.am
include include/Makemodule.am
include lib/Makemodule.am
include libuuid/Makemodule.am
include libblkid/Makemodule.am
include libmount/Makemodule.am
include libsmartcols/Makemodule.am
include libfdisk/Makemodule.am

include schedutils/Makemodule.am
include text-utils/Makemodule.am
include term-utils/Makemodule.am
include login-utils/Makemodule.am
include sys-utils/Makemodule.am
include misc-utils/Makemodule.am
include disk-utils/Makemodule.am

include bash-completion/Makemodule.am

include tests/Makemodule.am

And modify it to look like so (leave only the libuuid entry uncommented):

#include tools/Makemodule.am
#include include/Makemodule.am
#include lib/Makemodule.am
include libuuid/Makemodule.am
#include libblkid/Makemodule.am
#include libmount/Makemodule.am
#include libsmartcols/Makemodule.am
#include libfdisk/Makemodule.am
#
#include schedutils/Makemodule.am
#include text-utils/Makemodule.am
#include term-utils/Makemodule.am
#include login-utils/Makemodule.am
#include sys-utils/Makemodule.am
#include misc-utils/Makemodule.am
#include disk-utils/Makemodule.am
#
#include bash-completion/Makemodule.am
#
#include tests/Makemodule.am

Finally, from the root directory (of the archive you extracted), execute the following:

autoconf
automake
./configure
make

You may need to run automake --add-missing instead of automake, and autoreconf --force --install instead of autoconf, depending on the version of autotools installed on your system.

Now, just find your built library via find . -iname "*libuuid.so*".

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement