Adding QMAKE_CXXFLAGS += -std=c++0x to Pro file make c++ - Internal compiler error : segmentation fault



  • Hi all

    I'm integrating between a c++ logic layer and a QT GUI view, the logic layer was writen in QT console with adding: QMAKE_CXXFLAGS += -std=c++0x to Pro file, all worked good here! But when adding logic layer files to the GUI project and adding the above row to the GUI Pro file I got the error: "Internal compiler error : segmentation fault".

    Someone had this problem before? it's some kind of QT bug maybe?



  • Your are most probably using MinGW 4.4 or older. Just don't.



  • I'm using QT 4.8.1 which comes with MinGW 4.4, how do I change it (I have MinGW 4.7 as standalone download)?



  • [quote author="GoldenAxe" date="1352482392"]I'm using QT 4.8.1 which comes with MinGW 4.4, how do I change it (I have MinGW 4.7 as standalone download)?[/quote]

    So maybe you should to build Qt with the newest stable mingw and use this tool chain.



  • Comment the line "QMAKE_CXXFLAGS = -std=c+0x" build and then uncomment do the trick...
    Which mean it's a bug right?

    • build QT with the newest stable MinGW sounds to me a little bit brute-force idea, don't you think?


  • No, C++11 in MinGW 4.4 is broken. Get an "up-to-date MinGW":http://sourceforge.net/projects/mingwbuilds/ and build Qt 4.8.x, or better Qt 5, if you are out for serious C++11.



  • Got the problem again...
    How do you build Qt 4.8.x and above with higher MinGW?
    Where do you download Qt5 (I can only see Qt 4.8.3 in download section)?
    Can you please direct me to a guide or some doc, because I can't find one.

    thanks!



  • I recommend cloning Qt directly from its repository.

    See "Get The Source":http://qt-project.org/wiki/Get_The_Source and "Building Qt 5 from Git":http://qt-project.org/wiki/Building_Qt_5_from_Git.



  • I configure Qt5 with the following arguments:
    @-platform win32-g++ -release -developer-build -opensource@
    all was fine except it worn's me about no Angle (openGL), but I have winKit 8, so I read it was suppose to work, except from this all was fine. But in the configure summary I see: "C++11 support...............no"

    Should I change something in my initial settings? Or I shell continue with building with MinGW (the one you linked me)?

    BTW how do you make clean with the version of mingw you linked me to (there is no confclean) ?



  • ANGLE requires you to have the DirectX SDK installed (the Windows SDK is not sufficient). If you don't want to, use <code>-opengl desktop</code> to use OpenGL directly.

    I'm not quite sure why C++11 isn't automatically detected for you (see <code>qtbase/config.tests/common/c++11</code> for a reason), but you can try to force it using <code>-c++11</code>.

    The <code>confclean</code> target no longer exists in Qt 5. The closest possible match is <code>git submodule foreach --recursive git clean -dfx</code>.

    I am using <code>gcc version 4.7.2 posix i686-w64-mingw32 (Built by MinGW-builds project)</code> in combination with <code>configure -debug-and-release -opensource -confirm-license -opengl desktop -nomake demos -nomake examples -nomake tests</code> which works actually quite well.



  • Thanks I have now used this arguments:
    -debug-and-release -opensource -confirm-license -platform win32-g++ -developer-build -icu -opengl desktop -openssl -plugin-sql-odbc -qt-style-windowsxp -qt-style-windowsvista -nomake tests

    configure worked fine also detecting c++11.

    But when mingw32-make I got an error: '_MCW_EM' was not declared...
    something from (\qlocale_tools.cpp)

    any ideas how to solve this?

    • BTW I have Windows kit 8 sdk


  • That's rather odd, because <code>_MCW_EM</code> should "only be used if it is defined":http://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/tools/qlocale_tools.cpp#line2236 (and it actually is for MinGW-w64 in <code>float.h</code>) - and I can't reproduce it.

    In a first step I would check the environment, especially if there aren't any fragments of a different toolchain including the Windows 8 SDK, which could cause wrong headers to be included. INCLUDE, LIB and LIBPATH should be empty, PATH should contain MinGW.

    If this doesn't help you may file a "bug report":https://bugreports.qt-project.org/ or simply stop by at #qt@freenode or #qt-labs@freenode, probably this is an already known problem.



  • Just to make clear the Environment Variables PATH should be clean except MinGW/bin? Not even Perl and Python should be inside it (as the guide say)?



  • No, PATH should of course contain all the neccessary tools, but it should not contain other versions of MinGW or the Windows SDK.



  • "I've just seen":http://qt-project.org/forums/viewthread/21862/ that you are using a rubenvb build. I've had problems with it in the past and I recommend using a mingw-builds build instead (which will also become the official MinGW build for Qt).



  • That what I have in my path now:
    @C:\Python33;C:\Perl64\site\bin;C:\Perl64\bin;C:\MinGW\bin;C:\Program Files (x86)\Programming\Git\cmd;C:\Program Files (x86)\Programming\Git\bin;@

    this is my original path:
    @C:\Python33;C:\Perl64\site\bin;C:\Perl64\bin;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\SystemTools\ATI Technologies\ATI.ACE\Core-Static; C:\Program Files (x86)\Programming\Java\jre7\bin;C:\Program Files (x86)\Programming\Windows Kits\8.0\Windows Performance Toolkit;C:\cygwin\bin;C:\MinGW\bin;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files\Programming\doxygen\bin;C:\Program Files (x86)\Programming\Git\cmd;C:\Program Files (x86)\Programming\Git\bin@

    I use this "mingw-builds":http://code.google.com/p/mingw-builds/downloads/list (the first one)

    now I can't even run configure:

    @.o registry.o -lole32 -ladvapi32 -luuid
    g++: error: qarraydata.o: No such file or directory
    g++: error: qbytearray.o: No such file or directory
    g++: error: qbytearraymatcher.o: No such file or directory
    g++: error: qhash.o: No such file or directory
    g++: error: qlist.o: No such file or directory
    g++: error: qlocale.o: No such file or directory
    g++: error: qlocale_win.o: No such file or directory
    g++: error: qlocale_tools.o: No such file or directory
    g++: error: qvector.o: No such file or directory
    g++: error: qutfcodec.o: No such file or directory
    g++: error: qtextcodec.o: No such file or directory
    g++: error: qglobal.o: No such file or directory
    g++: error: qnumeric.o: No such file or directory
    g++: error: qbuffer.o: No such file or directory
    g++: error: qdatastream.o: No such file or directory
    g++: error: qdir.o: No such file or directory
    g++: error: qdiriterator.o: No such file or directory
    g++: error: qfiledevice.o: No such file or directory
    g++: error: qfile.o: No such file or directory
    g++: error: qfileinfo.o: No such file or directory
    g++: error: qabstractfileengine.o: No such file or directory
    g++: error: qfilesystementry.o: No such file or directory
    g++: error: qfilesystemengine.o: No such file or directory
    g++: error: qfilesystemengine_win.o: No such file or director
    g++: error: qfilesystemiterator_win.o: No such file or direct
    g++: error: qfsfileengine.o: No such file or directory
    g++: error: qfsfileengine_win.o: No such file or directory
    g++: error: qfsfileengine_iterator.o: No such file or directo
    g++: error: qiodevice.o: No such file or directory
    g++: error: qtextstream.o: No such file or directory
    g++: error: qlogging.o: No such file or directory
    g++: error: qtemporaryfile.o: No such file or directory
    g++: error: qstandardpaths.o: No such file or directory
    g++: error: qstandardpaths_win.o: No such file or directory
    g++: error: qbitarray.o: No such file or directory
    g++: error: qdatetime.o: No such file or directory
    g++: error: qmap.o: No such file or directory
    g++: error: qregexp.o: No such file or directory
    g++: error: qstring.o: No such file or directory
    g++: error: qstringlist.o: No such file or directory
    g++: error: qvsnprintf.o: No such file or directory
    g++: error: qvariant.o: No such file or directory
    g++: error: qsystemerror.o: No such file or directory
    g++: error: qmetatype.o: No such file or directory
    g++: error: qmalloc.o: No such file or directory
    g++: error: qxmlstream.o: No such file or directory
    g++: error: qxmlutils.o: No such file or directory
    g++: error: qcryptographichash.o: No such file or directory
    g++: error: registry.o: No such file or directory
    mingw32-make: *** [../../configure.exe] Error 1
    *** qtbase/configure exited with non-zero status.@



  • The latest can be found "here":http://sourceforge.net/projects/mingwbuilds/, the project at Goole Code is outdated.



  • OK configure work fine with the link you gave me.

    but we back to square one:

    @....\corelib\tools\qlocale_tools.cpp: In function 'char* qdtoa(double, int, int
    , int*, int*, char**, char**)':
    ....\corelib\tools\qlocale_tools.cpp:2257:25: error: '_MCW_EM' was not declared
    in this scope
    ....\corelib\tools\qlocale_tools.cpp:2257:33: error: '_MCW_DN' was not declared
    in this scope
    ....\corelib\tools\qlocale_tools.cpp:2257:41: error: '_MCW_RC' was not declared
    in this scope
    Makefile.Release:5718: recipe for target 'tmp/obj/release_shared/qlocale_tools.o
    ' failed
    mingw32-make[5]: *** [tmp/obj/release_shared/qlocale_tools.o] Error 1
    mingw32-make[5]: Leaving directory 'C:/qt5/2012.11/qtbase/src/tools/bootstrap'
    Makefile:33: recipe for target 'release' failed
    mingw32-make[4]: *** [release] Error 2
    mingw32-make[4]: Leaving directory 'C:/qt5/2012.11/qtbase/src/tools/bootstrap'
    Makefile:41: recipe for target 'sub-tools-bootstrap-make_first' failed
    mingw32-make[3]: *** [sub-tools-bootstrap-make_first] Error 2
    mingw32-make[3]: Leaving directory 'C:/qt5/2012.11/qtbase/src/tools'
    Makefile:50: recipe for target 'sub-tools-make_first' failed
    mingw32-make[2]: *** [sub-tools-make_first] Error 2
    mingw32-make[2]: Leaving directory 'C:/qt5/2012.11/qtbase/src'
    Makefile:39: recipe for target 'sub-src-make_first' failed
    mingw32-make[1]: *** [sub-src-make_first] Error 2
    mingw32-make[1]: Leaving directory 'C:/qt5/2012.11/qtbase'
    makefile:51: recipe for target 'module-qtbase-make_first' failed
    mingw32-make: *** [module-qtbase-make_first] Error 2@



  • A quick search revealed that both, MinGW and GCC, come with a <code>float.h</code>. One having those definitions (which should be picked), one not.

    So this might be an GCC / MinGW issue, and not directly related to Qt.



  • "Yes I found this as well":https://bugreports.qt-project.org/browse/QTBUG-7576

    but it's seems to be old and not working...
    How can I use only MinGW? maybe it other Gcc conflicting!



  • If I change this line

    _control87(oldbits, _MCW_EM|_MCW_DN|_MCW_RC);

    in qlocale_tools.cpp to

    _control87(oldbits, MCW_EM);

    it's run until I get this error:

    c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Cored0
    collect2.exe: error: ld returned 1 exit status



  • I used VS2012 command prompt to build "Qt5Sdk":http://qt.gitorious.org/qtsdk and it's work, but it's not recognize #include <QtGui/QApplication>, #include <QFileDialog> and more...it's does recognize #include <QGui>.

    maybe VS2012 build didn't goes well?
    I added to PATH “C:\qt5\2012.11\qtbase\bin and C:\qt5\2012.11\qtbase\lib".

    • BTW in Windows7 where's are the INCLUDE, LIB and LIBPATH, becaise I can see I can set them from Qt, but when entered windows 7 environment variables there is only PATH?


  • [quote author="GoldenAxe" date="1352797811"]> c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Cored0

    collect2.exe: error: ld returned 1 exit status[/quote]

    See https://codereview.qt-project.org/#change,39385



  • Some update:
    I couldn't able to build qt5 with mingw, but I did succeed doing this with vs2012 command prompt, but since they changed the include trees in qt5, I needed to do a lots of include changes in my project, so I decided not to use qt5. Nevertheless since I wanted good support with c++11, I built qt4.8.x which did succeed with mingw, but c++11 functions like for example stod didn't recognize with it, I was very disappointed, so now I will try build it with vs2012...lets see if this will sort this out!



  • [quote author="GoldenAxe" date="1352965521"]... I needed to do a lots of include changes in my project.[/quote]

    The fixqt4headers.pl script found in qtbase/bin will do that for you.



  • The problem it's not only includes, some objects like QMessageBox, after fixing the includes are still not recognized as well.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.