qt5: Disable passing of -isystem flag in CXXFLAGS
diff mbox

Message ID 1474642729-40702-1-git-send-email-abrodkin@synopsys.com
State Accepted
Headers show

Commit Message

Alexey Brodkin Sept. 23, 2016, 2:58 p.m. UTC
Some Qt5 sub-projects as well as 3rd-party apps written on Qt
are failing to compile with gcc 6.x like that:
---------------------------->8-------------------------
In file included from XXX/output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/bits/stl_algo.h:59:0,
                 from XXX/output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/algorithm:62,
                 from XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/include/qt5/QtCore/qglobal.h:88,
                 from XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/include/qt5/QtCore/qpair.h:37,
                 from qmediametadata.h:37,
                 from qmediametadata.cpp:28:
XXX/output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/cstdlib:75:25: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
                         ^
compilation terminated.
---------------------------->8-------------------------

That happens because qmake trying to play smart passes some
include paths in Makefile with "-isystem" prefix.
Which in some cases lead to build failure well described in [1].

A little bit more details below on what really happens:

1. In "configure" script Qt determines default include paths of the
   toolchain and stores them in DEFAULT_INCDIRS variable, see [2].

2. On qmake execution when it creates Makefile out of .pro-file
   it parses headers in INCLUDEPATH variable and if a path matches
   one in DEFAULT_INCDIRS then in CXXFLAGS that path is written
   with $QMAKE_CFLAGS_ISYSTEM prefix, otherwise non-matching include
   path ends up in CXXFLAGS with normal "-I" prefix.

3. By default for gcc "QMAKE_CFLAGS_ISYSTEM = -isystem", see [3].

4. gcc fails to find stdlib.h, again refer to Jörg's explanation in [1].

What we do here we force set QMAKE_CFLAGS_ISYSTEM to "" and so qmake
won't use "-isystem" any longer instead expected "-I" will be used for
all headers, see [4].

That fixes building of Qt5Webkit on ARM with gcc 6.x and a number of
autobuilder failures for ARC (the an arch that uses gcc 6 by default) like:
http://autobuild.buildroot.net/results/56a/56a6700774af692e7f5a99b452b15e4e8592310f
http://autobuild.buildroot.net/results/697/697412b29bf031bf8f246cc3af97ebcbf6bf6d1b

[1] https://git.buildroot.net/buildroot/commit/?id=e79272fa7ff3d66c18de3514b912cd9d68d121a4
[2] http://code.qt.io/cgit/qt/qtbase.git/tree/configure?h=5.6.1#n3660
[3] http://code.qt.io/cgit/qt/qtbase.git/tree/mkspecs/common/gcc-base.conf?h=5.6.1#n47
[4] http://code.qt.io/cgit/qt/qtbase.git/tree/qmake/generators/unix/unixmake2.cpp?&h=5.6.1#n193

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Peter Seiderer <ps.report@gmx.net>
Cc: Julien Corjon <corjon.j@ecagroup.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 package/qt5/qt5base/qmake.conf | 1 +
 1 file changed, 1 insertion(+)

Comments

Arnout Vandecappelle Sept. 23, 2016, 10:11 p.m. UTC | #1
Hi Alexey,

 Excellent commit log!

