All of lore.kernel.org
 help / color / mirror / Atom feed
* [OE-core][master][PATCH] cmake: Unset CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES variable definition from toolchain file
@ 2023-11-29 11:28 aszh07
  2023-11-29 11:50 ` Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: aszh07 @ 2023-11-29 11:28 UTC (permalink / raw)
  To: openembedded-core, mail2szahir; +Cc: ranjitsinh.rathod, Zahir Hussain

From: Zahir Hussain <zahir.basha@kpit.com>

As discussion in [YOCTO #14717] cmake contains a OEToolchainConfig.cmake
file to configure the toolchain correctly in cross-compile build for recipes
using cmake.

The variable CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES value updates incorrectly
during do_compile the code. Due to this getting sporadic error like below,

fatal error: stdlib.h: No such file or directory
|    75 | #include_next <stdlib.h>
|       |               ^~~~~~~~~~
| compilation terminated.
| ninja: build stopped: subcommand failed.
| WARNING: exit code 1 from a shell command.

As cmake already correctly initializes the variable from environment, So we have to
unset it in the toolchain file to avoid overwriting the variable definition again.

Signed-off-by: aszh07 <mail2szahir@gmail.com>
Signed-off-by: Zahir Hussain <zahir.basha@kpit.com>
---
 meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake b/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake
index d6a1e0464c..6434b27371 100644
--- a/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake
+++ b/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake
@@ -18,3 +18,6 @@ file( GLOB toolchain_config_files "${CMAKE_CURRENT_LIST_FILE}.d/*.cmake" )
 foreach(config ${toolchain_config_files})
     include(${config})
 endforeach()
+
+unset(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES)
+unset(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES)
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [OE-core][master][PATCH] cmake: Unset CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES variable definition from toolchain file
  2023-11-29 11:28 [OE-core][master][PATCH] cmake: Unset CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES variable definition from toolchain file aszh07
@ 2023-11-29 11:50 ` Richard Purdie
  2023-11-30  9:11   ` [master][PATCH] " aszh07
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2023-11-29 11:50 UTC (permalink / raw)
  To: aszh07, openembedded-core; +Cc: ranjitsinh.rathod, Zahir Hussain

On Wed, 2023-11-29 at 16:58 +0530, aszh07 wrote:
> From: Zahir Hussain <zahir.basha@kpit.com>
> 
> As discussion in [YOCTO #14717] cmake contains a OEToolchainConfig.cmake
> file to configure the toolchain correctly in cross-compile build for recipes
> using cmake.
> 
> The variable CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES value updates incorrectly
> during do_compile the code. Due to this getting sporadic error like below,
> 
> fatal error: stdlib.h: No such file or directory
> >    75 | #include_next <stdlib.h>
> >       |               ^~~~~~~~~~
> > compilation terminated.
> > ninja: build stopped: subcommand failed.
> > WARNING: exit code 1 from a shell command.
> 
> As cmake already correctly initializes the variable from environment, So we have to
> unset it in the toolchain file to avoid overwriting the variable definition again.
> 
> Signed-off-by: aszh07 <mail2szahir@gmail.com>
> Signed-off-by: Zahir Hussain <zahir.basha@kpit.com>
> ---
>  meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake b/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake
> index d6a1e0464c..6434b27371 100644
> --- a/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake
> +++ b/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake
> @@ -18,3 +18,6 @@ file( GLOB toolchain_config_files "${CMAKE_CURRENT_LIST_FILE}.d/*.cmake" )
>  foreach(config ${toolchain_config_files})
>      include(${config})
>  endforeach()
> +
> +unset(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES)
> +unset(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES)

Can we add some kind of test cases for cmake so that we don't go in
circles with these bugs?

Cheers,

Richard


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [master][PATCH] cmake: Unset CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES variable definition from toolchain file
  2023-11-29 11:50 ` Richard Purdie
@ 2023-11-30  9:11   ` aszh07
  0 siblings, 0 replies; 3+ messages in thread
From: aszh07 @ 2023-11-30  9:11 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 109 bytes --]

You are correct, of course.
But currently, we don't have any test cases for this issue.

Cheers,
Zahir.

[-- Attachment #2: Type: text/html, Size: 919 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-30  9:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-29 11:28 [OE-core][master][PATCH] cmake: Unset CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES variable definition from toolchain file aszh07
2023-11-29 11:50 ` Richard Purdie
2023-11-30  9:11   ` [master][PATCH] " aszh07

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.