Hello I am trying to cross compile systemd for arm, but I got stuck on 'mount' cross depencency.
I managed to cross compile libmount from util-linux but can not figure out where to put it or how to specify where should meson look for it.
There is a 'mount-path' option, but even when providing it it still says:
Meson encountered an error in file meson.build, line 797, column 0:
Cross dependency 'mount' not found
My cross compile file looks like this:
[binaries]
c = '/usr/bin/arm-linux-gnueabi-gcc'
cpp = '/usr/bin/arm-linux-gnueabi-g++'
ar = '/usr/arm-linux-gnueabi/bin/ar'
strip = '/usr/arm-linux-gnueabi/bin/strip'
pkgconfig = '/usr/bin/arm-linux-gnueabi-pkg-config'
[host_machine]
system = 'linux'
cpu_family = 'arm'
cpu = 'cortex-m4'
endian = 'little'
[build_machine]
system = 'linux'
cpu_family = 'x86_64'
cpu = 'i686'
endian = 'little'
Btw if you know about another way to get systemd on arm without this ridiculous(IMHO) setup it would be nice.
Thank you.
Meson uses pkg-config tool to find dependencies. This tool searches, so called, package config files using PKG_CONFIG_PATH environment variable. You can check that there is no mount in:
$ pkg-config --list-all
This is naturally because you've just compiled but did not provide package config file mount.pc to be found. Check libmount sources, it should contain mount.pc.in that is used by installation process. In cross-compiling case, it should be turned into mount.pc manually according to guide.
After creating package config file you should be able to successfully run:
$ pkg-config --validate mount
You can also check validness of variables:
$ pkg-config --cflags mount
-I/home/<>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/libmount -I/home/<>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/blkid -I/home/<>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/uuid
$ pkg-config --libs mount
-lmount
BTW, this is the contents of mount.pc that I've got:
prefix=/usr
exec_prefix=/usr
libdir=/usr/lib
includedir=/usr/include
Name: mount
Description: mount library
Version: 2.29.1
Requires.private: blkid
Cflags: -I${includedir}/libmount
Libs: -L${libdir} -lmount
Btw if you know about another way to get systemd on arm without this ridiculous(IMHO) setup it would be nice.
systemd switched to meson, so now it's only the way, unless you want to build older version with autotools.
But thinking wider, you can also take a look at yocto which focuses on simplifying getting cross-compiled linux distributions.
Update
As, @Yasushi Shoji correctly pointed out, for cross-compilation case, PKG_CONFIG_LIBDIR should be used instead, as it prevents undesired/wrong usage of local system packages, check this.