Re: [OE-core] [PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file

2018-09-28 Thread Bach, Pascal
> since it was staged in oe-core/master-next, it got into my testing queue and
> is causing several recipes FTBFS
> 
> see
> 
> http://errors.yoctoproject.org/Errors/Build/66877/

I did some digging and it seems all of these failures are related.

Each of them is adding the host path /usr/include somewhere which should not be 
the case when cross compiling.
GCC even detects this and issues warnings: cc1: warning: include location 
"/usr/include" is unsafe for cross-compilation [-Wpoison-system-directories]

CMake has some magic inside that removes "implicit include" paths. By default 
this is set to "/urs/include" as this makes sense when doing non cross 
compilation.

Setting CMAKE_SYSROOT changes this as the "implicit include" paths are now re 
rooted to CMAKE_SYSROOT. This leads to CMake no longer considering /usr/include 
a special path and thus it is no longer removed.

In my opinion this is an issue with the recipes that failed. I already found 
how to fix it for wireshark and I will try to fix the others too, then I will 
send an updated patchset.

Pascal

> On Fri, Aug 24, 2018 at 5:34 AM Pascal Bach 
> wrote:
> >
> > This already got fixed in the toolchain file that is used during
> > development in
> > https://github.com/openembedded/openembedded-
> core/commit/cb42802f2fe17
> > 60f894a435b07286bca3a220364
> >
> > 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 "`
> > 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 
> > ---
> >  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 < > 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 )
> >
> > --
> > 2.11.0
> >
> > --
> > ___
> > Openembedded-core mailing list
> > Openembedded-core@lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file

2018-08-27 Thread Khem Raj
since it was staged in oe-core/master-next, it got into my
testing queue and is causing several recipes FTBFS

see

http://errors.yoctoproject.org/Errors/Build/66877/
On Fri, Aug 24, 2018 at 5:34 AM 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 "`
> 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 
> ---
>  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 <  # 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 )
>
> --
> 2.11.0
>
> --
> ___
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file

2018-08-24 Thread Khem Raj
On Fri, Aug 24, 2018 at 9:41 AM  wrote:
>
> On Fri, Aug 24, 2018 at 09:23:45AM -0700, Khem Raj wrote:
> > On Fri, Aug 24, 2018 at 9:17 AM  wrote:
> > >
> > > On Fri, Aug 24, 2018 at 08:51:42AM -0700, Khem Raj wrote:
> > > > On Fri, Aug 24, 2018 at 8:48 AM  wrote:
> > > > > 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
> > > > >
> > > >
> > > > That’s right there is a patch I did  in WebKitgtk recipe in Oe Core you
> > > > might want to include similar fixes for this package the patch actually 
> > > > it
> > > > a workaround but then I also think using isystem in apps is a bad idea
> > >
> > > Yes, I tend to agree, but developers have used this to silence compiler
> > > warnings from system header files.
> > >
> > > In a few cases I saw that there were no longer any warnings coming from 
> > > the
> > > headers but in some others there were.
> > >
> >
> > Unlike olden days, cross gcc compiler now a days knows about its
> > system headers and adds them implicitly with right options
> > so doing this include dance manually is not useful. Let compiler
> > decide to do the needed
> > for system headers, one must just specify --sysroot and let it handle
> > everything from sysroot.
> >
> > > Any other ideas how to suppress compiler wanings from system headers?
> > >
> >
> > what kind of warnings do you see ?
>
> After a ton of components have exported their headers to system paths,
> I see all kinds of crap. Some developers have cleaned up their own tree
> and added strict compiler flags, which I now have to relax since
> header file warning suppressions don't work, and new compiler produces
> new bunch of warnings. Here are few sample warnings from an ongoing build
> with counts redacted:
>
> $ egrep -ho "warning: .*" tmp-glibc/work/*/*/*/temp/log.do_compile| sort | 
> uniq -c|sort -rn | head -8
>
> warning: dynamic exception specifications are deprecated in C++11 
> [-Wdeprecated]
> warning: 'template class std::auto_ptr' is deprecated 
> [-Wdeprecated-declarations]
> warning: conversion to 'int' from 'long unsigned int' may alter its value 
> [-Wconversion]
> warning: missed loop optimization, the loop counter may overflow 
> [-Wunsafe-loop-optimizations]
> warning: command line option '-std=c++11' is valid for C++/ObjC++ but not for 
> C
> warning: this statement may fall through [-Wimplicit-fallthrough=]
> warning: ISO C++ forbids zero-size array 'f_handle' [-Wpedantic]
>

Perhaps you can just remove adding these system headers at all and let
compiler include
them for you

> -Mikko
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file

2018-08-24 Thread Mikko.Rapeli
On Fri, Aug 24, 2018 at 09:23:45AM -0700, Khem Raj wrote:
> On Fri, Aug 24, 2018 at 9:17 AM  wrote:
> >
> > On Fri, Aug 24, 2018 at 08:51:42AM -0700, Khem Raj wrote:
> > > On Fri, Aug 24, 2018 at 8:48 AM  wrote:
> > > > 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
> > > >
> > >
> > > That’s right there is a patch I did  in WebKitgtk recipe in Oe Core you
> > > might want to include similar fixes for this package the patch actually it
> > > a workaround but then I also think using isystem in apps is a bad idea
> >
> > Yes, I tend to agree, but developers have used this to silence compiler
> > warnings from system header files.
> >
> > In a few cases I saw that there were no longer any warnings coming from the
> > headers but in some others there were.
> >
> 
> Unlike olden days, cross gcc compiler now a days knows about its
> system headers and adds them implicitly with right options
> so doing this include dance manually is not useful. Let compiler
> decide to do the needed
> for system headers, one must just specify --sysroot and let it handle
> everything from sysroot.
> 
> > Any other ideas how to suppress compiler wanings from system headers?
> >
> 
> what kind of warnings do you see ?

