Cannot cross-compile, build machine is ubuntu focal amd64, target machine is debian buster on rpi
I'm trying to build fresh versions of gstreamer for my project running on Raspberry Pi 4.
Initially I've followed steps from the guide.
However it goes to recompile a lot of dependencies (i.e. glib) which I would keep as is (distribution bundled).
Thus I've prepared sysroot image with all the required dependencies installed and
after some tests ended up with
cross.ini which successfully completes the build
if I run it on Debian Buster amd64 build machine (using cross toolchain from Debian repository).
However if I use Ubuntu Bionic or Ubuntu Focal as a build machine build is failed with lots of linker errors.
After some investigation I've realized that linker tries to link against toolchain versions of libc/libstdc++/libm/etc, not ones found at sysroot and linked with other sysroot libraries (i.e. glib).
It's works if Debian Buster amd64 is used as a build machine, because those toolchain libraries actually match libraries in sysroot.
But once Ubuntu distro is used, libc/libstdc++/libm libraries no longer match and build is failed.
It worth mentioning that removing
/usr/arm-linux-gnueabihf/lib directory on the build machine helps to complete the build.
Please adopt meson build system so it could correctly handle the situation.
It seems autotools-based build works correctly here.
Build machine: Ubuntu Bionic amd64 / Ubuntu Focal amd64
[host_machine] system = 'linux' cpu_family = 'arm' cpu = 'armv7l' endian = 'little' [properties] c_args = ['--sysroot=/opt/rpi/sysroot/'] c_link_args = ['--sysroot=/opt/rpi/sysroot'] cpp_args = ['--sysroot=/opt/rpi/sysroot/'] cpp_link_args = ['--sysroot=/opt/rpi/sysroot'] sys_root = '/opt/rpi/sysroot/' pkg_config_libdir = ['/opt/rpi/sysroot/usr/lib/pkgconfig/','/opt/rpi/sysroot/usr/share/pkgconfig/','/opt/rpi/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig/'] [binaries] c = 'arm-linux-gnueabihf-gcc-8' cpp = 'arm-linux-gnueabihf-g++-8' ar = 'arm-linux-gnueabihf-ar' strip = 'arm-linux-gnueabihf-strip' pkgconfig = 'arm-linux-gnueabihf-pkg-config'
Gstreamer branch: 1.17.2
Meson version: 0.55 (from pypi)
Ninja version: 1.10.0 (from distro)
meson --cross-file ../cross.ini build --errorlogs \ -Dbuildtype=release -Dpython=disabled -Dgstreamer:libunwind=disabled