2

Here is cross-file example I use for cross compiling with meson build system. It is passed to meson with --cross-file option.

[host_machine]
system     = 'linux'
cpu_family = 'arm'
cpu        = ''
endian     = 'little'

[binaries]
c         = 'arm-linux-gnueabihf-cc'
cpp       = 'arm-linux-gnueabihf-g++'
ld        = 'arm-linux-gnueabihf-ld'
ar        = 'arm-linux-gnueabihf-ar'
strip     = 'arm-linux-gnueabihf-strip'
pkgconfig = 'pkg-config'

[properties]
c_args        = ['-march=armv7-a', '-mtune=cortex-a9', '-mlittle-endian', '-I/sysroot/usr/include']
cpp_args      = ['-march=armv7-a', '-mtune=cortex-a9', '-mlittle-endian', '-I/sysroot/usr/include']
c_link_args   = ['-march=armv7-a', '-mtune=cortex-a9', '-mlittle-endian', '-L/sysroot/lib', '-Wl,-rpath-link=/sysroot/staging/lib', '-L/sysroot/usr/lib', '-Wl,-rpath-link=/sysroot/usr/lib']
cpp_link_args = ['-march=armv7-a', '-mtune=cortex-a9', '-mlittle-endian', '-L/sysroot/lib', '-Wl,-rpath-link=/sysroot/staging/lib', '-L/sysroot/usr/lib', '-Wl,-rpath-link=/sysroot/usr/lib']

It worked fine. But after upgrading meson to the newest version, I get the following warnings:

DEPRECATION: c_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
DEPRECATION: cpp_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
DEPRECATION: c_link_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
DEPRECATION: cpp_link_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.

How can I fix this?

anton_rh
  • 8,226
  • 7
  • 45
  • 73

1 Answers1

1

Just rename [properties] section to [built-in options]:

[built-in options]
c_args        = ['-march=armv7-a', '-mtune=cortex-a9', '-mlittle-endian', '-I/sysroot/usr/include']
cpp_args      = ['-march=armv7-a', '-mtune=cortex-a9', '-mlittle-endian', '-I/sysroot/usr/include']
c_link_args   = ['-march=armv7-a', '-mtune=cortex-a9', '-mlittle-endian', '-L/sysroot/lib', '-Wl,-rpath-link=/sysroot/staging/lib', '-L/sysroot/usr/lib', '-Wl,-rpath-link=/sysroot/usr/lib']
cpp_link_args = ['-march=armv7-a', '-mtune=cortex-a9', '-mlittle-endian', '-L/sysroot/lib', '-Wl,-rpath-link=/sysroot/staging/lib', '-L/sysroot/usr/lib', '-Wl,-rpath-link=/sysroot/usr/lib']

https://mesonbuild.com/Machine-files.html

Changed in 0.56.0 putting <lang>_args and <lang>_link_args in the properties section has been deprecated, and should be put in the built-in options section.

Before 0.56.0, <lang>_args and <lang>_link_args must be put in the properties section instead, else they will be ignored.

Meson built-in options can be set the same way:

[built-in options]
c_std = 'c99'
anton_rh
  • 8,226
  • 7
  • 45
  • 73