View previous topic :: View next topic |
Author |
Message |
sparc n00b
Joined: 18 Aug 2005 Posts: 72 Location: Stockholm, Sweden
|
Posted: Fri Jun 30, 2017 11:23 am Post subject: error Qt requires a C++11 compiler |
|
|
Hi all,
It's been some time now that I'm facing the subject line error while merging packages that use qmake. Actually it might be only PyQt5 (current versions I tried are 5.7.1, 5.8.2, both failing). I don't remember other packages because I have found a workaround. So after the first time I haven't tried to solve this before now.
Workaround
I edit the qmake spec file to force CXX std to be c++11:
/usr/lib64/qt5/mkspecs/common/gcc-base.conf: | QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -std=c++11 |
Other solutions that failed
So, what else have I tried:
- fixing libtool libraries
- recompiling everything again and again. revdep, emptytree system/world, libtool, boost, qt-*, qmake...
- adding/changing make.conf: | CXXFLAGS, QMAKE_CXXFLAGS, CMAKE_CXXFLAGS, MAKE_CXXFLAGS |
- exporting all of the above to env and I make sure they are included in Code: | /var/tmp/portage/.../temp/environment |
I've had this error with various gcc 4.x.y versions and now with 5.4.0-r3
I've read the gentoo wikis on upgrading gcc and tried everything in them.
I do believe that this is due to some misconfiguration in my system, rather than a bug or incompatible ABI or something. I couldn't find a tool, an eselect module, or an etc file to set the qmake configuration though. |
|
Back to top |
|
|
sparc n00b
Joined: 18 Aug 2005 Posts: 72 Location: Stockholm, Sweden
|
Posted: Mon Jul 24, 2017 5:52 pm Post subject: |
|
|
Hi again.
So today I got a new but similar error:
dev-python/wxpython-3.0.2.0::gentoo: |
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5/type_traits:35:0,
from /usr/include/wx-3.0/wx/strvararg.h:25,
from /usr/include/wx-3.0/wx/string.h:46,
from /usr/include/wx-3.0/wx/memory.h:15,
from /usr/include/wx-3.0/wx/object.h:19,
from /usr/include/wx-3.0/wx/wx.h:15,
from include/wx/wxPython/wxPython_int.h:35,
from src/helpers.cpp:17:
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
|
Any ideas? |
|
Back to top |
|
|
charles17 Advocate
Joined: 02 Mar 2008 Posts: 3685
|
Posted: Mon Jul 24, 2017 6:46 pm Post subject: |
|
|
Sounds like you did not completely finish a gcc-5 upgrade? |
|
Back to top |
|
|
sparc n00b
Joined: 18 Aug 2005 Posts: 72 Location: Stockholm, Sweden
|
Posted: Sun Sep 24, 2017 6:55 pm Post subject: |
|
|
Hi charles17,
Not upgrading gcc correctly was the first thing I checked. Today I followed the guide again. Used revdep to recompile 328 packages against libstdc++.so.6. Nothing was solved. I still get packages failing to merge due to C++11 incompatibility. Moreover I'm writing my own C++ and Netbeans prints __cplusplus=199711L; that value should be 201103L. As a consequence, it fails to parse c++11 code I write.
Code: |
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/include/qt5 -isy
stem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -I. -I/usr/lib64/qt5/mkspecs/linux-g++ -o qtdetail.o qtdeta
il.cpp
In file included from /usr/include/qt5/QtCore/qglobal.h:83:0,
from /usr/include/qt5/QtCore/qcoreapplication.h:43,
from /usr/include/qt5/QtGui/qguiapplication.h:43,
from /usr/include/qt5/QtGui/QGuiApplication:1,
from qtdetail.cpp:1:
/usr/include/qt5/QtCore/qcompilerdetection.h:562:6: error: #error Qt requires a C++11 compiler and yours does not seem t
o be that.
# error Qt requires a C++11 compiler and yours does not seem to be that.
^
|
Looking at the emerge logs I see that the g++ commands do not include the -std parameter, so C++98 is my default. This is strange because I have added the following:
/etc/portage/make.conf: |
CXXFLAGS="${CFLAGS} -std=c++11"
QMAKE_CXXFLAGS="${QMAKE_CXXFLAGS} -stdlib=libc++"
QMAKE_CXXFLAGS="${QMAKE_CXXFLAGS} -std=c++11"
CMAKE_CXXFLAGS="${CMAKE_CXXFLAGS} -stdlib=libc++"
CMAKE_CXXFLAGS="${CMAKE_CXXFLAGS} -std=c++11"
|
I use gcc-v5.4.0-r3. I have no other version installed. fix_libtool_files.sh finds no issue regardless of parameter values. I was under the impression that v5 used c++11 by default. Thus I'm concluding that something else is misconfigured.
Some packages that break are:
Code: |
dev-python/wxpython-3.0.2.0:3.0/3.0::gentoo
dev-python/PyQt5-5.8.2:0/0::gentoo
|
There will be more if I do an emerge --emptytree.
All dev-qt packages compile without problem; recompiled all of them today again; so the error message above seems really strange. If I assume that all qt packages have the same c++11 requirement, then why is only PyQT5 failing? I do not get it.
At this point I have no clue how to fix this other than to reinstall Gentoo fresh to reset the configuration. This is a no-starter for me since I need this laptop to work and can't spend 3 days installing the system. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22782
|
Posted: Sun Sep 24, 2017 8:58 pm Post subject: |
|
|
sparc wrote: | Moreover I'm writing my own C++ and Netbeans prints __cplusplus=199711L; that value should be 201103L. As a consequence, it fails to parse c++11 code I write. | Why do you think that value should be C++11? What C++ standard did you tell the compiler to use?
sparc wrote: | Looking at the emerge logs I see that the g++ commands do not include the -std parameter, so C++98 is my default. This is strange because I have added the following: /etc/portage/make.conf: |
CXXFLAGS="${CFLAGS} -std=c++11" |
| Copying CXXFLAGS from CFLAGS is not always correct. Setting that aside, you should not set the standard globally. The package build system should set the standard to whatever it needs. If it does not, that is a bug in the package.
sparc wrote: | I was under the impression that v5 used c++11 by default. | I see nothing like that on the gcc 5 changes page. What did you read that led you to believe this? |
|
Back to top |
|
|
asturm Developer
Joined: 05 Apr 2007 Posts: 9318
|
Posted: Sun Sep 24, 2017 9:24 pm Post subject: |
|
|
GCC-6 does, not 5. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22782
|
Posted: Sun Sep 24, 2017 11:53 pm Post subject: |
|
|
GCC-6 doesn't default to C++11 either. It defaults to C++14. |
|
Back to top |
|
|
sparc n00b
Joined: 18 Aug 2005 Posts: 72 Location: Stockholm, Sweden
|
Posted: Mon Sep 25, 2017 9:55 am Post subject: |
|
|
Hu wrote: | sparc wrote: | Moreover I'm writing my own C++ and Netbeans prints __cplusplus=199711L; that value should be 201103L. As a consequence, it fails to parse c++11 code I write. | Why do you think that value should be C++11? What C++ standard did you tell the compiler to use? |
C++11 on every properties dialog, Netbeans-wide and project specific settings, including c++ compiler and code-assistance. I have a Fedora work system as well; same code, same compiler, same Netbeans, no reds at all. I haven't verified the pp macro value though. Will do later today at the office.
Hu wrote: |
sparc wrote: | Looking at the emerge logs I see that the g++ commands do not include the -std parameter, so C++98 is my default. This is strange because I have added the following: /etc/portage/make.conf: |
CXXFLAGS="${CFLAGS} -std=c++11" |
| Copying CXXFLAGS from CFLAGS is not always correct. Setting that aside, you should not set the standard globally. The package build system should set the standard to whatever it needs. If it does not, that is a bug in the package.
sparc wrote: | I was under the impression that v5 used c++11 by default. | I see nothing like that on the gcc 5 changes page. What did you read that led you to believe this? |
So if my gcc defaults to c++98 or c++99 all is well with my system and the wxpython, PyQT5 packages are broken? The forums would be flooded with posts about them then, many popular packages depend on these packages.
By the way both packages emerged properly by doing the workaround hack I describe in the first post, forcing -std=c++11 in qmake. So either the ebuilds above are broken, or they assume that something else that is broken would add -std=c++11. The Netbeans issue kind of points me to the latter scenario, but I have no idea where to look.
Thanks all for your help! |
|
Back to top |
|
|
sparc n00b
Joined: 18 Aug 2005 Posts: 72 Location: Stockholm, Sweden
|
Posted: Mon Sep 25, 2017 12:07 pm Post subject: |
|
|
I fixed the Netbeans error, or better yet I worked around it. I found out that certain cpp files where set not to inherit from the project settings but get the value from the Netbeans configuration. Changing all files to inherit from project and setting the project to c++11 worked for this project specifically.
The issue however remains that although Netbeans IS set to C++11 the default comes back as C++98. I discard this as a Netbeans bug. Initially I thought gcc5 had c++11 as default. Since that is not the case, it might be that the Netbeans bug is to disregard its setting and get the system default within the project.
This success does not answer why certain packages break unless forced externally to use -std=c++11. PyQT5 is qmake based, so the workaround works. However, wxpython is not qmake based, so I had to use /etc/portage/package.env to force it.
Assuming these ebuilds are not broken since I'm the only one complaining, what else could be the reason? Any ideas? |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22782
|
Posted: Tue Sep 26, 2017 1:20 am Post subject: |
|
|
Without seeing the build logs from affected packages, I have no ideas. |
|
Back to top |
|
|
franzf Advocate
Joined: 29 Mar 2005 Posts: 4565
|
|
Back to top |
|
|
asturm Developer
Joined: 05 Apr 2007 Posts: 9318
|
Posted: Tue Sep 26, 2017 7:51 am Post subject: |
|
|
But that's a tracker, not a bug report. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|