Openembedded Core Discussions
 help / color / mirror / Atom feed
From: <Mikko.Rapeli@bmw.de>
To: <pascal.bach@siemens.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file
Date: Fri, 24 Aug 2018 14:15:12 +0000	[thread overview]
Message-ID: <20180824141512.GG20864@hiutale> (raw)
In-Reply-To: <20180824123346.8602-1-pascal.bach@siemens.com>

On Fri, Aug 24, 2018 at 02:33:46PM +0200, Pascal Bach wrote:
> This already got fixed in the toolchain file that is used during development
> in https://github.com/openembedded/openembedded-core/commit/cb42802f2fe1760f894a435b07286bca3a220364
> 
> The toolchain file generated by the cmake.bbclass however does not set
> CMAKE_SYSROOT. Under certain circumstances this also leads to the error:
> `"stdlib.h: No such file or directory #include_next <stdlib.h>"`
> during the build of a recipe.
> 
> An example where this accured was during the upgrade of the Apache Thrift
> recipe in meta-openembedded to 0.11.0. With this change the build works out of
> the box.
> 
> CMAKE_SYSROOT must only be set when crosscompiling, otherwise it will interfere
> with the native compiler headers.
> 
> Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
> ---
>  meta/classes/cmake.bbclass | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
> index fd40a9863e..251ddd9afe 100644
> --- a/meta/classes/cmake.bbclass
> +++ b/meta/classes/cmake.bbclass
> @@ -64,9 +64,12 @@ def map_target_arch_to_uname_arch(target_arch):
>          return "ppc64"
>      return target_arch
>  
> +
>  cmake_do_generate_toolchain_file() {
>  	if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
>  		cmake_crosscompiling="set( CMAKE_CROSSCOMPILING FALSE )"
> +	else
> +		cmake_sysroot="set( CMAKE_SYSROOT \"${RECIPE_SYSROOT}\" )"
>  	fi
>  	cat > ${WORKDIR}/toolchain.cmake <<EOF
>  # CMake system name must be something like "Linux".
> @@ -95,6 +98,8 @@ set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ${OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM} )
>  set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
>  set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
>  
> +$cmake_sysroot
> +
>  # Use qt.conf settings
>  set( ENV{QT_CONF_PATH} ${WORKDIR}/qt.conf )

Fixes problems which we have also seen on sumo branch. Thanks for this!

Tested-by: Mikko Rapeli <mikko.rapeli@bmw.de>

  reply	other threads:[~2018-08-24 14:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-24 12:33 [PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file Pascal Bach
2018-08-24 14:15 ` Mikko.Rapeli [this message]
2018-08-24 14:43   ` Mikko.Rapeli
2018-08-24 15:10     ` Bach, Pascal
2018-08-24 15:44       ` Khem Raj
2018-08-24 15:48       ` Mikko.Rapeli
2018-08-24 15:51         ` Khem Raj
2018-08-24 16:17           ` Mikko.Rapeli
2018-08-24 16:23             ` Khem Raj
2018-08-24 16:41               ` Mikko.Rapeli
2018-08-24 16:44                 ` Khem Raj
2018-08-27 15:44 ` Khem Raj
2018-09-28 13:03   ` Bach, Pascal

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=20180824141512.GG20864@hiutale \
    --to=mikko.rapeli@bmw.de \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=pascal.bach@siemens.com \
    /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