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. Using qmake for the first time
Forum Updated to NodeBB v4.3 + New Features

Using qmake for the first time

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
7 Posts 3 Posters 390 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.
  • P Offline
    P Offline
    Perdrix
    wrote 15 days ago last edited by
    #1

    I'm trying to build kchmviewer on macOS, so I copied the repos, and added the first line below to kchmviewer.pro so it reads:

    amonra@Saturn kchmviewer-master % cat kchmviewer.pro 
    QT += Core5Compat
    SUBDIRS += lib src
    TEMPLATE = subdirs 
    CONFIG += debug
    src.depends = lib
    

    but when I then ran qmake followed by make I got:

    amonra@Saturn kchmviewer-master % qmake
    amonra@Saturn kchmviewer-master % make 
    cd lib/ && ( test -e Makefile || /opt/Qt/6.9.0/macos/bin/qmake -o Makefile /Users/amonra/kchmviewer-master/lib/lib.pro ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile 
    cd libebook/ && ( test -e Makefile || /opt/Qt/6.9.0/macos/bin/qmake -o Makefile /Users/amonra/kchmviewer-master/lib/libebook/libebook.pro ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile 
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -O2 -fPIC -std=gnu++1z  -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk -mmacosx-version-min=12 -Wall -Wextra -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../../src -I/opt/Qt/6.9.0/macos/lib/QtWidgets.framework/Headers -I/opt/Qt/6.9.0/macos/lib/QtGui.framework/Headers -I/opt/Qt/6.9.0/macos/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/AGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/AGL.framework/Headers -I/opt/Qt/6.9.0/macos/mkspecs/macx-clang -F/opt/Qt/6.9.0/macos/lib -o ebook_chm.o ebook_chm.cpp
    In file included from ebook_chm.cpp:23:
    ./ebook_chm.h:23:10: fatal error: 'QTextCodec' file not found
       23 | #include <QTextCodec>
          |          ^~~~~~~~~~~~
    1 error generated.
    make[2]: *** [ebook_chm.o] Error 1
    make[1]: *** [sub-libebook-make_first] Error 2
    make: *** [sub-lib-make_first] Error 2
    amonra@Saturn kchmviewer-master % 
    

    qmake -query says:

    amonra@Saturn kchmviewer-master % qmake -query
    QT_SYSROOT:
    QT_INSTALL_PREFIX:/opt/Qt/6.9.0/macos
    QT_INSTALL_ARCHDATA:/opt/Qt/6.9.0/macos
    QT_INSTALL_DATA:/opt/Qt/6.9.0/macos
    QT_INSTALL_DOCS:/opt/Qt/Docs/Qt-6.9.0
    QT_INSTALL_HEADERS:/opt/Qt/6.9.0/macos/include
    QT_INSTALL_LIBS:/opt/Qt/6.9.0/macos/lib
    QT_INSTALL_LIBEXECS:/opt/Qt/6.9.0/macos/libexec
    QT_INSTALL_BINS:/opt/Qt/6.9.0/macos/bin
    QT_INSTALL_TESTS:/opt/Qt/6.9.0/macos/tests
    QT_INSTALL_PLUGINS:/opt/Qt/6.9.0/macos/plugins
    QT_INSTALL_QML:/opt/Qt/6.9.0/macos/qml
    QT_INSTALL_TRANSLATIONS:/opt/Qt/6.9.0/macos/translations
    QT_INSTALL_CONFIGURATION:
    QT_INSTALL_EXAMPLES:/opt/Qt/Examples/Qt-6.9.0
    QT_INSTALL_DEMOS:/opt/Qt/Examples/Qt-6.9.0
    QT_HOST_PREFIX:/opt/Qt/6.9.0/macos
    QT_HOST_DATA:/opt/Qt/6.9.0/macos
    QT_HOST_BINS:/opt/Qt/6.9.0/macos/bin
    QT_HOST_LIBEXECS:/opt/Qt/6.9.0/macos/libexec
    QT_HOST_LIBS:/opt/Qt/6.9.0/macos/lib
    QMAKE_SPEC:macx-clang
    QMAKE_XSPEC:macx-clang
    QMAKE_VERSION:3.1
    QT_VERSION:6.9.0
    amonra@Saturn kchmviewer-master % 
    

    Clearly I'm missing something ... but what?

    Thanks, David

    1 Reply Last reply
    0
    • A Offline
      A Offline
      aha_1980
      Lifetime Qt Champion
      wrote 15 days ago last edited by
      #2

      @Perdrix khcmviewer.pro is a SUBDIRS project. You have to add that line in the pro files within the src and lib folder, or in a pri include file that is used from all the pro files.

      Regards.

      Qt has to stay free or it will die.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Perdrix
        wrote 15 days ago last edited by Perdrix 14 days from now
        #3

        Hmmm I created a qmake.conf file in project root folder with:

        QMAKE_MACOSX_DEPLOYMENT_TARGET = 13.4
        QMAKE_APPLE_DEVICE_ARCHS = x86_64 arm64
        QT += core5compat
        

        but that didn't seem to help.

        I renamed that to a .pri file in the root folder and included it in all the .pro files which was a bit of a pain but seems to work.

        Did I just get something wrong with the qmake.conf file?

        S 1 Reply Last reply 15 days ago
        0
        • P Perdrix
          15 days ago

          Hmmm I created a qmake.conf file in project root folder with:

          QMAKE_MACOSX_DEPLOYMENT_TARGET = 13.4
          QMAKE_APPLE_DEVICE_ARCHS = x86_64 arm64
          QT += core5compat
          

          but that didn't seem to help.

          I renamed that to a .pri file in the root folder and included it in all the .pro files which was a bit of a pain but seems to work.

          Did I just get something wrong with the qmake.conf file?

          S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote 15 days ago last edited by
          #4

          @Perdrix Hi,

          If memory serves well it is .qmake.conf.

          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
          • P Offline
            P Offline
            Perdrix
            wrote 14 days ago last edited by
            #5

            Hmm...

            amonra@Saturn kchmviewer-master % cat .qmake.conf
            QMAKE_MACOSX_DEPLOYMENT_TARGET = 13.4
            QMAKE_APPLE_DEVICE_ARCHS = x86_64 arm64
            QT += core5compat
            amonra@Saturn kchmviewer-master % 
            

            but it didn't appear to impact the subdirectory stuff as I still get the same problem. Clearly there's more to this...

            David

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote 13 days ago last edited by SGaist 6 Oct 2025, 07:55
              #6

              I just tested this on a dummy subdirs project with a .qmake.conf file containing the following at the root of the project and three sub projects (app, lib, lib2):

              QT += qt5compat
              
              QMAKE_MACOSX_DEPLOYMENT_TARGET = 13.4
              QMAKE_APPLE_DEVICE_ARCHS = x86_64 arm64
              

              In each .pro file:

              message("$$QT")
              message("$$QMAKE_MACOSX_DEPLOYMENT_TARGET $$QMAKE_APPLE_DEVICE_ARCHS")
              

              It prints the default set of Qt modules with core5compat added at the end.

              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
              • P Offline
                P Offline
                Perdrix
                wrote 12 days ago last edited by
                #7

                OK thanks - I'll work it all out ...
                D.

                1 Reply Last reply
                0

                1/7

                7 Jun 2025, 13:51

                • Login

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