On 23-09-16 16:58, Alexey Brodkin wrote:
> Some Qt5 sub-projects as well as 3rd-party apps written on Qt
> are failing to compile with gcc 6.x like that:
> ---------------------------->8-------------------------
> In file included from XXX/output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/bits/stl_algo.h:59:0,
>                  from XXX/output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/algorithm:62,
>                  from XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/include/qt5/QtCore/qglobal.h:88,
>                  from XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/include/qt5/QtCore/qpair.h:37,
>                  from qmediametadata.h:37,
>                  from qmediametadata.cpp:28:
> XXX/output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/cstdlib:75:25: fatal error: stdlib.h: No such file or directory
>  #include_next <stdlib.h>
>                          ^
> compilation terminated.
> ---------------------------->8-------------------------
> 
> That happens because qmake trying to play smart passes some
> include paths in Makefile with "-isystem" prefix.
> Which in some cases lead to build failure well described in [1].
> 
> A little bit more details below on what really happens:
> 
> 1. In "configure" script Qt determines default include paths of the
>    toolchain and stores them in DEFAULT_INCDIRS variable, see [2].
> 
> 2. On qmake execution when it creates Makefile out of .pro-file
>    it parses headers in INCLUDEPATH variable and if a path matches
>    one in DEFAULT_INCDIRS then in CXXFLAGS that path is written
>    with $QMAKE_CFLAGS_ISYSTEM prefix, otherwise non-matching include
>    path ends up in CXXFLAGS with normal "-I" prefix.
> 
> 3. By default for gcc "QMAKE_CFLAGS_ISYSTEM = -isystem", see [3].
> 
> 4. gcc fails to find stdlib.h, again refer to Jörg's explanation in [1].

 There is one difference here, however: In Jörg's explanation, it's about
headers which really aren't system headers (protobuf). But in this case, the
headers really are system headers.

> 
> What we do here we force set QMAKE_CFLAGS_ISYSTEM to "" and so qmake
> won't use "-isystem" any longer instead expected "-I" will be used for
> all headers, see [4].

 Another option would be to set it to -idirafter, which puts the directory at
the end of the default search path and I think it also still treats it as a
system directory. But that would possibly lead to even worse side effects, so
maybe not such a good idea.

 I still don't understand how the -I$(STAGING_DIR)/usr/include gets added, by
the way. Isn't pkg-config supposed to suppress those, because they already are
in the default search path? For instance, on my system I have a xf86dgaproto.pc
which contains Cflags: -I${includedir}, but pkg-config --cflags xf86dgaproto
gives empty.


 But in the end it will probably come down to this patch anyway, so

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

However, I propose to wait another week or so to see if someone else comes up
with a better idea.


 Regards,
 Arnout

> 
> That fixes building of Qt5Webkit on ARM with gcc 6.x and a number of
> autobuilder failures for ARC (the an arch that uses gcc 6 by default) like:
> http://autobuild.buildroot.net/results/56a/56a6700774af692e7f5a99b452b15e4e8592310f
> http://autobuild.buildroot.net/results/697/697412b29bf031bf8f246cc3af97ebcbf6bf6d1b
> 
> [1] https://git.buildroot.net/buildroot/commit/?id=e79272fa7ff3d66c18de3514b912cd9d68d121a4
> [2] http://code.qt.io/cgit/qt/qtbase.git/tree/configure?h=5.6.1#n3660
> [3] http://code.qt.io/cgit/qt/qtbase.git/tree/mkspecs/common/gcc-base.conf?h=5.6.1#n47
> [4] http://code.qt.io/cgit/qt/qtbase.git/tree/qmake/generators/unix/unixmake2.cpp?&h=5.6.1#n193
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Peter Seiderer <ps.report@gmx.net>
> Cc: Julien Corjon <corjon.j@ecagroup.com>
> Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
>  package/qt5/qt5base/qmake.conf | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/package/qt5/qt5base/qmake.conf b/package/qt5/qt5base/qmake.conf
> index 2152d3c..49cf898 100644
> --- a/package/qt5/qt5base/qmake.conf
> +++ b/package/qt5/qt5base/qmake.conf
> @@ -19,6 +19,7 @@ QMAKE_CXXFLAGS_RELEASE += -O3
>  CONFIG                 += nostrip
>  
>  QMAKE_LIBS             += -lrt -lpthread -ldl
> +QMAKE_CFLAGS_ISYSTEM   =
>  
>  include(../common/linux_device_post.conf)
>  load(qt_config)
>
Alexey Brodkin Sept. 26, 2016, 11:30 a.m. UTC | #2
Hi Arnout,

On Sat, 2016-09-24 at 00:11 +0200, Arnout Vandecappelle wrote:
>  Hi Alexey,

> 

>  Excellent commit log!


That a pleasure to read this kind of comments really :)

> On 23-09-16 16:58, Alexey Brodkin wrote:

> > 

> > Some Qt5 sub-projects as well as 3rd-party apps written on Qt

