mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.51k stars 1.6k forks source link

gstreamer Cross-Compile fatal error - can't find ffitarget-arm.h file #10897

Open pico-martin opened 1 year ago

pico-martin commented 1 year ago

When I do a native meson build of gstreamer, there are no problems. When I try to cross-compile for ARM, I get a fatal error:

gstreamer/build-cross-arm/subprojects/libffi/src/../include/ffitarget.h:12:10: fatal error: ffitarget-arm.h: No such file or directory #include "ffitarget-arm.h"

I am raising this issue here rather than in gstreamer first as I suspect it is an issue with meson (or indeed me) passing the correct parameters to the subproject libffi of gstreamer. Here is the meson command line that I am using:

meson build-cross-arm --cross-file=../cross-files/arm-cortex_a8-linux-gnueabihf-meson-cross-file.txt

and the associated cross-compile configuration file: [target_machine] system = 'linux' cpu_family = 'arm' cpu = 'cortex-a7' endian = 'little'

[properties] c_args = ['-O2'] cpp_args = ['-O2'] objc_args = ['-O2'] objcpp_args = [] c_link_args = ['-L/mnt/bbb/gstreamer/sysroot//lib', '-Wl,-rpath-link=/mnt/bbb/gstreamer/sysroot//lib', '-Wl,-O1', '-Wl,--hash-style=gnu', '-Wl,--as-needed'] cpp_link_args = ['-L/mnt/bbb/gstreamer/sysroot//lib', '-Wl,-rpath-link=/mnt/bbb/gstreamer/sysroot//lib', '-Wl,-O1', '-Wl,--hash-style=gnu', '-Wl,--as-needed'] objc_link_args = ['-L/mnt/bbb/gstreamer/sysroot//lib', '-Wl,-rpath-link=/mnt/bbb/gstreamer/sysroot//lib', '-Wl,-O1', '-Wl,--hash-style=gnu', '-Wl,--as-needed'] objcpp_link_args = ['-L/mnt/bbb/gstreamer/sysroot//lib', '-Wl,-rpath-link=/mnt/bbb/gstreamer/sysroot//lib', '-Wl,-O1', '-Wl,--hash-style=gnu', '-Wl,--as-needed'] pkg_config_libdir = ['/mnt/bbb/gstreamer/sysroot//lib/pkgconfig:/mnt/bbb/gstreamer/sysroot//usr/share/pkgconfig'] sys_root = '/mnt/bbb/gstreamer/sysroot/'

[binaries] c = ['arm-cortex_a8-linux-gnueabihf-gcc'] cpp = ['arm-cortex_a8-linux-gnueabihf-g++'] ar = ['arm-cortex_a8-linux-gnueabihf-ar'] pkgconfig = 'pkg-config' strip = ['arm-cortex_a8-linux-gnueabihf-strip'] cmake = ['false']

eli-schwartz commented 1 year ago

I don't see a lot of information here about what the actual error is -- I'd probably start out by looking at the exact contents of ffitarget.h (this all comes from libffi itself, so this is not a Meson bug).

That being said, your cross file is probably broken. It specifies target_machine but not host_machine. Per https://mesonbuild.com/Cross-compilation.html that means you're trying to run Meson on an unidentified CPU/OS called "X" and produce native binaries that run on "X", but those binaries are a cross compiler or other software that then emits cross code generation for arm cortex.

Gstreamer is not a compiler, so you should not need to care about target_machine.