meson: meson.is_cross_build() returning false when "cross-compiling"
I’m developing on OS X, and trying to create a cross build that runs an actual GCC build (installed with homebrew), not the gcc-that’s-really-clang.
So I made a basic cross-file:
[binaries]
c = '/usr/local/opt/gcc/bin/gcc-9'
cpp = '/usr/local/opt/gcc/bin/g++-9'
ar = '/usr/local/opt/gcc/bin/gcc-ar-9'
[properties]
c_args = []
c_link_args = []
cpp_args = []
cpp_link_args = []
[host_machine]
system = 'darwin'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
And invoke a cross build:
meson buildresults --cross-file=build/cross/gcc/osx-brew/gcc.txt
Meson identifies it as a cross build:
The Meson build system
Version: 0.51.999
Source dir: /Users/pjohnston/src/ea/embedded-framework
Build dir: /Users/pjohnston/src/ea/embedded-framework/buildresults
Build type: cross build
WARNING: Unknown options: "build.c_std, build.cpp_std"
Project name: Embedded Virtual Machine
Project version: 0.9
C compiler for the build machine: cc (clang 10.0.1 "Apple LLVM version 10.0.1 (clang-1001.0.46.4)")
C++ compiler for the build machine: c++ (clang 10.0.1 "Apple LLVM version 10.0.1 (clang-1001.0.46.4)")
C compiler for the host machine: /usr/local/opt/gcc/bin/gcc-9 (gcc 9.1.0 "gcc-9 (Homebrew GCC 9.1.0) 9.1.0")
C++ compiler for the host machine: /usr/local/opt/gcc/bin/g++-9 (gcc 9.1.0 "g++-9 (Homebrew GCC 9.1.0) 9.1.0")
Build machine cpu family: x86_64
Build machine cpu: x86_64
But this logic is saying we’re not a cross build:
if meson.is_cross_build()
# ...
else
message('Since this is not a cross build, target_*_args will match native_*_args')
# ...
endif
When I run a cross build using ARM GCC, things get detected correctly. My hunch is that my minimal definition is missing something that meson is keying off of? So I’m still exploring that aspect.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 20 (19 by maintainers)
Why aren’t we setting
is_cross
totrue
when a cross file is specified regardless of what target/arch is in it?Got it, that is indeed interesting 😃
Well regardless of perceptions, we know why meson doesn’t think cross file -> cross. We don’t know why it changes it’s mind and doesn’t think it’s non-cross from the get-go.