> > are failing to compile with gcc 6.x like that:

> > ---------------------------->8-------------------------

> > In file included from XXX/output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/bits/stl_algo.h:59:0,

> >                  from XXX/output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/algorithm:62,

> >                  from XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/include/qt5/QtCore/qglobal.h:88,

> >                  from XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/include/qt5/QtCore/qpair.h:37,

> >                  from qmediametadata.h:37,

> >                  from qmediametadata.cpp:28:

> > XXX/output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/cstdlib:75:25: fatal error: stdlib.h: No such file

> > or directory

> >  #include_next <stdlib.h>

> >                          ^

> > compilation terminated.

> > ---------------------------->8-------------------------

> > 

> > That happens because qmake trying to play smart passes some

> > include paths in Makefile with "-isystem" prefix.

> > Which in some cases lead to build failure well described in [1].

> > 

> > A little bit more details below on what really happens:

> > 

> > 1. In "configure" script Qt determines default include paths of the

> >    toolchain and stores them in DEFAULT_INCDIRS variable, see [2].

> > 

> > 2. On qmake execution when it creates Makefile out of .pro-file

> >    it parses headers in INCLUDEPATH variable and if a path matches

> >    one in DEFAULT_INCDIRS then in CXXFLAGS that path is written

> >    with $QMAKE_CFLAGS_ISYSTEM prefix, otherwise non-matching include

> >    path ends up in CXXFLAGS with normal "-I" prefix.

> > 

> > 3. By default for gcc "QMAKE_CFLAGS_ISYSTEM = -isystem", see [3].

> > 

> > 4. gcc fails to find stdlib.h, again refer to Jörg's explanation in [1].

> 

>  There is one difference here, however: In Jörg's explanation, it's about

> headers which really aren't system headers (protobuf). But in this case, the

> headers really are system headers.


Indeed.

> > 

> > 

> > What we do here we force set QMAKE_CFLAGS_ISYSTEM to "" and so qmake

> > won't use "-isystem" any longer instead expected "-I" will be used for

> > all headers, see [4].

> 

>  Another option would be to set it to -idirafter, which puts the directory at

> the end of the default search path and I think it also still treats it as a

> system directory. But that would possibly lead to even worse side effects, so

> maybe not such a good idea.

> 

>  I still don't understand how the -I$(STAGING_DIR)/usr/include gets added, by

> the way. Isn't pkg-config supposed to suppress those, because they already are

> in the default search path? For instance, on my system I have a xf86dgaproto.pc

> which contains Cflags: -I${includedir}, but pkg-config --cflags xf86dgaproto

> gives empty.


That's how:
--------------------->8--------------------
export PATH=/XXX/output/host/usr/bin/:$PATH
/XXX/output/build/qt5webkit-b889f460280ad98c89ede179bd3b9ce9cb02002b/Tools/qmake/config.tests/icu/pkg-config_wrapper.sh
--libs icu-i18n
-licui18n -L/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib -licuuc -licudata  
--------------------->8--------------------

Looks like .pc files from "XXX/output/host/usr/lib/pkgconfig" are used.

And just FYI contents of "pkg-config_wrapper.sh":
--------------------->8--------------------
ccat /XXX/output/build/qt5webkit-b889f460280ad98c89ede179bd3b9ce9cb02002b/Tools/qmake/config.tests/icu/pkg-
config_wrapper.sh 
#!/bin/sh
PKG_CONFIG_SYSROOT_DIR=/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot
export PKG_CONFIG_SYSROOT_DIR
PKG_CONFIG_LIBDIR=/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib/pkgconfig
export PKG_CONFIG_LIBDIR
exec pkg-config "$@"
--------------------->8--------------------

-Alexey
Arnout Vandecappelle Sept. 27, 2016, 10:33 p.m. UTC | #3
On 26-09-16 13:30, Alexey Brodkin wrote:
> Hi Arnout,
> 
> On Sat, 2016-09-24 at 00:11 +0200, Arnout Vandecappelle wrote:
[snip]
>>  I still don't understand how the -I$(STAGING_DIR)/usr/include gets added, by
>> the way. Isn't pkg-config supposed to suppress those, because they already are
>> in the default search path? For instance, on my system I have a xf86dgaproto.pc
>> which contains Cflags: -I${includedir}, but pkg-config --cflags xf86dgaproto
>> gives empty.

 I mean that it's _our_ pkg-config that does the wrong thing.

