Running an app with QT 6.2.2 on MacOS

Built QT 6.2.2 and installed QT Creator 6.0.1, it started but with the following errors:

because .config folder is owned by root that is a mistake:

cd ~
ls -la
total 48
drwxr-xr-x+ 20 admin  staff    640 Dec 20 20:37 .
drwxr-xr-x   5 root   admin    160 Nov 28 19:16 ..
-r--------   1 admin  staff      7 Nov 28 21:21 .CFUserTextEncoding
-rw-r--r--@  1 admin  staff  10244 Dec 20 13:09 .DS_Store
drwx------   2 admin  staff     64 Dec 20 20:15 .Trash
drwxr-xr-x  10 admin  staff    320 Nov 28 21:12 .anydesk
drwx------   3 root   staff     96 Dec 20 20:26 .config
-rw-r--r--   1 admin  staff     54 Dec 20 16:24 .gitconfig
drwxr-xr-x   4 admin  staff    128 Dec 20 16:23 .swiftpm
-rw-------   1 admin  staff    918 Dec 20 20:37 .zsh_history
drwx------  18 admin  staff    576 Dec 20 20:37 .zsh_sessions
drwx------+  4 admin  staff    128 Nov 30 23:41 Desktop
drwx------+  4 admin  staff    128 Dec 20 15:21 Documents
drwx------+  6 admin  staff    192 Dec 22 17:20 Downloads
drwx------@ 66 admin  staff   2112 Dec 20 16:23 Library
drwx------   5 admin  staff    160 Nov 30 23:05 Movies
drwx------+  3 admin  staff     96 Nov 28 19:16 Music
drwx------+  5 admin  staff    160 Dec  1 09:10 Pictures
drwxr-xr-x+  4 admin  staff    128 Nov 28 19:16 Public
drwxr-xr-x   6 admin  staff    192 Dec 22 17:22 repos

so I did:

sudo chown -R admin .config

it created .config/QtProject/ folder and I was able to add my QT version:

CMake failed with my app:

Running /usr/local/Cellar/cmake/3.22.1/bin/cmake -S /Users/admin/repos/examples/src/LinesGame/LinesGameQt -B /Users/admin/repos/examples/src/LinesGame/build-LinesGameQt-Desktop_x86_darwin_generic_mach_o_64bit-Release '-GUnix Makefiles' -DCMAKE_BUILD_TYPE:STRING=Release '-DCMAKE_PROJECT_INCLUDE_BEFORE:PATH=/private/var/folders/ln/q_kcsnm53rlc0b3dxhsnkvc00000gn/T/AppTranslocation/F364F143-D004-45EB-9FFC-282EF87BFEBE/d/Qt' -DQT_QMAKE_EXECUTABLE:STRING= -DCMAKE_PREFIX_PATH:STRING= -DCMAKE_C_COMPILER:STRING=/usr/bin/clang -DCMAKE_CXX_COMPILER:STRING=/usr/bin/clang++ in /Users/admin/repos/examples/src/LinesGame/build-LinesGameQt-Desktop_x86_darwin_generic_mach_o_64bit-Release.
-- The CXX compiler identification is AppleClang
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:45 (find_package):
  By not providing "FindQt6.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt6", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt6" with any of
  the following names:


  Add the installation prefix of "Qt6" to CMAKE_PREFIX_PATH or set "Qt6_DIR"
  to a directory containing one of the above files.  If "Qt6" provides a
  separate development package or SDK, be sure it has been installed.

-- Configuring incomplete, errors occurred!
See also "/Users/admin/repos/examples/src/LinesGame/build-LinesGameQt-Desktop_x86_darwin_generic_mach_o_64bit-Release/CMakeFiles/CMakeOutput.log".
CMake process exited with exit code 1.

Elapsed time: 00:00.

I fixed this by adding QT version to 64 bit kit:

My app built successfully but failed to start:

Starting the application event loop...
Shader compilation failed: ERROR: 0:2: 'precision' : Reserved word. 
ERROR: 0:2: 'precision' : syntax error: syntax error
libc++abi: terminating with uncaught exception of type LinesGame::ShaderException: N9LinesGame15ShaderExceptionE

Configured Visual Studio Code:

    "protocol": "sftp",
    "host": "mac",
    "port": 22,
    "username": "admin",
    "password": "*********",
    "remotePath": "/Users/admin/repos/examples",
    "syncMode": "full",
    "uploadOnSave": true,
    "ignore": [".git", "build-*", ".DS_Store", "*.user"]

Commented precision mediump float in all the shaders:

const std::string fs = SHADER_SOURCE
    //precision mediump float;
    varying vec2 v_texCoord;
    uniform sampler2D s_texture;
    void main()
        gl_FragColor = texture2D(s_texture, v_texCoord);

and my app started:

But did not hear sounds because

Please note that due to macOS security restrictions, users cannot transmit audio from a remote macOS device.

XCode versions

xcrun -sdk macosx -find clang
xcrun -sdk macosx --show-sdk-path
/Library/Developer/CommandLineTools/usr/bin/c++ -v


clang++ -v
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
xcode-select --version
xcode-select version 2384.

Configuring XCode and QT Creator

As you can see on pictures above, QT Creator detected x86 and x64 compilers, but not ARM compilers. I did a quick Google search and found this:

Switched to full XCode:

sudo xcode-select -s /Applications/

and was able to print the versions as follows:

xcodebuild -showsdks
DriverKit SDKs:
        DriverKit 21.2                  -sdk driverkit21.2

        iOS 15.2                        -sdk iphoneos15.2

iOS Simulator SDKs:
        Simulator - iOS 15.2            -sdk iphonesimulator15.2

macOS SDKs:
        macOS 12.1                      -sdk macosx12.1

tvOS SDKs:
        tvOS 15.2                       -sdk appletvos15.2

tvOS Simulator SDKs:
        Simulator - tvOS 15.2           -sdk appletvsimulator15.2

watchOS SDKs:
        watchOS 8.3                     -sdk watchos8.3

watchOS Simulator SDKs:
        Simulator - watchOS 8.3         -sdk watchsimulator8.3

CLang location changed:

xcrun -sdk macosx -find clang

SDK was 12 but not 10 as in QT docs:

xcrun -sdk macosx --show-sdk-path

and QT Creator detected ARM compiler:

but when I tried to select my QT version that I built with ARM compiler I got this:

obviously because in the compiler summary I had this:

Building for: macx-clang (x86_64, CPU features: cx16 mmx sse sse2 sse3 ssse3 sse4.1)

1 Response to Running an app with QT 6.2.2 on MacOS

  1. dmitriano says:

    On Android I got: Shader compilation failed: ERROR: 0:2: ” : No precision specified for (float)

Leave a Reply

Your email address will not be published. Required fields are marked *