Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Building Qt 4.8.7 using g++ 6.3.0 with -std=gnu++98 on Debian 9.2.1 "stretch"
Qt 6.11 is out! See what's new in the release blog

Building Qt 4.8.7 using g++ 6.3.0 with -std=gnu++98 on Debian 9.2.1 "stretch"

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 5 Posters 7.6k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bart_Vandewoestyne
    wrote on last edited by
    #1

    We are currently still using Qt 4.8.7 (sorry, can't upgrade yet... ;-) and we build it from source. After upgrading From Debian 8 to Debian 9, the g++ compiler seems to have upgraded from 4.9 to 6.3. The g++ 4.9 used -std=gnu++98 as default for C++ code, but now g++ 6.3 uses -std=c++14 as default.

    We currently solved this problem by adding -std=gnu++98 to QMAKE_CXXFLAGS, but this has as a consequence that both Qt and all the projects we build using qmake are compiled with -std=gnu++98. We would rather only build Qt with -std=gnu++98 and build our own projects using another -std value.

    I tried adding -std=gnu++98 in Qt's configure step (right before building with make), but that does not seem to work. What would be the cleanest way to build Qt using -std=gnu++98 and the rest of our code using another -std value?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by SGaist
      #2

      Hi,

      The probably quick and dirty way would be to modify the mkspec used to build Qt when you build it and then put it back in its original state.

      Out of curiosity, why to you need Qt to be c++98 while not your other projects ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      B 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        The probably quick and dirty way would be to modify the mkspec used to build Qt when you build it and then put it back in its original state.

        Out of curiosity, why to you need Qt to be c++98 while not your other projects ?

        B Offline
        B Offline
        Bart_Vandewoestyne
        wrote on last edited by
        #3

        @SGaist said in Building Qt 4.8.7 using g++ 6.3.0 with -std=gnu++98 on Debian 9.2.1 "stretch":

        The probably quick and dirty way would be to modify the mkspec used to build Qt when you build it and then put it back in its original state.

        That is indeed a quick and dirty way :-) In the meanwhile, I have discovered that the origin of the problem is that Qt 4.8.7 does not build in C++11 mode because there are parts that do not compile in C++11 mode, e.g. WebKit. See for example

        https://bugreports.qt.io/browse/QTBUG-41361
        https://bugreports.qt.io/browse/QTBUG-27029

        I think the better approach to solve this problem is to only compile the faulty Qt modules with -std=gnu++98 (as described in https://bugreports.qt.io/browse/QTBUG-41361) by adapting their .pr[io] files. This leaves us with the possibility to compile our own code using another -std= value.

        This approach was for example also adopted in:

        http://codereview.qt-project.org/95760
        https://github.com/gobolinux/Recipes/blob/master/revisions/Qt/4.8.7-r2/01-gcc6_build_fix.patch

        Out of curiosity, why to you need Qt to be c++98 while not your other projects ?

        Because for our own code, we want to use C++11/14 features, but apparently, parts of Qt 4.8.7 do not compile in C++11 mode. The only way to get Qt 4.8.7 to compile is to stick with C++98 for those incompatible modules. (And yes, I know... in an ideal world, we would already be using Qt 5.X, but that is currently not yet an option, although it is on the roadmap :-)

        Feel free to ask more questions if I didn't make myself clear enough. I am open for discussion :-)

        kshegunovK 1 Reply Last reply
        1
        • B Bart_Vandewoestyne

          @SGaist said in Building Qt 4.8.7 using g++ 6.3.0 with -std=gnu++98 on Debian 9.2.1 "stretch":

          The probably quick and dirty way would be to modify the mkspec used to build Qt when you build it and then put it back in its original state.

          That is indeed a quick and dirty way :-) In the meanwhile, I have discovered that the origin of the problem is that Qt 4.8.7 does not build in C++11 mode because there are parts that do not compile in C++11 mode, e.g. WebKit. See for example

          https://bugreports.qt.io/browse/QTBUG-41361
          https://bugreports.qt.io/browse/QTBUG-27029

          I think the better approach to solve this problem is to only compile the faulty Qt modules with -std=gnu++98 (as described in https://bugreports.qt.io/browse/QTBUG-41361) by adapting their .pr[io] files. This leaves us with the possibility to compile our own code using another -std= value.

          This approach was for example also adopted in:

          http://codereview.qt-project.org/95760
          https://github.com/gobolinux/Recipes/blob/master/revisions/Qt/4.8.7-r2/01-gcc6_build_fix.patch

          Out of curiosity, why to you need Qt to be c++98 while not your other projects ?

          Because for our own code, we want to use C++11/14 features, but apparently, parts of Qt 4.8.7 do not compile in C++11 mode. The only way to get Qt 4.8.7 to compile is to stick with C++98 for those incompatible modules. (And yes, I know... in an ideal world, we would already be using Qt 5.X, but that is currently not yet an option, although it is on the roadmap :-)

          Feel free to ask more questions if I didn't make myself clear enough. I am open for discussion :-)

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          @Bart_Vandewoestyne said in Building Qt 4.8.7 using g++ 6.3.0 with -std=gnu++98 on Debian 9.2.1 "stretch":

          In the meanwhile, I have discovered that the origin of the problem is that Qt 4.8.7 does not build in C++11 mode because there are parts that do not compile in C++11 mode, e.g. WebKit.

          If you don't use that modules, perhaps you could skip building them?

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          1
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Well, all in all, I'd go for building everything that is possible with C++11 and only the part that really can't with C++98

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            2
            • H Offline
              H Offline
              hesparza
              wrote on last edited by
              #6

              Thanks @Bart_Vandewoestyne I was running into the same problem and the information provided by you helped me to solve it.

              1 Reply Last reply
              0
              • R Offline
                R Offline
                Renato Moraes
                wrote on last edited by
                #7

                Please, look at this solution.

                1 Reply Last reply
                2

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved