Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Compilation of Qt5.3.1 on Ubuntu 20.04.1

Compilation of Qt5.3.1 on Ubuntu 20.04.1

Scheduled Pinned Locked Moved Solved Installation and Deployment
13 Posts 5 Posters 4.4k Views 2 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #4

    Are you building from a clean source or reusing something that already contained build artifacts ?

    Are you doing out of source builds ?

    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
    0
    • L Offline
      L Offline
      laurent.c
      wrote on last edited by
      #5

      Hi,

      Yes, this is from clean Qt sources, through buildroot. So buildroot extracts the tarball of the sources, patches them and build them. I've restarted the build from scratch many times by deleting all build artifacts.

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

        Can you explain the procedure you are using with buildroot ?

        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
        0
        • L Offline
          L Offline
          laurent.c
          wrote on last edited by laurent.c
          #7

          This is standard buildroot build. I'm based on buildroot-2015.05. Qt5.3.1 is one of the packages to be built through the buildroot-2015.05/package/qt and buildroot-2015.05/package/qt5.
          I'm cross-compiling Qt for ARM.

          1 Reply Last reply
          0
          • L Offline
            L Offline
            laurent.c
            wrote on last edited by
            #8

            After quite a bit of debugging by adding debug messages in qmake source code, I found that the problem is related to this foreach in qmake/library/qmakeevaluator.cpp, l.1506

            QStringList ret;
            foreach (const QString &root, feature_roots)
                if (IoUtils::exists(root))
                    ret << root;
            m_featureRoots = new QMakeFeatureRoots(ret);
            

            For some reason, this foreach does not iterate through the whole list (made of 2 elements, only the first gets iterated).
            Replacing this foreach by a standard for loop makes it work.

            Out of curiosity, I've looked at the latest source code, and this line was changed for a for loop at commit e31541fa6f5f4 with comment "qmake: eradicate Q_FOREACH loops [needing qAsConst()] ".

            No idea why this foreach would work differently on Ubuntu 20.04.1, but here you go.

            Thanks for your help anyway.

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

              Nice !

              Glad you found out and thanks for sharing the results :-)

              As for why, I do not know either, it's a pretty interesting bug.

              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
              0
              • L laurent.c

                After quite a bit of debugging by adding debug messages in qmake source code, I found that the problem is related to this foreach in qmake/library/qmakeevaluator.cpp, l.1506

                QStringList ret;
                foreach (const QString &root, feature_roots)
                    if (IoUtils::exists(root))
                        ret << root;
                m_featureRoots = new QMakeFeatureRoots(ret);
                

                For some reason, this foreach does not iterate through the whole list (made of 2 elements, only the first gets iterated).
                Replacing this foreach by a standard for loop makes it work.

                Out of curiosity, I've looked at the latest source code, and this line was changed for a for loop at commit e31541fa6f5f4 with comment "qmake: eradicate Q_FOREACH loops [needing qAsConst()] ".

                No idea why this foreach would work differently on Ubuntu 20.04.1, but here you go.

                Thanks for your help anyway.

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #10

                @laurent-c said in Compilation of Qt5.3.1 on Ubuntu 20.04.1:

                No idea why this foreach would work differently on Ubuntu 20.04

                I imagine this is a compilation code issue. It's not the OS version per se, given the same Qt version it's that you're using a very different gcc version now from 6 years ago?

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  laurent.c
                  wrote on last edited by
                  #11

                  Just adding here what I found until I could fully compile Qt5.3.1.

                  I actually had to patch 3 other tools : moc, qdbusxml2cpp and uic which all had problems with foreach loops! I found the patches from the same person in the git repo of qtbase and adapted them to work on Qt5.3.1 source code.

                  Note that you also have to enable c++11 in order to compile with those patches. In buildroot-2015.05, this is done through package/qt5/qt5base/qt5base.mk by adding -c++11 flag to QT5BASE_CONFIGURE_CMDS (l. 163).

                  Then I could compile.

                  K 1 Reply Last reply
                  3
                  • L laurent.c

                    Just adding here what I found until I could fully compile Qt5.3.1.

                    I actually had to patch 3 other tools : moc, qdbusxml2cpp and uic which all had problems with foreach loops! I found the patches from the same person in the git repo of qtbase and adapted them to work on Qt5.3.1 source code.

                    Note that you also have to enable c++11 in order to compile with those patches. In buildroot-2015.05, this is done through package/qt5/qt5base/qt5base.mk by adding -c++11 flag to QT5BASE_CONFIGURE_CMDS (l. 163).

                    Then I could compile.

                    K Offline
                    K Offline
                    KasperO
                    wrote on last edited by
                    #12

                    @laurent-c Hi, I'm facing the same issue. Can you please share the patches you created or point to the patches you found in the git repo? Thanks.

                    1 Reply Last reply
                    1
                    • P Offline
                      P Offline
                      publicNameWhatever
                      wrote on last edited by
                      #13

                      Assuming you run configure in qt source directory, you can specify QMAKEFEATURES like this:

                      QMAKEFEATURES=$PWD/qtbase/mkspecs/features \
                      ./configure
                      
                      1 Reply Last reply
                      0

                      • Login

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