Using qmake for the first time
-
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
-
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?
-
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?
-
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
-
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.