------ output/staging/usr/lib/pkgconfig/libpcre.pc --------
# Package Information for pkg-config

prefix=/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libpcre
Description: PCRE - Perl compatible regular expressions C library with 8 bit
character support
Version: 8.39
Libs: -L${libdir} -lpcre
Libs.private:
Cflags: -I${includedir}
------------------------------------------------------------

output/host/usr/bin/pkg-config --cflags libpcre
-IXXX/output/host/usr/arm-buildroot-linux-musleabihf/sysroot/usr/include

 According to me, this should have returned empty.

 So I've checked, and it looks like this is a feature of the full-fledged
pkg-config that pkgconf doesn't have:

pkg-config --cflags libpcre
<empty>

output/host/usr/bin/pkgconf --cflags libpcre
-I/usr/include

 So ideally, we should patch pkgconf (and send upstream) to remove the default
search paths.


> 
> That's how:
> --------------------->8--------------------
> export PATH=/XXX/output/host/usr/bin/:$PATH
> /XXX/output/build/qt5webkit-b889f460280ad98c89ede179bd3b9ce9cb02002b/Tools/qmake/config.tests/icu/pkg-config_wrapper.sh
> --libs icu-i18n
> -licui18n -L/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib -licuuc -licudata  
> --------------------->8--------------------
> 
> Looks like .pc files from "XXX/output/host/usr/lib/pkgconfig" are used.

 No, it's from the staging dir
XXX/output/host/usr/<tuple>/sysroot/usr/lib/pkgconfig

> 
> And just FYI contents of "pkg-config_wrapper.sh":
> --------------------->8--------------------
> ccat /XXX/output/build/qt5webkit-b889f460280ad98c89ede179bd3b9ce9cb02002b/Tools/qmake/config.tests/icu/pkg-
> config_wrapper.sh 
> #!/bin/sh
> PKG_CONFIG_SYSROOT_DIR=/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot
> export PKG_CONFIG_SYSROOT_DIR
> PKG_CONFIG_LIBDIR=/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib/pkgconfig

 See?

 Regards,
 Arnout

> export PKG_CONFIG_LIBDIR
> exec pkg-config "$@"
> --------------------->8--------------------
> 
> -Alexey
>
Alexey Brodkin Sept. 28, 2016, 8:54 a.m. UTC | #4
Hi Arnout,

On Wed, 2016-09-28 at 00:33 +0200, Arnout Vandecappelle wrote:
> 

> On 26-09-16 13:30, Alexey Brodkin wrote:

> > 

> > Hi Arnout,

> > 

> > On Sat, 2016-09-24 at 00:11 +0200, Arnout Vandecappelle wrote:

> [snip]

> > 

> > > 

> > >  I still don't understand how the -I$(STAGING_DIR)/usr/include gets added, by

> > > the way. Isn't pkg-config supposed to suppress those, because they already are

> > > in the default search path? For instance, on my system I have a xf86dgaproto.pc

> > > which contains Cflags: -I${includedir}, but pkg-config --cflags xf86dgaproto

> > > gives empty.

> 

>  I mean that it's _our_ pkg-config that does the wrong thing.

> 

> ------ output/staging/usr/lib/pkgconfig/libpcre.pc --------

> # Package Information for pkg-config

> 

> prefix=/usr

> exec_prefix=/usr

> libdir=${exec_prefix}/lib

> includedir=${prefix}/include

> 

> Name: libpcre

> Description: PCRE - Perl compatible regular expressions C library with 8 bit

> character support

> Version: 8.39

> Libs: -L${libdir} -lpcre

> Libs.private:

> Cflags: -I${includedir}

> ------------------------------------------------------------

> 

> output/host/usr/bin/pkg-config --cflags libpcre

