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
Forum Updated to NodeBB v4.3 + New Features

Compilation of Qt5.3.1 on Ubuntu 20.04.1

Scheduled Pinned Locked Moved Solved Installation and Deployment
13 Posts 5 Posters 4.1k 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.
  • L Offline
    L Offline
    laurent.c
    wrote on last edited by laurent.c
    #1

    Hello,

    I'm trying to compile Qt5.3.1 from Buildroot on Ubuntu 20.04.1 (I know that it is a pretty old Qt version but I have to stick with this version).

    I used to build it on Ubuntu 14.04 and I had no problem.

    On Ubuntu 20.04.1, I have this issue coming from the execution of the ./configure script just after qmake is built:

    Running configuration tests...
    Failed to process makespec for platform 'devices/linux-buildroot-g++'
    Cannot find feature spec_pre.prf
    Error processing project file: /dev/null
    

    I've run the same command used to perform the test using the qmake that I get from compiling Qt5.3.1 on Ubuntu 14.04 and it works fine. So, the runtime environment does not seem to be the problem. It must be something to do with the configuration when building qmake, but when I compare both configure command lines, they look the same.

    So now I'm a bit stuck and I would appreciate your help. Maybe something was changed within qmake code that I need to backport to make it run on Ubuntu 20.04.1?

    Let me know if you need information on anything else, and I'll be happy to provide.

    Thanks for your help.

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

      Hi and welcome to devnet,

      Turn on the verbose flag, you should get some more information about what is happening.

      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
        #3

        Hi,

        Yes, that's what I've done.

        From the non-working qmake:

        $ /home/lco/BSP/buildroot-output/dev/A/build/qt5base-5.3.1/bin/qmake -d -E -nocache -recursive -spec /home/lco/BSP/buildroot-output/dev/A/build/qt5base-5.3.1/mkspecs/devices/linux-buildroot-g++ QT= /dev/null
        DEBUG 1: Resetting dir to: /home/lco
        DEBUG 1: Changing dir to: /dev
        Cannot find feature spec_pre.prf
        Error processing project file: /dev/null
        

        From the working qmake obtained from Ubuntu 14.04 and run on Ubuntu 20.01.4:

        $ /home/lco/tmp/qmake -d -E -nocache -recursive -spec /home/lco/BSP/buildroot-output/dev/A/build/qt5base-5.3.1/mkspecs/devices/linux-buildroot-g++ QT= /
        dev/null
        DEBUG 1: Resetting dir to: /home/lco
        DEBUG 1: Changing dir to: /dev
        DEBUG 1: visiting file /home/lco/BSP/buildroot-output/dev/A/build/qt5base-5.3.1/mkspecs/features/spec_pre.prf
        

        And it carries on...

        1 Reply Last reply
        0
        • 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