diff options
author | Khem Raj <raj.khem@gmail.com> | 2016-11-13 21:35:46 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-11 17:21:41 +0000 |
commit | 8325c93df99187318cc3160559fdd0718e2c03d8 (patch) | |
tree | 05fab5edb358c247290abb37b6873433469de4d3 /meta/classes | |
parent | cb2967921e3641813eacd467f5673cce8ee074ba (diff) | |
download | poky-8325c93df99187318cc3160559fdd0718e2c03d8.tar.gz |
cmake.bbclass: Set CXXFLAGS and CFLAGS
We strip the TOOLCHAIN_OPTIONS and HOST_CC_ARCH from CC/CXX in cmake.bbclass
whereas CFLAFS and CXXFLAGS assume that TOOLCHAIN_OPTIONS are
part of CC/CXX variables, this causes compile failures when cmake
is running compiler tests during configure on some architectures
especially armhf, because hf ABI information -mfloat-abi is part
of TOOLCHAIN_OPTIONS, so what happens is that testcase gets compiled
without hard-float, howver, during linking the float ABI option
is passed via LDFLAGS, now linker rejects this and fails like
/mnt/a/build/tmp-glibc/sysroots/x86_64-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/6.2.0/ld: error: cmTC_27947 uses VFP register arguments, CMakeFiles/cmTC_27947.dir/src.cxx.o does not
mnt/a/build/tmp-glibc/sysroots/x86_64-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/6.2.0/ld: failed to merge target specific data of file CMakeFiles/cmTC_27947.dir/src.cxx.o
collect2: error: ld returned 1 exit status
This means that CMake now fails the configure time test too
which is not right, e.g. it might disable features which actually do exist
and should be enabled e.g. in case above it is resulting as below
Performing C++ SOURCE FILE Test HAS_BUILTIN_SYNC_SUB_AND_FETCH failed with the following output:
Its actually a bug in CMake see
https://gitlab.kitware.com/cmake/cmake/issues/16421
CMake is ignoring CMAKE_CXX_FLAGS when using CHECK_CXX_SOURCE_COMPILES
function.
Until it is fixed upstream, we add HOST_CC_ARCH and TOOLCHAIN_OPTIONS
to CFLAGS and CXXFLAGS, so that we can ensure that compiler invocation
remains consistent.
(From OE-Core rev: 826f3cdb474b5728b22f08d2342fc90235ca9e7d)
(From OE-Core rev: 7e5fd5914e15397a56425130c2322ace67da2ee4)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/cmake.bbclass | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass index 3e762de6a2..fad0baa519 100644 --- a/meta/classes/cmake.bbclass +++ b/meta/classes/cmake.bbclass | |||
@@ -19,6 +19,8 @@ OECMAKE_C_FLAGS_RELEASE ?= "-DNDEBUG" | |||
19 | OECMAKE_CXX_FLAGS_RELEASE ?= "-DNDEBUG" | 19 | OECMAKE_CXX_FLAGS_RELEASE ?= "-DNDEBUG" |
20 | OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}" | 20 | OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}" |
21 | OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LDFLAGS}" | 21 | OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LDFLAGS}" |
22 | CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}" | ||
23 | CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}" | ||
22 | 24 | ||
23 | OECMAKE_RPATH ?= "" | 25 | OECMAKE_RPATH ?= "" |
24 | OECMAKE_PERLNATIVE_DIR ??= "" | 26 | OECMAKE_PERLNATIVE_DIR ??= "" |