> -IXXX/output/host/usr/arm-buildroot-linux-musleabihf/sysroot/usr/include

> 

>  According to me, this should have returned empty.

> 

>  So I've checked, and it looks like this is a feature of the full-fledged

> pkg-config that pkgconf doesn't have:

> 

> pkg-config --cflags libpcre

> <empty>

> 

> output/host/usr/bin/pkgconf --cflags libpcre

> -I/usr/include


Well note in our case pkg-config is just a wrapper script
that is created out of BR's "package/pkgconf/pkg-config.in":
--------------------->8--------------------
cat ./output/host/usr/bin/pkg-config
#!/bin/sh
PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-/XXX/output/host/usr/arc-buildroot-linux-
uclibc/sysroot/usr/lib/pkgconfig:/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/share/pkgconfig}
PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot} $(dirname
$0)/pkgconf  $@
--------------------->8--------------------

So it all boils down to:
1) "pkg-config" case:
--------------------->8--------------------
PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib/pkgconfig}
PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot}
./output/host/usr/bin/pkgconf --libs icu-i18n
-licui18n -L/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib -licuuc -licudata
--------------------->8--------------------

2. Pure "pkgconf" case:
--------------------->8--------------------
./output/host/usr/bin/pkgconf --libs icu-i18n
-licui18n -licuuc -licudata
--------------------->8--------------------

>  So ideally, we should patch pkgconf (and send upstream) to remove the default

> search paths.


Given my comments above I'm not really sure it's pkgconf who's guilty.

Any thoughts?

-Alexey
Thomas Petazzoni Sept. 28, 2016, 8:57 a.m. UTC | #5
Hello,

On Wed, 28 Sep 2016 00:33:16 +0200, Arnout Vandecappelle wrote:

>  I mean that it's _our_ pkg-config that does the wrong thing.
> 
> ------ output/staging/usr/lib/pkgconfig/libpcre.pc --------
> # Package Information for pkg-config
> 
> prefix=/usr
> exec_prefix=/usr
> libdir=${exec_prefix}/lib
> includedir=${prefix}/include
> 
> Name: libpcre
> Description: PCRE - Perl compatible regular expressions C library with 8 bit
> character support
> Version: 8.39
> Libs: -L${libdir} -lpcre
> Libs.private:
> Cflags: -I${includedir}
> ------------------------------------------------------------
> 
> output/host/usr/bin/pkg-config --cflags libpcre
> -IXXX/output/host/usr/arm-buildroot-linux-musleabihf/sysroot/usr/include
> 
>  According to me, this should have returned empty.

So in other words, you're withdrawing your Reviewed-by on Alexey's
patch, and say that we should fix host-pkgconf instead, right ?

Thomas
Arnout Vandecappelle Sept. 29, 2016, 9:05 p.m. UTC | #6
On 28-09-16 10:54, Alexey Brodkin wrote:
> So it all boils down to:
> 1) "pkg-config" case:
> --------------------->8--------------------
> PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib/pkgconfig}
> PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot}
> ./output/host/usr/bin/pkgconf --libs icu-i18n
> -licui18n -L/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib -licuuc -licudata
> --------------------->8--------------------
> 
> 2. Pure "pkgconf" case:
> --------------------->8--------------------
> ./output/host/usr/bin/pkgconf --libs icu-i18n
> -licui18n -licuuc -licudata
> --------------------->8--------------------

 Your pure pkgconf case is using the host icu-i18n, that's why the -L flag is
missing. The host icu-i18n doesn't have a -L bit in its Libs: stanza.

 You should compare:

1) pkgconf case
PKG_CONFIG_LIBDIR=$STAGING_DIR/usr/lib/pkgconfig
PKG_CONFIG_SYSROOT_DIR=$STAGING_DIR/sysroot output/host/usr/bin/pkgconf --libs
icu-i18n
-licui18n -L$STAGING_DIR/usr/lib -licuuc -licudata

