Bug 1349951 - qmake-qt4 adds '-std=gnu++98' flag to compiler flags, prevents building C++11 applications
Summary: qmake-qt4 adds '-std=gnu++98' flag to compiler flags, prevents building C++1...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: qt
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Than Ngo
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-24 15:50 UTC by Hedayat Vatankhah
Modified: 2016-07-09 23:54 UTC (History)
8 users (show)

Fixed In Version: qt-4.8.7-18.fc24 qt-4.8.7-18.fc23
Clone Of:
Environment:
Last Closed: 2016-06-29 12:54:31 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Hedayat Vatankhah 2016-06-24 15:50:06 UTC
Description of problem:
I've added -std=gnu++11 to a project, which worked fine before. But I can't build it in F23 now because Qt adds -std=gnu++98 to compiler command line afterwards, which disables C++11 mode.

Version-Release number of selected component (if applicable):
qt-devel-4.8.7-12.fc23.x86_64

How reproducible:
100%

Comment 1 Rex Dieter 2016-06-24 18:08:59 UTC
We had to add that flag to allow qt(4) to build on f24+ (using gcc6), but ...
* we should probably make it conditional only where needed (on f24+)
* it should be used only for qt, and not leak to buildsys tools like qmake

Comment 2 Hedayat Vatankhah 2016-06-24 19:06:52 UTC
Yes, I could guess that. I think 1 is not needed, adding it in prior releases is harmless anyway. However, the second one should be fixed, even in f24.

Now that I look more closely, I wonder why qt build flags should affect its default G++ mkspec. While some of them might be necessary for programs linked with Qt, others should probably be left to the developer to decide about (e.g. -g, -mtune=generic, or even -O2!). 

It would be fine for qmake to provide some sensible defaults like O2 for release mode, but it should be possible to override using QMAKE_CXXFLAGS. Unfortunately, qmake's own flags come after flags given in QMAKE_CXXFLAGS, and so override them. 

So, I would suggest that qmake should let the user to override flags it provides, but placing QMAKE_CXXFLAGS and similar *after* default qmake flags.
Therefore, the user can override qmake default flags: e.g. -g0 -O3

Comment 3 Fedora Update System 2016-06-27 12:06:04 UTC
qt-4.8.7-18.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-492729f0f4

Comment 4 Fedora Update System 2016-06-27 12:06:54 UTC
qt-4.8.7-18.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-99671098b1

Comment 5 Fedora Update System 2016-06-28 00:26:45 UTC
qt-4.8.7-18.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-99671098b1

Comment 6 Fedora Update System 2016-06-28 04:24:47 UTC
qt-4.8.7-18.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-492729f0f4

Comment 7 Fedora Update System 2016-06-29 12:54:27 UTC
qt-4.8.7-18.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 8 Rex Dieter 2016-07-01 12:48:32 UTC
fyi,

>  it should be possible to override using QMAKE_CXXFLAGS

you probably can, but you need to set/use QMAKE_CXXFLAGS_RELEASE instead (I think)

Comment 9 Fedora Update System 2016-07-09 23:54:00 UTC
qt-4.8.7-18.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.