After a ton of components have exported their headers to system paths,
I see all kinds of crap. Some developers have cleaned up their own tree
and added strict compiler flags, which I now have to relax since
header file warning suppressions don't work, and new compiler produces
new bunch of warnings. Here are few sample warnings from an ongoing build
with counts redacted:

$ egrep -ho "warning: .*" tmp-glibc/work/*/*/*/temp/log.do_compile| sort | uniq 
-c|sort -rn | head -8

warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
warning: 'template class std::auto_ptr' is deprecated 
[-Wdeprecated-declarations]
warning: conversion to 'int' from 'long unsigned int' may alter its value 
[-Wconversion]
warning: missed loop optimization, the loop counter may overflow 
[-Wunsafe-loop-optimizations]
warning: command line option '-std=c++11' is valid for C++/ObjC++ but not for C
warning: this statement may fall through [-Wimplicit-fallthrough=]
warning: ISO C++ forbids zero-size array 'f_handle' [-Wpedantic]

-Mikko
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file

2018-08-24 Thread Khem Raj
On Fri, Aug 24, 2018 at 9:17 AM  wrote:
>
> On Fri, Aug 24, 2018 at 08:51:42AM -0700, Khem Raj wrote:
> > On Fri, Aug 24, 2018 at 8:48 AM  wrote:
> > > 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
> > >
> >
> > That’s right there is a patch I did  in WebKitgtk recipe in Oe Core you
> > might want to include similar fixes for this package the patch actually it
> > a workaround but then I also think using isystem in apps is a bad idea
>
> Yes, I tend to agree, but developers have used this to silence compiler
> warnings from system header files.
>
> In a few cases I saw that there were no longer any warnings coming from the
> headers but in some others there were.
>

Unlike olden days, cross gcc compiler now a days knows about its
system headers and adds them implicitly with right options
so doing this include dance manually is not useful. Let compiler
decide to do the needed
for system headers, one must just specify --sysroot and let it handle
everything from sysroot.

> Any other ideas how to suppress compiler wanings from system headers?
>

what kind of warnings do you see ?

> -Mikko
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file

2018-08-24 Thread Mikko.Rapeli
On Fri, Aug 24, 2018 at 08:51:42AM -0700, Khem Raj wrote:
> On Fri, Aug 24, 2018 at 8:48 AM  wrote:
> > 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
> >
> 
> That’s right there is a patch I did  in WebKitgtk recipe in Oe Core you
> might want to include similar fixes for this package the patch actually it
> a workaround but then I also think using isystem in apps is a bad idea

Yes, I tend to agree, but developers have used this to silence compiler
warnings from system header files.

In a few cases I saw that there were no longer any warnings coming from the
headers but in some others there were.

Any other ideas how to suppress compiler wanings from system headers?

-Mikko
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file

2018-08-24 Thread Khem Raj
On Fri, Aug 24, 2018 at 8:48 AM  wrote:

> On Fri, Aug 24, 2018 at 03:10:28PM +, 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 
> |^~
> | 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
>

That’s right there is a patch I did  in WebKitgtk recipe in Oe Core you
might want to include similar fixes for this package the patch actually it
a workaround but then I also think using isystem in apps is a bad idea

>
> > > --- a/Modules/Compiler/GNU.cmake
> > > +++ b/Modules/Compiler/GNU.cmake
> > > @@ -45,7 +45,7 @@
> > >set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
> > > "-E
> > >  > ")
> > >set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE
> > > "-S
> > >  -o ")
> > >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
> --
> ___
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file

2018-08-24 Thread Mikko.Rapeli
On Fri, Aug 24, 2018 at 03:10:28PM +, 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 
|^~
| 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
> > "-E
> >  > ")
> >set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE
> > "-S
> >  -o ")
> >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
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file

2018-08-24 Thread Khem Raj
On Fri, Aug 24, 2018 at 8:19 AM 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.
>
> > --- a/Modules/Compiler/GNU.cmake
> > +++ b/Modules/Compiler/GNU.cmake
> > @@ -45,7 +45,7 @@
> >set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
> > "-E
> >  > ")
> >set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE
> > "-S
> >  -o ")
> >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
>

IIRC this was a defect in cmake

>
> Pascal
> --
> ___
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file

2018-08-24 Thread Bach, Pascal
 
> > 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.

> --- a/Modules/Compiler/GNU.cmake
> +++ b/Modules/Compiler/GNU.cmake
> @@ -45,7 +45,7 @@
>set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
> "-E
>  > ")
>set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE
> "-S
>  -o ")
>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

Pascal
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file

2018-08-24 Thread Mikko.Rapeli
> 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:

--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -45,7 +45,7 @@
   set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " 
   -E  > ")
   set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "  
  -S  -o ")
   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...

-Mikko
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file

2018-08-24 Thread Mikko.Rapeli
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 "`
> 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 
> ---
>  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 <  # 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 
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] cmake: add CMAKE_SYSROOT to generated toolchain file

2018-08-24 Thread Pascal Bach
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 "`
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 
---
 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