2) Real pkg-config case:
PKG_CONFIG_LIBDIR=$STAGING_DIR/usr/lib/pkgconfig
PKG_CONFIG_SYSROOT_DIR=$STAGING_DIR/sysroot /usr/bin/pkg-config --libs icu-i18n
-licui18n -licuuc -licudata

 We switched from pkg-config to pkgconf because it builds a whole lot faster
(pkg-config has a whole lot of dependencies). Obviously we give up features with
that, but this is the first one where I think it is an important feature that
we're missing.

 Regards,
 Arnout

> 
>> >  So ideally, we should patch pkgconf (and send upstream) to remove the default
>> > search paths.
> Given my comments above I'm not really sure it's pkgconf who's guilty.
Arnout Vandecappelle Sept. 29, 2016, 9:30 p.m. UTC | #7
On 28-09-16 10:57, Thomas Petazzoni wrote:
> Hello,
> 
> On Wed, 28 Sep 2016 00:33:16 +0200, Arnout Vandecappelle wrote:
> 
>>  I mean that it's _our_ pkg-config that does the wrong thing.
>>
>> ------ output/staging/usr/lib/pkgconfig/libpcre.pc --------
>> # Package Information for pkg-config
>>
>> prefix=/usr
>> exec_prefix=/usr
>> libdir=${exec_prefix}/lib
>> includedir=${prefix}/include
>>
>> Name: libpcre
>> Description: PCRE - Perl compatible regular expressions C library with 8 bit
>> character support
>> Version: 8.39
>> Libs: -L${libdir} -lpcre
>> Libs.private:
>> Cflags: -I${includedir}
>> ------------------------------------------------------------
>>
>> output/host/usr/bin/pkg-config --cflags libpcre
>> -IXXX/output/host/usr/arm-buildroot-linux-musleabihf/sysroot/usr/include
>>
>>  According to me, this should have returned empty.
> 
> So in other words, you're withdrawing your Reviewed-by on Alexey's
> patch, and say that we should fix host-pkgconf instead, right ?
>
> Thomas


 Au contraire. Ideally host-pkgconf should be improved, but that's not a simple
task. Until then, Alexey's patch will work.

 Regards,
 Arnout
Arnout Vandecappelle Sept. 29, 2016, 9:34 p.m. UTC | #8
On 29-09-16 23:05, Arnout Vandecappelle wrote:
> 
> 
> On 28-09-16 10:54, Alexey Brodkin wrote:
>> So it all boils down to:
>> 1) "pkg-config" case:
>> --------------------->8--------------------
>> PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib/pkgconfig}
>> PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot}
>> ./output/host/usr/bin/pkgconf --libs icu-i18n
>> -licui18n -L/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib -licuuc -licudata
>> --------------------->8--------------------
>>
>> 2. Pure "pkgconf" case:
>> --------------------->8--------------------
>> ./output/host/usr/bin/pkgconf --libs icu-i18n
>> -licui18n -licuuc -licudata
>> --------------------->8--------------------
> 
>  Your pure pkgconf case is using the host icu-i18n, that's why the -L flag is
> missing. The host icu-i18n doesn't have a -L bit in its Libs: stanza.

 Hm, actually, icu-uc.pc *does* have a -L bit in its Libs: stanza. But for the
host, I guess it recognizes that ${libdir} == /usr/lib so it can be eliminated.
So perhaps that can be extended to cover a sysroot as well.

 BTW, I did a quick test with pkgconf 1.0.1 and it still behaves the same.

 Regards,
 Arnout

> 
>  You should compare:
> 
> 1) pkgconf case
> PKG_CONFIG_LIBDIR=$STAGING_DIR/usr/lib/pkgconfig
> PKG_CONFIG_SYSROOT_DIR=$STAGING_DIR/sysroot output/host/usr/bin/pkgconf --libs
> icu-i18n
> -licui18n -L$STAGING_DIR/usr/lib -licuuc -licudata
> 
> 2) Real pkg-config case:
> PKG_CONFIG_LIBDIR=$STAGING_DIR/usr/lib/pkgconfig
> PKG_CONFIG_SYSROOT_DIR=$STAGING_DIR/sysroot /usr/bin/pkg-config --libs icu-i18n
> -licui18n -licuuc -licudata
> 
>  We switched from pkg-config to pkgconf because it builds a whole lot faster
> (pkg-config has a whole lot of dependencies). Obviously we give up features with
> that, but this is the first one where I think it is an important feature that
> we're missing.
> 
>  Regards,
>  Arnout
> 
>>
>>>>  So ideally, we should patch pkgconf (and send upstream) to remove the default
>>>> search paths.
>> Given my comments above I'm not really sure it's pkgconf who's guilty.
>
Alexey Brodkin Sept. 30, 2016, 8:54 a.m. UTC | #9
Hi Arnout,

