Skip to contentSkip to conversation

qt5: Disable pkg-config usage for cross-building

PATCH New Alexey Brodkin 4 participants 8 messages Sep 22, 2016 – Sep 24, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qt5: Disable pkg-config usage for cross-building

Some Qt sub-projects use pkg-config to recover compiler and linker flags. Among other things include paths will be pulled in CFLAGS.

What's interesting Qt tries to play smart and convert include paths from simple "-I" to "-isystem" if they match ones returned by [1] ---------------------------->8--------------------------- XXX/output/host/usr/bin/yyy-buildroot-linux-g++ --sysroot=XXX/output/host/usr/yyy-buildroot-linux/sysroot -pipe -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -xc++ -E -v - < /dev/null ---------------------------->8---------------------------

Most probably that [2] was done to mute tons of warnings generated for "system" headers. But commit message gives no hint here :(

So Qt's subprojects [and 3-rd party apps written on Qt] may end-up having "-system ZZZ" in their Makefile. That's all right until an application wants to use an STL header that includes for example "stdlib.h" with gcc 6.x, see what happens then [3].

That fixes building of Qt5Webkit on ARM with gcc 6.x, see [4].

[1] http://code.qt.io/cgit/qt/qtbase.git/tree/configure?h=5.6.1#n3660
[2] http://code.qt.io/cgit/qt/qtbase.git/commit?id=0b144bc76a368ecc6c5c1121a1b51e888a0621ac
[3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129
[4] http://lists.busybox.net/pipermail/buildroot/2016-September/172666.html

Cc Thomas Petazzoni <[email protected]>
Cc Peter Seiderer <[email protected]>
Cc Julien Corjon <[email protected]>
Cc "Yann E. MORIN" <[email protected]>
---
 package/qt5/qt5base/qt5base.mk | 1 +
 1 file changed, 1 insertion(+)
package/qt5/qt5base/qt5base.mk +1 -0
index bf541b0..2c52e2c 100644
@@ -26,6 +26,7 @@ QT5BASE_CONFIGURE_OPTS += \
 	-system-zlib \
 	-system-pcre \
 	-no-pch \
+	-no-pkg-config \
 	-shared
 
 # Uses libgbm from mesa3d
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 qt5: Disable pkg-config usage for cross-building

Alexey, All,

On 2016-09-22 22:48 +0300, Alexey Brodkin spake thusly:

Quoted 41 lines

Some Qt sub-projects use pkg-config to recover compiler and linker flags. Among other things include paths will be pulled in CFLAGS.

What's interesting Qt tries to play smart and convert include paths from simple "-I" to "-isystem" if they match ones returned by [1] ---------------------------->8--------------------------- XXX/output/host/usr/bin/yyy-buildroot-linux-g++ --sysroot=XXX/output/host/usr/yyy-buildroot-linux/sysroot

(quoted diff) +0 -3
-pipe -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-Os  -xc++ -E -v - < /dev/null
---------------------------->8---------------------------

Most probably that [2] was done to mute tons of warnings generated for "system" headers. But commit message gives no hint here :(

So Qt's subprojects [and 3-rd party apps written on Qt] may end-up having "-system ZZZ" in their Makefile. That's all right until an application wants to use an STL header that includes for example "stdlib.h" with gcc 6.x, see what happens then [3].

That fixes building of Qt5Webkit on ARM with gcc 6.x, see [4].

[1] http://code.qt.io/cgit/qt/qtbase.git/tree/configure?h=5.6.1#n3660
[2] http://code.qt.io/cgit/qt/qtbase.git/commit?id=0b144bc76a368ecc6c5c1121a1b51e888a0621ac
[3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129
[4] http://lists.busybox.net/pipermail/buildroot/2016-September/172666.html

Cc Thomas Petazzoni <[email protected]>
Cc Peter Seiderer <[email protected]>
Cc Julien Corjon <[email protected]>
Cc "Yann E. MORIN" <[email protected]>
---
 package/qt5/qt5base/qt5base.mk | 1 +
 1 file changed, 1 insertion(+)
package/qt5/qt5base/qt5base.mk +0 -0
index bf541b0..2c52e2c 100644

package/qt5/qt5base/qt5base.mk QT5BASE_CONFIGURE_OPTS += \ · line 29

Quoted 4 lines
package/qt5/qt5base/qt5base.mk +1 -0
@@ -26,6 +26,7 @@ QT5BASE_CONFIGURE_OPTS += \
 	-system-zlib \
 	-system-pcre \
 	-no-pch \
+	-no-pkg-config \

I have not paid much attention to the previous discussion on the topic.

However, I think disabling use of pkg-config is wrong. That is qmake that is at fault here because, from what I understood from the previous discussion, it emits -isystem where it should not.

So qmake needs to be fixed to not emit -isystem in those conditions.

Removing the use of pkg-config is just papering over the real problem.

Usually, using pkg-config solves more issues than not using it.

So, I am not very happy with this patch, to say the least... :-(

Yes, I undestand this is a complex issue. Yes, I understand it will be hard to fix, and even if we can come up with something, it will be hard to get something upstream that reverts this change.

At worst, let's see if we can at least try to revert that patch from upstream and see if it fixes the issues.

Regards,
Yann E. MORIN.

Quoted 6 lines
package/qt5/qt5base/qt5base.mk +0 -0
 	-shared
 
 # Uses libgbm from mesa3d
Signature · 1 line
2.7.4
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 qt5: Disable pkg-config usage for cross-building

Hello,

Quoted 6 lines · Yann E. MORIN

I have not paid much attention to the previous discussion on the topic.

However, I think disabling use of pkg-config is wrong. That is qmake that is at fault here because, from what I understood from the previous discussion, it emits -isystem where it should not.

Quoted 7 lines

So qmake needs to be fixed to not emit -isystem in those conditions.

Removing the use of pkg-config is just papering over the real problem.

Usually, using pkg-config solves more issues than not using it.

So, I am not very happy with this patch, to say the least... :-(

I entirely agree with Yann. Disabling pkg-config is clearly not the solution we want to use.

Alexey, have you tried the other approaches I outlined in the thread where the initial discussion took place?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#3 lore raw

PATCH 1/1 qt5: Disable pkg-config usage for cross-building

Hi Thomas, Yann,

Quoted 17 lines · Thomas Petazzoni

Hello,

Quoted 13 lines · Yann E. MORIN

I have not paid much attention to the previous discussion on the topic.

However, I think disabling use of pkg-config is wrong. That is qmake that is at fault here because, from what I understood from the previous discussion, it emits -isystem where it should not.

So qmake needs to be fixed to not emit -isystem in those conditions.

Removing the use of pkg-config is just papering over the real problem.

Usually, using pkg-config solves more issues than not using it.

Quoted 7 lines
Quoted 1 line

So, I am not very happy with this patch, to say the least... :-(

I entirely agree with Yann. Disabling pkg-config is clearly not the solution we want to use.

Alexey, have you tried the other approaches I outlined in the thread where the initial discussion took place?

Well I don't like removal of pkg-config usage either but... Another approach with setting?QMAKE_CFLAGS_ISYSTEM to "" may work as well (even thought I haven't tried it yet) but that will mean people using buildroot-built toolchain for building their Qt5 apps will see those compiler warnings about "wrong" stuff in system headers. In the end that's why this "-isystem" was introduced in the first place.

In other words disabling pkg-config in Qt5 affects only Qt5 itself while adding "QMAKE_CFLAGS_ISYSTEM = ''" to "package/qt5/qt5base/qmake.conf" affects both Qt5 itself and apps that are written on Qt.

-Alexey

#4 lore raw

PATCH 1/1 qt5: Disable pkg-config usage for cross-building

Hello,

Quoted 9 lines · Alexey Brodkin
Quoted 2 lines

Alexey, have you tried the other approaches I outlined in the thread where the initial discussion took place?

Well I don't like removal of pkg-config usage either but... Another approach with setting?QMAKE_CFLAGS_ISYSTEM to "" may work as well (even thought I haven't tried it yet) but that will mean people using buildroot-built toolchain for building their Qt5 apps will see those compiler warnings about "wrong" stuff in system headers. In the end that's why this "-isystem" was introduced in the first place.

Which warning will they see? I don't quite get why they would see a warning, and still fail to understand why qmake uses -isystem.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#5 lore raw

PATCH 1/1 qt5: Disable pkg-config usage for cross-building

Hi Thomas,

Quoted 16 lines · Thomas Petazzoni

Hello,

Quoted 11 lines · Alexey Brodkin
Quoted 4 lines

Alexey, have you tried the other approaches I outlined in the thread where the initial discussion took place???

Well I don't like removal of pkg-config usage either but... Another approach with setting?QMAKE_CFLAGS_ISYSTEM to "" may work as well (even thought I haven't tried it yet) but that will mean people using buildroot-built toolchain for building their Qt5 apps will see those compiler warnings about "wrong" stuff in system headers. In the end that's why this "-isystem" was introduced in the first place.

Quoted 2 lines

Which warning will they see? I don't quite get why they would see a warning,

I don't have an example handy but maybe this sheds some light on that
https://gcc.gnu.org/onlinedocs/cpp/System-Headers.h
tml?

Quoted 1 line

and still fail to understand why qmake uses -isystem.

Again I would assume that's to mute warnings that have nothing to do with Qt itself or user's code.

-Alexey

#6 lore raw

PATCH 1/1 qt5: Disable pkg-config usage for cross-building

Hi Thomas, Yann,

Quoted 14 lines · Alexey Brodkin

Hi Thomas,

Quoted 11 lines · Thomas Petazzoni

Hello,

Quoted 6 lines · Alexey Brodkin
Quoted 6 lines

Alexey, have you tried the other approaches I outlined in the thread where the initial discussion took place???

Ok approach with setting empty QMAKE_CFLAGS_ISYSTEM works for me.

So what about something like that?
-------------------------->8---------------------

package/qt5/qt5base/qmake.conf +0 -0
index 2152d3c..49cf898 100644
@@ -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)
-------------------------->8---------------------

-Alexey

#7 lore raw

PATCH 1/1 qt5: Disable pkg-config usage for cross-building

Hi,

Got it working. I tough that the installation process was loading the setuptools module from my system, because the files related to the setuptools under the buildroot path were patched to include the additional options, so I tried uninstalling python-setuptools from my system and now it completes the build.

This must be a bug, what do you think?

PD: Alexey, sorry for the double mail.

2016-09-23 6:38 GMT-03:00 Alexey Brodkin <[email protected]>:

Quoted 39 lines

Hi Thomas, Yann,

Quoted 13 lines · Alexey Brodkin

Hi Thomas,

Quoted 10 lines · Thomas Petazzoni

Hello,

Quoted 5 lines · Alexey Brodkin
Quoted 5 lines

Alexey, have you tried the other approaches I outlined in the

thread

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

where the initial discussion took place?

Ok approach with setting empty QMAKE_CFLAGS_ISYSTEM works for me.

So what about something like that?
-------------------------->8---------------------

package/qt5/qt5base/qmake. renamed from package/qt5/qt5base/qmake.conf +0 -0

conf
index 2152d3c..49cf898 100644

package/qt5/qt5base/qmake.conf +1 -2
@@ -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)
-------------------------->8---------------------
 
-Alexey
Quoted 5 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160924/3de4f527/attachment.html>