public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Poonam Jadhav <ppjadhav456@gmail.com>
To: openembedded-core@lists.openembedded.org, poonam.jadhav@kpit.com
Cc: ranjitsinh.rathod@kpit.com, Pascal Bach <pascal.bach@siemens.com>,
	Mikko Rapeli <mikko.rapeli@bmw.de>,
	Poonam Jadhav <ppjadhav456@gmail.com>
Subject: [OE-core][master][PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file
Date: Fri, 21 Apr 2023 12:39:47 +0530	[thread overview]
Message-ID: <20230421070947.32523-1-ppjadhav456@gmail.com> (raw)

From: Pascal Bach <pascal.bach@siemens.com>

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>

(from http://lists.openembedded.org/pipermail/openembedded-core/2018-August/154791.html )

Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
Signed-off-by: Poonam Jadhav <poonam.jadhav@kpit.com>
Signed-off-by: Poonam Jadhav <ppjadhav456@gmail.com>
---
 meta/classes-recipe/cmake.bbclass | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta/classes-recipe/cmake.bbclass b/meta/classes-recipe/cmake.bbclass
index 554b948c32..301367b515 100644
--- a/meta/classes-recipe/cmake.bbclass
+++ b/meta/classes-recipe/cmake.bbclass
@@ -94,6 +94,8 @@ def map_host_arch_to_uname_arch(host_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".
@@ -126,6 +128,8 @@ set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
 set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
 set( CMAKE_PROGRAM_PATH "/" )
 
+$cmake_sysroot
+
 # Use qt.conf settings
 set( ENV{QT_CONF_PATH} ${WORKDIR}/qt.conf )
 
-- 
2.25.1



             reply	other threads:[~2023-04-21  7:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-21  7:09 Poonam Jadhav [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-04-21  6:07 [OE-core][master][PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file Poonam Jadhav

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=20230421070947.32523-1-ppjadhav456@gmail.com \
    --to=ppjadhav456@gmail.com \
    --cc=mikko.rapeli@bmw.de \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=pascal.bach@siemens.com \
    --cc=poonam.jadhav@kpit.com \
    --cc=ranjitsinh.rathod@kpit.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