On Thu, 2016-09-29 at 23:05 +0200, Arnout Vandecappelle wrote:
> 

> On 28-09-16 10:54, Alexey Brodkin wrote:

> > 

> > So it all boils down to:

> > 1) "pkg-config" case:

> > --------------------->8--------------------

> > PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib/pkgconfig}

> > PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot}

> > ./output/host/usr/bin/pkgconf --libs icu-i18n

> > -licui18n -L/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib -licuuc -licudata

> > --------------------->8--------------------

> > 

> > 2. Pure "pkgconf" case:

> > --------------------->8--------------------

> > ./output/host/usr/bin/pkgconf --libs icu-i18n

> > -licui18n -licuuc -licudata

> > --------------------->8--------------------

> 

>  Your pure pkgconf case is using the host icu-i18n, that's why the -L flag is

> missing. The host icu-i18n doesn't have a -L bit in its Libs: stanza.

> 

>  You should compare:

> 

> 1) pkgconf case

> PKG_CONFIG_LIBDIR=$STAGING_DIR/usr/lib/pkgconfig

> PKG_CONFIG_SYSROOT_DIR=$STAGING_DIR/sysroot output/host/usr/bin/pkgconf --libs

> icu-i18n

> -licui18n -L$STAGING_DIR/usr/lib -licuuc -licudata

> 

> 2) Real pkg-config case:

> PKG_CONFIG_LIBDIR=$STAGING_DIR/usr/lib/pkgconfig

> PKG_CONFIG_SYSROOT_DIR=$STAGING_DIR/sysroot /usr/bin/pkg-config --libs icu-i18n

> -licui18n -licuuc -licudata

> 

>  We switched from pkg-config to pkgconf because it builds a whole lot faster

> (pkg-config has a whole lot of dependencies). Obviously we give up features with

> that, but this is the first one where I think it is an important feature that

> we're missing.


Thanks for explanation that definitely makes sense.

-Alexey
Alexey Brodkin Sept. 30, 2016, 8:55 a.m. UTC | #10
Hi Arnout,

On Thu, 2016-09-29 at 23:34 +0200, Arnout Vandecappelle wrote:
> 

> On 29-09-16 23:05, Arnout Vandecappelle wrote:

> > 

> > 

> > 

> > On 28-09-16 10:54, Alexey Brodkin wrote:

> > > 

> > > So it all boils down to:

> > > 1) "pkg-config" case:

> > > --------------------->8--------------------

> > > PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib/pkgconfig}

> > > PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot}

> > > ./output/host/usr/bin/pkgconf --libs icu-i18n

> > > -licui18n -L/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib -licuuc -licudata

> > > --------------------->8--------------------

> > > 

> > > 2. Pure "pkgconf" case:

> > > --------------------->8--------------------

> > > ./output/host/usr/bin/pkgconf --libs icu-i18n

> > > -licui18n -licuuc -licudata

> > > --------------------->8--------------------

> > 

> >  Your pure pkgconf case is using the host icu-i18n, that's why the -L flag is

> > missing. The host icu-i18n doesn't have a -L bit in its Libs: stanza.

> 

>  Hm, actually, icu-uc.pc *does* have a -L bit in its Libs: stanza. But for the

> host, I guess it recognizes that ${libdir} == /usr/lib so it can be eliminated.

> So perhaps that can be extended to cover a sysroot as well.

> 

>  BTW, I did a quick test with pkgconf 1.0.1 and it still behaves the same.


