Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Khem Raj <raj.khem@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] cmake.bbclass: Exclude native sysroot from CMAKE_FIND_ROOT_PATH
Date: Sat, 29 Oct 2016 01:47:07 -0700	[thread overview]
Message-ID: <20161029084707.29652-1-raj.khem@gmail.com> (raw)

This has been cause of issue where we were getting both usr/include
dirs ( from target as well as native sysroot) added to compiler
flags.

CXX_INCLUDES in final flags.cmake would include
-I<target-sysroot>/usr/include -I<native-sysroot>/usr/include
most of the time it would work since headers are mostly
common but netflix package failed to compile since one of
the headers was including curl headers which it could not
find in target sysroot and it went to next include path
and found it in native sysroot which is not what we want
when doing cross compile.

As per https://cmake.org/Wiki/CMake_Cross_Compiling
never search for programs in target sysroot but search
for packages,libs,includes only.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes/cmake.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index 3e762de..3e8df37 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -25,6 +25,7 @@ OECMAKE_PERLNATIVE_DIR ??= ""
 OECMAKE_EXTRA_ROOT_PATH ?= ""
 
 OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "ONLY"
+OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM_class-target = "NEVER"
 OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM_class-native = "BOTH"
 
 EXTRA_OECMAKE_append = " ${PACKAGECONFIG_CONFARGS}"
@@ -60,7 +61,7 @@ set( CMAKE_CXX_LINK_FLAGS "${OECMAKE_CXX_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
 
 # only search in the paths provided so cmake doesnt pick
 # up libraries and tools from the native build machine
-set( CMAKE_FIND_ROOT_PATH ${STAGING_DIR_HOST} ${STAGING_DIR_NATIVE} ${CROSS_DIR} ${OECMAKE_PERLNATIVE_DIR} ${OECMAKE_EXTRA_ROOT_PATH} ${EXTERNAL_TOOLCHAIN})
+set( CMAKE_FIND_ROOT_PATH ${STAGING_DIR_HOST} ${CROSS_DIR} ${OECMAKE_PERLNATIVE_DIR} ${OECMAKE_EXTRA_ROOT_PATH} ${EXTERNAL_TOOLCHAIN})
 set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )
 set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ${OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM} )
 set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
-- 
2.10.1



             reply	other threads:[~2016-10-29  8:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-29  8:47 Khem Raj [this message]
2016-10-30 13:34 ` [PATCH] cmake.bbclass: Exclude native sysroot from CMAKE_FIND_ROOT_PATH Andreas Müller
2016-10-30 17:38   ` Khem Raj
2016-10-30 20:07     ` Andreas Müller
2016-10-31 12:48       ` Andreas Müller
2016-10-31 16:25         ` Khem Raj
2016-10-31 17:49           ` Andreas Müller
2016-10-31 17:51             ` Andreas Müller
2016-11-01 18:28 ` Andre McCurdy
2016-11-01 18:33   ` Khem Raj
2016-11-05 16:39     ` Khem Raj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161029084707.29652-1-raj.khem@gmail.com \
    --to=raj.khem@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox