Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. qmake does not read prf file located in project root directory

qmake does not read prf file located in project root directory

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
9 Posts 4 Posters 2.6k Views
  • 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.
  • F Offline
    F Offline
    Francis Giraldeau
    wrote on 10 Jul 2017, 20:48 last edited by
    #1

    The qmake documentation [1] indicates that .prf files lookup includes the project root directory. However, it looks like it's not the case with qmake 3.1. Using strace, I confirm that the file is not read unless the path is added to QMAKEFEATURES property.

    With myfeatures.prf is inside the project root directory
    in project.pro:
    CONFIG += myfeatures
    
    $ strace qmake ../scratchpad-virtuel/ 2>&1 | grep myfeatures.prf
    stat("/home/francisg/Qt5.9.0/5.9/gcc_64/mkspecs/features/unix/myfeatures.prf", 0x7ffddc3b2f70) = -1 ENOENT (No such file or directory)
    stat("/home/francisg/Qt5.9.0/5.9/gcc_64/mkspecs/features/myfeatures.prf", 0x7ffddc3b2f70) = -1 ENOENT (No such file or directory)
    
    Setting the property:
    qmake -set QMAKEFEATURES /path/to/project
    
    $ strace qmake /path/to/project 2>&1 | grep myfeatures.prf
    stat("/path/to/project/myfeatures.prf", {st_mode=S_IFREG|0644, st_size=881, ...}) = 0
    open("/path/to/project/myfeatures.prf", O_RDONLY|O_CLOEXEC) = 3
    

    Actually, by adding the variable in .qmake.conf at the project root directory, the file is read:

    QMAKEFEATURES=$$PWD
    

    Maybe we can update the doc?

    [1] http://doc.qt.io/qt-5/qmake-advanced-usage.html

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 10 Jul 2017, 21:26 last edited by
      #2

      Hi,

      Sounds rather like it could be a bug.

      Do you have a minimal compilable example that shows this behaviour ?

      Just in case, 5.9.1 got released last week so it might be worth checking before going further.

      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
      1
      • F Offline
        F Offline
        Francis Giraldeau
        wrote on 10 Jul 2017, 22:14 last edited by
        #3

        Here is a minimal example to reproduce the problem. By removing the .qmake.conf file, the message "inside myfeatures.prf" will not be written when calling qmake.

        https://github.com/giraldeau/qt-topic-81179

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 12 Jul 2017, 09:26 last edited by
          #4

          Following QTBUG-21411, it could be a documentation issue but it's not really clear.

          In any case, one workaround could be to use a features folder in your project. Might not be ideal but should be working on all platforms.

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

          J 1 Reply Last reply 17 Dec 2021, 14:05
          0
          • S SGaist
            12 Jul 2017, 09:26

            Following QTBUG-21411, it could be a documentation issue but it's not really clear.

            In any case, one workaround could be to use a features folder in your project. Might not be ideal but should be working on all platforms.

            J Offline
            J Offline
            JonB
            wrote on 17 Dec 2021, 14:05 last edited by JonB
            #5

            @SGaist
            Yes, I am well aware this old! I have been struggling with this --- trying to put a myfeatures.prf file into same directory as my .pro file (under Linux, if it makes any difference).

            I tried putting it in the project/,pro file directory, a sub-directory named features and a sub-sub-directory named mkspecs/features. qmake does not pick up any of these. The only thing I found which does work is in the project/.pro file directory do a touch .qmake.cache. Then it does read it! Though I have no idea what any side-effects of creating this file might be for anything else.....

            UPDATE
            After cleaning up I was unable to make it work again. I now find that in addition to creating a .qmake.cache in the project/.pro folder you must put the features.prf file down in mkspecs/features/ from there. Both of these are necessary:

            project.pro
            .qmake.cache
            mkspecs/features/myfeature.prf
            
            K 2 Replies Last reply 17 Dec 2021, 18:50
            0
            • J JonB
              17 Dec 2021, 14:05

              @SGaist
              Yes, I am well aware this old! I have been struggling with this --- trying to put a myfeatures.prf file into same directory as my .pro file (under Linux, if it makes any difference).

              I tried putting it in the project/,pro file directory, a sub-directory named features and a sub-sub-directory named mkspecs/features. qmake does not pick up any of these. The only thing I found which does work is in the project/.pro file directory do a touch .qmake.cache. Then it does read it! Though I have no idea what any side-effects of creating this file might be for anything else.....

              UPDATE
              After cleaning up I was unable to make it work again. I now find that in addition to creating a .qmake.cache in the project/.pro folder you must put the features.prf file down in mkspecs/features/ from there. Both of these are necessary:

              project.pro
              .qmake.cache
              mkspecs/features/myfeature.prf
              
              K Offline
              K Offline
              kshegunov
              Moderators
              wrote on 17 Dec 2021, 18:50 last edited by
              #6

              @JonB said in qmake does not read prf file located in project root directory:

              I now find that in addition to creating a .qmake.cache in the project/.pro folder

              This makes no sense. This file is created by qmake for internal purposes. Could you repeat your last attempt with this file removed and confirm this file is required?

              Read and abide by the Qt Code of Conduct

              1 Reply Last reply
              0
              • J JonB
                17 Dec 2021, 14:05

                @SGaist
                Yes, I am well aware this old! I have been struggling with this --- trying to put a myfeatures.prf file into same directory as my .pro file (under Linux, if it makes any difference).

                I tried putting it in the project/,pro file directory, a sub-directory named features and a sub-sub-directory named mkspecs/features. qmake does not pick up any of these. The only thing I found which does work is in the project/.pro file directory do a touch .qmake.cache. Then it does read it! Though I have no idea what any side-effects of creating this file might be for anything else.....

                UPDATE
                After cleaning up I was unable to make it work again. I now find that in addition to creating a .qmake.cache in the project/.pro folder you must put the features.prf file down in mkspecs/features/ from there. Both of these are necessary:

                project.pro
                .qmake.cache
                mkspecs/features/myfeature.prf
                
                K Offline
                K Offline
                kshegunov
                Moderators
                wrote on 18 Oct 2022, 06:42 last edited by
                #7

                I confirm that the mentioned solution does not work (on windows). Neither creating a .qmake.cache nor putting the feature file anywhere in the project tree caused qmake to find it. The only way, which reliably works, is to install it in $$[QT_INSTALL_DATA]/mkspec/features.

                Read and abide by the Qt Code of Conduct

                S 1 Reply Last reply 18 Oct 2022, 18:32
                0
                • K kshegunov
                  18 Oct 2022, 06:42

                  I confirm that the mentioned solution does not work (on windows). Neither creating a .qmake.cache nor putting the feature file anywhere in the project tree caused qmake to find it. The only way, which reliably works, is to install it in $$[QT_INSTALL_DATA]/mkspec/features.

                  S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 18 Oct 2022, 18:32 last edited by
                  #8

                  @kshegunov sounds like the bug is still alive so either the documentation needs to be fixed again or qmake.

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

                  K 1 Reply Last reply 19 Oct 2022, 04:36
                  0
                  • S SGaist
                    18 Oct 2022, 18:32

                    @kshegunov sounds like the bug is still alive so either the documentation needs to be fixed again or qmake.

                    K Offline
                    K Offline
                    kshegunov
                    Moderators
                    wrote on 19 Oct 2022, 04:36 last edited by
                    #9

                    I'd say just remove the line from the docs, since qmake is EOL.

                    Read and abide by the Qt Code of Conduct

                    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