]> code.ossystems Code Review - openembedded-core.git/commit
meson: export native env only for native build
authorMartin Kelly <mkelly@xevo.com>
Thu, 4 Jan 2018 13:12:37 +0000 (15:12 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 5 Jan 2018 12:02:28 +0000 (12:02 +0000)
commitde7ae028c65a978969b2e06fdc1a2d08bc141a5b
tree4f417144b3a6d4b806f65711b1147e56111c78b5
parent32c2faf394ba7bf75a7273fb9f5e58cc4ee3f3ad
meson: export native env only for native build

Although the meson crossfile should take care of setting the right cross
environment for a target build, meson slurps any set CFLAGS, CXXFLAGS,
LDFLAGS, and CPPFLAGS from the environment and injects them into the
build (see mesonbuild/environment.py:get_args_from_envvars for details).

This means that we are seeing native CFLAGS, CXXFLAGS, LDFLAGS, and
CPPFLAGS in the target build, which is wrong and causes build failures
when target and native have libraries in common (the linker gets
confused and bails).

That said, we *do* need to set certain vars for all builds so that meson
can find the right build tools. Without this, meson will fail during its
sanity checking step because it will determine the build tools to be
unrunnable since they output target instead of native artifacts.

The solution to all of this is to set CC, CXX, LD, and AR globally to
the native tools while setting the other native vars *only* for the
native build. For target builds, these vars will get overridden by the
cross file as we expect.

Signed-off-by: Martin Kelly <mkelly@xevo.com>
Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/meson.bbclass