I have tried so many different options to get around this. In fact, for most of the cross compilation I wrote a little library to LD_PRELOAD so that libtool and make install thinks the system root is other than it is. But I can't use that here and this is a nightmare.
export LD_LIBRARY_PATH="$SYSROOT/lib $SYSROOT/usr/lib"
export LDFLAGS="-Wl,-rpath,$SYSROOT/lib -Wl,-rpath-link,$SYSROOT/lib -L$SYSROOT/lib -lblkid"
export LT_SYS_LIBRARY_PATH="$SYSROOT/lib $SYSROOT/usr/lib"
export PKG_CONFIG_LIBDIR="$SYSROOT/lib $SYSROOT/usr/lib"
export BLKID_CFLAGS="-I$SYSROOT/include -I$SYSROOT/usr/include"
export BLKID_LIBS="-Wl,-rpath,$SYSROOT/lib -L$SYSROOT/lib -L$SYSROOT/usr/lib"
/bin/sh ../../libtool --tag=CC --mode=link aarch64-linux-gnu-gcc -Wl,--hash-style=gnu -Wl,--sysroot=/home/peterius/projects/LFM/system -L/home/peterius/projects/LFM/system/lib -I/home/peterius/projects/LFM/system/include -DO_BINARY=0 -DO_TEXT=0 -Wl,-rpath,/home/peterius/projects/LFM/system/lib -Wl,-rpath-link,/home/peterius/projects/LFM/system/lib -L/home/peterius/projects/LFM/system/lib -lblkid -o libudev_shared.la conf-files.lo device-nodes.lo dev-setup.lo fileio.lo hashmap.lo label.lo log.lo mempool.lo mkdir.lo mkdir-label.lo MurmurHash2.lo path-util.lo process-util.lo random-util.lo selinux-util.lo siphash24.lo smack-util.lo strbuf.lo strv.lo strxcpyx.lo sysctl-util.lo terminal-util.lo time-util.lo util.lo utf8.lo virt.lo
libtool: warning: library '/home/peterius/projects/LFM/system/lib/libblkid.la' was moved.
/bin/grep: /lib/libuuid.la: No such file or directory
/bin/sed: can't read /lib/libuuid.la: No such file or directory
libtool: error: '/lib/libuuid.la' is not a valid libtool archive
Basically, no matter what I pass to the configure script, even if I patch the configure script, I can't get it to look for libblkid's libuuid dependency in my system root.
This guy:
http://gnu-make.2324884.n4.nabble.com/libtool-make-and-sysroot-td10362.html
says that libtool is a pain with cross compilation.
So that's the bug. Please tell me how I can get this to work, what magic export libtool responds to and then make libtool more cross compiler friendly.
At some point, somehow, some combination of these exports, particularly maybe the latter three, and I got it past this libuuid grep error, and then it choked on a similar liblzma error which the PKG dir line fixed. But then it choked on this:
$TOOLCHAIN/aarch64-linux-gnu-gcc -Wl,--hash-style=gnu -Wl,--sysroot=/home/peterius/projects/LFM/system -I/home/peterius/projects/LFM/system/include -DO_BINARY=0 -DO_TEXT=0 -Wl,-rpath -Wl,/home/peterius/projects/LFM/system/lib -Wl,-rpath-link -Wl,/home/peterius/projects/LFM/system/lib -o udevadm udevadm.o udevadm-info.o udevadm-control.o udevadm-monitor.o udevadm-hwdb.o udevadm-settle.o udevadm-trigger.o udevadm-test.o udevadm-test-builtin.o udevadm-util.o -L/home/peterius/projects/LFM/system/lib ./.libs/libudev-core.a -L/home/peterius/projects/LFM/system/usr/lib
because it wasn't linked against blkid, just a simple -blkid fixed it. It's hard to imagine this complicated configure and libtool and linker scripts and somehow "-lblkid" was left out. But of course when I added that, it couldn't find the uuid library, so I added -rpath and then it compiled, but then when I added "-lblkid" to my export LDFLAGS for the actual make run, it brought me back to the earlier errors.
This should not be this hard. There's no way this should be this hard. Just put all the object files in a big pile and call it a library.