Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Failing to target ios simulator with CMAKE - getting No known features for CXX compiler error
QtWS25 Last Chance

Failing to target ios simulator with CMAKE - getting No known features for CXX compiler error

Scheduled Pinned Locked Moved Solved Mobile and Embedded
cmakeios simulatormacosqt6qt creator 8.0
2 Posts 1 Posters 1.8k 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.
  • Q Offline
    Q Offline
    qtusr
    wrote on 17 Oct 2022, 04:24 last edited by qtusr
    #1

    Hi,

    My context: macOS 12.6 (21G115), Monterey, Qt 6.4.0 LGPL 3.0, I installed it last night, Qt Creator 8.0.1.
    What do I want to do: create a widgets project with Qt Creator and run it on the IOS simulator.
    When I created the test project I selected CMAKE and I selected the Qt 6.4.0 for iOS, Qt 6.4.0 for iOS Simulator and Qt 6.4.0 for macOS kits.

    When I tried to compile this project I got:

    Running /Users/qtusr/Qt/Tools/CMake/CMake.app/Contents/bin/cmake -S /Users/qtusr/Documents/development/Qt/TestIos3 -B /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS -DCMAKE_GENERATOR:STRING=Xcode '-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=/Users/qtusr/Qt/Qt Creator.app/Contents/Resources/package-manager/auto-setup.cmake' -DQT_QMAKE_EXECUTABLE:FILEPATH=/Users/qtusr/Qt/6.4.0/ios/bin/qmake -DCMAKE_PREFIX_PATH:PATH=/Users/qtusr/Qt/6.4.0/ios -DCMAKE_C_COMPILER:FILEPATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -DCMAKE_TOOLCHAIN_FILE:FILEPATH=/Users/qtusr/Qt/6.4.0/ios/lib/cmake/Qt6/qt.toolchain.cmake -DCMAKE_OSX_ARCHITECTURES:STRING=arm64 -DCMAKE_OSX_SYSROOT:STRING=iphoneos -DCMAKE_CXX_FLAGS_INIT:STRING=-DQT_QML_DEBUG -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM:STRING=M8R6XHV5V6 in /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS.
    Running /Users/qtusr/Qt/Tools/CMake/CMake.app/Contents/bin/cmake -S /Users/qtusr/Documents/development/Qt/TestIos3 -B /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator -DCMAKE_GENERATOR:STRING=Xcode '-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=/Users/qtusr/Qt/Qt Creator.app/Contents/Resources/package-manager/auto-setup.cmake' -DQT_QMAKE_EXECUTABLE:FILEPATH=/Users/qtusr/Qt/6.4.0/ios/bin/qmake -DCMAKE_PREFIX_PATH:PATH=/Users/qtusr/Qt/6.4.0/ios -DCMAKE_C_COMPILER:FILEPATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -DCMAKE_TOOLCHAIN_FILE:FILEPATH=/Users/qtusr/Qt/6.4.0/ios/lib/cmake/Qt6/qt.toolchain.cmake -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64 -DCMAKE_OSX_SYSROOT:STRING=iphonesimulator -DCMAKE_CXX_FLAGS_INIT:STRING=-DQT_QML_DEBUG in /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator.
    -- The CXX compiler identification is unknown
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
    -- Looking for C++ include pthread.h
    -- Looking for C++ include pthread.h - found
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
    -- Found Threads: TRUE  
    -- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/usr/lib/libz.tbd (found version "1.2.11") 
    -- Found WrapSystemZLIB: TRUE  
    -- Using system ZLIB.
    -- Found WrapZLIB: TRUE  
    -- Performing Test HAVE_STDATOMIC
    -- Performing Test HAVE_STDATOMIC - Success
    -- Found WrapAtomic: TRUE  
    -- Looking for backtrace
    -- Looking for backtrace - found
    -- backtrace facility detected in default set of libraries
    -- Found Backtrace: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/usr/include  
    -- Using Qt bundled PCRE2.
    -- Found WrapPCRE2: TRUE  
    -- Performing Test HAVE_GETTIME
    -- Performing Test HAVE_GETTIME - Success
    -- Found WrapRt: TRUE  
    -- Performing Test HAVE_EGL
    -- Performing Test HAVE_EGL - Failed
    -- Could NOT find EGL (missing: EGL_INCLUDE_DIR HAVE_EGL EGL_LIBRARY) 
    -- Performing Test HAVE_GLESv2
    -- Performing Test HAVE_GLESv2 - Success
    -- Found GLESv2: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/OpenGLES.framework  
    -- Using Qt bundled PNG.
    -- Found WrapPNG: TRUE  
    -- Using Qt bundled Harfbuzz.
    -- Found WrapHarfbuzz: TRUE  
    -- Using Qt bundled Freetype.
    -- Found WrapFreetype: TRUE  
    -- Using Qt bundled Jpeg.
    -- Found WrapJpeg: TRUE  
    -- Found AVFoundation: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/AVFoundation.framework  
    -- Configuring done
    CMake Error in CMakeLists.txt:
      No known features for CXX compiler
    
      ""
    
      version .
    
    
    CMake Generate step failed.  Build files cannot be regenerated correctly.
    CMake process exited with exit code 1.
    
    Elapsed time: 00:27.
    

    This is from the error file:

        cd /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -target x86_64-apple-ios13.0-simulator -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -Wno-implicit-fallthrough -DCMAKE_INTDIR\=\"Debug-iphonesimulator\" -DHAVE_EGL -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -Wno-semicolon-before-method-body -I/Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/Debug/include -I/Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/DerivedSources-normal/x86_64 -I/Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/DerivedSources/x86_64 -I/Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/DerivedSources -F/Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/Debug -DQT_QML_DEBUG -MMD -MT dependencies -MF /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/Objects-normal/x86_64/src.d --serialize-diagnostics /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/Objects-normal/x86_64/src.dia -c /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/src.cxx -o /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/Objects-normal/x86_64/src.o
    /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/src.cxx:2:10: fatal error: 'EGL/egl.h' file not found
    #include <EGL/egl.h>
             ^~~~~~~~~~~
    1 error generated.
    
    WriteAuxiliaryFile /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/Objects-normal/x86_64/cmTC_704b0.LinkFileList (in target 'cmTC_704b0' from project 'CMAKE_TRY_COMPILE')
        cd /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp
        write-file /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/Objects-normal/x86_64/cmTC_704b0.LinkFileList
    
    ** BUILD FAILED **
    
    
    The following build commands failed:
    	CompileC /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/Objects-normal/x86_64/src.o /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/src.cxx normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'cmTC_704b0' from project 'CMAKE_TRY_COMPILE')
    (1 failure)
    
    
    Source file was:
    
    #include <EGL/egl.h>
    
    int main(int, char **) {
        EGLint x = 0; EGLDisplay dpy = 0; EGLContext ctx = 0;
        eglDestroyContext(dpy, ctx);
    }
    
    
    

    CMakeLists.txt:

    cmake_minimum_required(VERSION 3.5)
    
    project(TestIos3 VERSION 0.1 LANGUAGES CXX)
    
    set(CMAKE_INCLUDE_CURRENT_DIR ON)
    
    set(CMAKE_AUTOUIC ON)
    set(CMAKE_AUTOMOC ON)
    set(CMAKE_AUTORCC ON)
    
    set(CMAKE_CXX_STANDARD 17)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    
    find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
    find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
    
    set(PROJECT_SOURCES
            main.cpp
            mainwindow.cpp
            mainwindow.h
            mainwindow.ui
    )
    
    if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
        qt_add_executable(TestIos3
            MANUAL_FINALIZATION
            ${PROJECT_SOURCES}
        )
    # Define target properties for Android with Qt 6 as:
    #    set_property(TARGET TestIos3 APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
    #                 ${CMAKE_CURRENT_SOURCE_DIR}/android)
    # For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
    else()
        if(ANDROID)
            add_library(TestIos3 SHARED
                ${PROJECT_SOURCES}
            )
    # Define properties for Android with Qt 5 after find_package() calls as:
    #    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
        else()
            add_executable(TestIos3
                ${PROJECT_SOURCES}
            )
        endif()
    endif()
    
    target_link_libraries(TestIos3 PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
    
    set_target_properties(TestIos3 PROPERTIES
        MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
        MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
        MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
        MACOSX_BUNDLE TRUE
        WIN32_EXECUTABLE TRUE
    )
    
    install(TARGETS TestIos3
        BUNDLE DESTINATION .
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
    
    if(QT_VERSION_MAJOR EQUAL 6)
        qt_finalize_executable(TestIos3)
    endif()
    
    

    Right off the bat I should say that when I created the same type of project but I selected qmake, the whole thing worked fine and I was able to run the app in the simulator. The project also works with CMAKE when I targeted MacOS.

    I know that Qt adopted CMAKE - I've seen this video where he justified why they chose CMAKE. He convinced me, and I chose CMAKE as well, and I started to even learn more about it.

    I tried to find more information about this error but none of the suggestions I found worked. Here is on post on SO, but I don't understand the answer. I tried different required versions of CMAKE but none of them worked.

    Any idea about what's going on? What can I do to get it working? Imo, this is a basic starting point, app created with Qt Creator, uses CMAKE, targets iOS simulator, and I cannot get past the compilation phase.

    Update: I submitted a bug report: https://bugreports.qt.io/browse/QTBUG-107695 .

    Thank you!

    Q 1 Reply Last reply 17 Oct 2022, 16:15
    0
    • Q qtusr
      17 Oct 2022, 04:24

      Hi,

      My context: macOS 12.6 (21G115), Monterey, Qt 6.4.0 LGPL 3.0, I installed it last night, Qt Creator 8.0.1.
      What do I want to do: create a widgets project with Qt Creator and run it on the IOS simulator.
      When I created the test project I selected CMAKE and I selected the Qt 6.4.0 for iOS, Qt 6.4.0 for iOS Simulator and Qt 6.4.0 for macOS kits.

      When I tried to compile this project I got:

      Running /Users/qtusr/Qt/Tools/CMake/CMake.app/Contents/bin/cmake -S /Users/qtusr/Documents/development/Qt/TestIos3 -B /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS -DCMAKE_GENERATOR:STRING=Xcode '-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=/Users/qtusr/Qt/Qt Creator.app/Contents/Resources/package-manager/auto-setup.cmake' -DQT_QMAKE_EXECUTABLE:FILEPATH=/Users/qtusr/Qt/6.4.0/ios/bin/qmake -DCMAKE_PREFIX_PATH:PATH=/Users/qtusr/Qt/6.4.0/ios -DCMAKE_C_COMPILER:FILEPATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -DCMAKE_TOOLCHAIN_FILE:FILEPATH=/Users/qtusr/Qt/6.4.0/ios/lib/cmake/Qt6/qt.toolchain.cmake -DCMAKE_OSX_ARCHITECTURES:STRING=arm64 -DCMAKE_OSX_SYSROOT:STRING=iphoneos -DCMAKE_CXX_FLAGS_INIT:STRING=-DQT_QML_DEBUG -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM:STRING=M8R6XHV5V6 in /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS.
      Running /Users/qtusr/Qt/Tools/CMake/CMake.app/Contents/bin/cmake -S /Users/qtusr/Documents/development/Qt/TestIos3 -B /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator -DCMAKE_GENERATOR:STRING=Xcode '-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=/Users/qtusr/Qt/Qt Creator.app/Contents/Resources/package-manager/auto-setup.cmake' -DQT_QMAKE_EXECUTABLE:FILEPATH=/Users/qtusr/Qt/6.4.0/ios/bin/qmake -DCMAKE_PREFIX_PATH:PATH=/Users/qtusr/Qt/6.4.0/ios -DCMAKE_C_COMPILER:FILEPATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -DCMAKE_TOOLCHAIN_FILE:FILEPATH=/Users/qtusr/Qt/6.4.0/ios/lib/cmake/Qt6/qt.toolchain.cmake -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64 -DCMAKE_OSX_SYSROOT:STRING=iphonesimulator -DCMAKE_CXX_FLAGS_INIT:STRING=-DQT_QML_DEBUG in /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator.
      -- The CXX compiler identification is unknown
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
      -- Looking for C++ include pthread.h
      -- Looking for C++ include pthread.h - found
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
      -- Found Threads: TRUE  
      -- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/usr/lib/libz.tbd (found version "1.2.11") 
      -- Found WrapSystemZLIB: TRUE  
      -- Using system ZLIB.
      -- Found WrapZLIB: TRUE  
      -- Performing Test HAVE_STDATOMIC
      -- Performing Test HAVE_STDATOMIC - Success
      -- Found WrapAtomic: TRUE  
      -- Looking for backtrace
      -- Looking for backtrace - found
      -- backtrace facility detected in default set of libraries
      -- Found Backtrace: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/usr/include  
      -- Using Qt bundled PCRE2.
      -- Found WrapPCRE2: TRUE  
      -- Performing Test HAVE_GETTIME
      -- Performing Test HAVE_GETTIME - Success
      -- Found WrapRt: TRUE  
      -- Performing Test HAVE_EGL
      -- Performing Test HAVE_EGL - Failed
      -- Could NOT find EGL (missing: EGL_INCLUDE_DIR HAVE_EGL EGL_LIBRARY) 
      -- Performing Test HAVE_GLESv2
      -- Performing Test HAVE_GLESv2 - Success
      -- Found GLESv2: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/OpenGLES.framework  
      -- Using Qt bundled PNG.
      -- Found WrapPNG: TRUE  
      -- Using Qt bundled Harfbuzz.
      -- Found WrapHarfbuzz: TRUE  
      -- Using Qt bundled Freetype.
      -- Found WrapFreetype: TRUE  
      -- Using Qt bundled Jpeg.
      -- Found WrapJpeg: TRUE  
      -- Found AVFoundation: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/AVFoundation.framework  
      -- Configuring done
      CMake Error in CMakeLists.txt:
        No known features for CXX compiler
      
        ""
      
        version .
      
      
      CMake Generate step failed.  Build files cannot be regenerated correctly.
      CMake process exited with exit code 1.
      
      Elapsed time: 00:27.
      

      This is from the error file:

          cd /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp
          /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -target x86_64-apple-ios13.0-simulator -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -Wno-implicit-fallthrough -DCMAKE_INTDIR\=\"Debug-iphonesimulator\" -DHAVE_EGL -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -Wno-semicolon-before-method-body -I/Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/Debug/include -I/Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/DerivedSources-normal/x86_64 -I/Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/DerivedSources/x86_64 -I/Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/DerivedSources -F/Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/Debug -DQT_QML_DEBUG -MMD -MT dependencies -MF /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/Objects-normal/x86_64/src.d --serialize-diagnostics /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/Objects-normal/x86_64/src.dia -c /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/src.cxx -o /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/Objects-normal/x86_64/src.o
      /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/src.cxx:2:10: fatal error: 'EGL/egl.h' file not found
      #include <EGL/egl.h>
               ^~~~~~~~~~~
      1 error generated.
      
      WriteAuxiliaryFile /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/Objects-normal/x86_64/cmTC_704b0.LinkFileList (in target 'cmTC_704b0' from project 'CMAKE_TRY_COMPILE')
          cd /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp
          write-file /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/Objects-normal/x86_64/cmTC_704b0.LinkFileList
      
      ** BUILD FAILED **
      
      
      The following build commands failed:
      	CompileC /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphonesimulator/cmTC_704b0.build/Objects-normal/x86_64/src.o /Users/qtusr/Documents/development/Qt/build-TestIos3-Qt_6_4_0_for_iOS_Simulator/CMakeFiles/CMakeTmp/src.cxx normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'cmTC_704b0' from project 'CMAKE_TRY_COMPILE')
      (1 failure)
      
      
      Source file was:
      
      #include <EGL/egl.h>
      
      int main(int, char **) {
          EGLint x = 0; EGLDisplay dpy = 0; EGLContext ctx = 0;
          eglDestroyContext(dpy, ctx);
      }
      
      
      

      CMakeLists.txt:

      cmake_minimum_required(VERSION 3.5)
      
      project(TestIos3 VERSION 0.1 LANGUAGES CXX)
      
      set(CMAKE_INCLUDE_CURRENT_DIR ON)
      
      set(CMAKE_AUTOUIC ON)
      set(CMAKE_AUTOMOC ON)
      set(CMAKE_AUTORCC ON)
      
      set(CMAKE_CXX_STANDARD 17)
      set(CMAKE_CXX_STANDARD_REQUIRED ON)
      
      find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
      find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
      
      set(PROJECT_SOURCES
              main.cpp
              mainwindow.cpp
              mainwindow.h
              mainwindow.ui
      )
      
      if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
          qt_add_executable(TestIos3
              MANUAL_FINALIZATION
              ${PROJECT_SOURCES}
          )
      # Define target properties for Android with Qt 6 as:
      #    set_property(TARGET TestIos3 APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
      #                 ${CMAKE_CURRENT_SOURCE_DIR}/android)
      # For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
      else()
          if(ANDROID)
              add_library(TestIos3 SHARED
                  ${PROJECT_SOURCES}
              )
      # Define properties for Android with Qt 5 after find_package() calls as:
      #    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
          else()
              add_executable(TestIos3
                  ${PROJECT_SOURCES}
              )
          endif()
      endif()
      
      target_link_libraries(TestIos3 PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
      
      set_target_properties(TestIos3 PROPERTIES
          MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
          MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
          MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
          MACOSX_BUNDLE TRUE
          WIN32_EXECUTABLE TRUE
      )
      
      install(TARGETS TestIos3
          BUNDLE DESTINATION .
          LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
      
      if(QT_VERSION_MAJOR EQUAL 6)
          qt_finalize_executable(TestIos3)
      endif()
      
      

      Right off the bat I should say that when I created the same type of project but I selected qmake, the whole thing worked fine and I was able to run the app in the simulator. The project also works with CMAKE when I targeted MacOS.

      I know that Qt adopted CMAKE - I've seen this video where he justified why they chose CMAKE. He convinced me, and I chose CMAKE as well, and I started to even learn more about it.

      I tried to find more information about this error but none of the suggestions I found worked. Here is on post on SO, but I don't understand the answer. I tried different required versions of CMAKE but none of them worked.

      Any idea about what's going on? What can I do to get it working? Imo, this is a basic starting point, app created with Qt Creator, uses CMAKE, targets iOS simulator, and I cannot get past the compilation phase.

      Update: I submitted a bug report: https://bugreports.qt.io/browse/QTBUG-107695 .

      Thank you!

      Q Offline
      Q Offline
      qtusr
      wrote on 17 Oct 2022, 16:15 last edited by
      #2

      The solution was to install cmake 3.24.2. This fixes the compilation process.

      1 Reply Last reply
      1

      1/2

      17 Oct 2022, 04:24

      • Login

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