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 15:48:22 +0000	[thread overview]
Message-ID: <20180824154822.GK20864@hiutale> (raw)
In-Reply-To: <355BE46A91031048906B695426A8D8E61B8A14FB@DEFTHW99EH4MSX.ww902.siemens.net>

On Fri, Aug 24, 2018 at 03:10:28PM +0000, Bach, Pascal wrote:
>  
> > > Fixes problems which we have also seen on sumo branch. Thanks for this!
> > 
> > Sorry, spoke too soon. This fixes compilation on a few recipes in my tree but
> > there are still lots failures with the same error message. We had a hacky
> > patch to cmake as a workaround but that too causes some problems:
> 
> I have not yet figured out what CMake based projects are affected and why.
> The error seems to happen only for certain projects.

In our case it looks like a library is adding target_include_directories()
with SYSTEM keyword in its cmake module. Everyone who includes the cmake module
fails to build. This repeats with a handful of cmake modules and causes all
of their dependencies to fail build with errors like:

.../recipe-sysroot/usr/include/c++/7.3.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
|  #include_next <stdlib.h>
|                ^~~~~~~~~~
| compilation terminated.

or

| cc1plus: warning: include location "/usr/include" is unsafe for cross-compilation [-Wpoison-system-directories]
...
.../recipe-sysroot/usr/include/stdlib.h:133:35: error: missing binary operator before token 
"("
|  #if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)
|                                    ^

So to me it looks like using SYSTEM with target_include_directories()
is no longer possible with CMake and gcc > 6:

https://cmake.org/cmake/help/v3.10/command/target_include_directories.html?highlight=target_include_directories

> > --- a/Modules/Compiler/GNU.cmake
> > +++ b/Modules/Compiler/GNU.cmake
> > @@ -45,7 +45,7 @@
> >    set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
> > "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E
> > <SOURCE> > <PREPROCESSED_SOURCE>")
> >    set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE
> > "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S
> > <SOURCE> -o <ASSEMBLY_SOURCE>")
> >    if(NOT APPLE OR NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS
> > 4) # work around #4462
> > -    set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
> > +    set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-I ")
> >    endif()
> > 
> >    set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
> > 
> > I wonder what the real fix could be...
> > 
> 
> This looks similar to another workaround I saw.
> Setting CMAKE_NO_SYSTEM_FROM_IMPORTED to True. I'm also not sure what the real fix is.
> The issue is also discussed here: https://gitlab.kitware.com/cmake/cmake/issues/16291

Thanks for the ticket link.

-Mikko

  parent reply	other threads:[~2018-08-24 15:48 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
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 [this message]
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=20180824154822.GK20864@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