Shall we then file an issue here https://github.com/pkgconf/pkgconf/issues ?

-Alexey
Alexey Brodkin Oct. 5, 2016, 7:12 a.m. UTC | #11
Hi Thomas, Arnout,

On Fri, 2016-09-30 at 11:55 +0300, Alexey Brodkin wrote:
> Hi Arnout,

> 

> On Thu, 2016-09-29 at 23:34 +0200, Arnout Vandecappelle wrote:

> > 

> > 

> > On 29-09-16 23:05, Arnout Vandecappelle wrote:

> > > 

> > > 

> > > 

> > > 

> > > On 28-09-16 10:54, Alexey Brodkin wrote:

> > > > 

> > > > 

> > > > So it all boils down to:

> > > > 1) "pkg-config" case:

> > > > --------------------->8--------------------

> > > > PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-/XXX/output/host/usr/arc-buildroot-linux-

> > > > uclibc/sysroot/usr/lib/pkgconfig}

> > > > PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot}

> > > > ./output/host/usr/bin/pkgconf --libs icu-i18n

> > > > -licui18n -L/XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib -licuuc -licudata

> > > > --------------------->8--------------------

> > > > 

> > > > 2. Pure "pkgconf" case:

> > > > --------------------->8--------------------

> > > > ./output/host/usr/bin/pkgconf --libs icu-i18n

> > > > -licui18n -licuuc -licudata

> > > > --------------------->8--------------------

> > > 

> > >  Your pure pkgconf case is using the host icu-i18n, that's why the -L flag is

> > > missing. The host icu-i18n doesn't have a -L bit in its Libs: stanza.

> > 

> >  Hm, actually, icu-uc.pc *does* have a -L bit in its Libs: stanza. But for the

> > host, I guess it recognizes that ${libdir} == /usr/lib so it can be eliminated.

> > So perhaps that can be extended to cover a sysroot as well.

> > 

> >  BTW, I did a quick test with pkgconf 1.0.1 and it still behaves the same.

> 

> Shall we then file an issue here https://github.com/pkgconf/pkgconf/issues ?


I'm wondering if there're any other thoughts on this one?
We're seeing more and more instances of that problem, for example with
qt5serialport here http://autobuild.buildroot.net/results/b14/b143bc806d45a91d52c43fa49227e88dc8a105d5/

So if there're no objections we may apply this one and see if it breaks anything
while we're far enough from the next BR release and in the worst case we'll just revert it
further down the line.

-Alexey
Thomas Petazzoni Oct. 5, 2016, 8:01 a.m. UTC | #12
Hello,

On Fri, 23 Sep 2016 17:58:49 +0300, Alexey Brodkin wrote:
> Some Qt5 sub-projects as well as 3rd-party apps written on Qt
> are failing to compile with gcc 6.x like that:
> ---------------------------->8-------------------------  
> In file included from XXX/output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/bits/stl_algo.h:59:0,
>                  from XXX/output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/algorithm:62,
>                  from XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/include/qt5/QtCore/qglobal.h:88,
>                  from XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/include/qt5/QtCore/qpair.h:37,
>                  from qmediametadata.h:37,
>                  from qmediametadata.cpp:28:
> XXX/output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/cstdlib:75:25: fatal error: stdlib.h: No such file or directory
>  #include_next <stdlib.h>
>                          ^
> compilation terminated.
> ---------------------------->8-------------------------  

Applied to master, thanks a lot!

Thomas

Patch
diff mbox

diff --git a/package/qt5/qt5base/qmake.conf b/package/qt5/qt5base/qmake.conf
index 2152d3c..49cf898 100644
--- a/package/qt5/qt5base/qmake.conf
+++ b/package/qt5/qt5base/qmake.conf
@@ -19,6 +19,7 @@  QMAKE_CXXFLAGS_RELEASE += -O3
 CONFIG                 += nostrip
 
 QMAKE_LIBS             += -lrt -lpthread -ldl
+QMAKE_CFLAGS_ISYSTEM   =
 
 include(../common/linux_device_post.conf)
 load(qt_config)