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. Compiling Android project with C++20 and Qt 6.5.8
QtWS25 Last Chance

Compiling Android project with C++20 and Qt 6.5.8

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
11 Posts 2 Posters 482 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.
  • H Offline
    H Offline
    hamer
    wrote on 30 Jan 2025, 09:18 last edited by
    #1

    Hi,

    I have a Qt project which uses c++20 features ("numers", "source_location", etc.) which I want to compile with Qt 6.5.8 for Android but this always fails (using NDK 25.x). The same project works fine with Qt 6.8.1 for Android or Qt 6.5.8 for iOS/Windows.

    Is Qt 6.5.8 for Android not compatible with C++20?

    Regards,

    J 1 Reply Last reply 30 Jan 2025, 09:41
    0
    • H hamer
      30 Jan 2025, 09:18

      Hi,

      I have a Qt project which uses c++20 features ("numers", "source_location", etc.) which I want to compile with Qt 6.5.8 for Android but this always fails (using NDK 25.x). The same project works fine with Qt 6.8.1 for Android or Qt 6.5.8 for iOS/Windows.

      Is Qt 6.5.8 for Android not compatible with C++20?

      Regards,

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 30 Jan 2025, 09:41 last edited by
      #2

      @hamer said in Compiling Android project with C++20 and Qt 6.5.8:

      Is Qt 6.5.8 for Android not compatible with C++20?

      I don't think so.
      What errors do you get?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hamer
        wrote on 30 Jan 2025, 13:55 last edited by
        #3

        It fails with

        Fatal error: 'numbers' file not found #include <numbers>
        
        J 1 Reply Last reply 30 Jan 2025, 14:13
        0
        • H Offline
          H Offline
          hamer
          wrote on 30 Jan 2025, 14:05 last edited by
          #4

          When I set ANDROID_NDK to "28.0.12916984" then I get errors like these:

          In file included from C:/Android/ndk/28.0.12916984/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/optional:180:
          In file included from C:/Android/ndk/28.0.12916984/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/__assert:13:
          In file included from C:/Android/ndk/28.0.12916984/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/__assertion_handler:14:
          C:/Android/ndk/28.0.12916984/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/__verbose_abort:20:1: error: expected expression
          C:/Android/ndk/28.0.12916984/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/__config:866:32: note: expanded from macro '_LIBCPP_BEGIN_NAMESPACE_STD'
                                         inline namespace _LIBCPP_ABI_NAMESPACE {
                                         ^
          

          But it seems as if NDK 25 and 28 are mixed (although I have set ANDROID_NDK and CMAKE_TOOLCHAIN_FILE to NDK 28).

          1 Reply Last reply
          0
          • H hamer
            30 Jan 2025, 13:55

            It fails with

            Fatal error: 'numbers' file not found #include <numbers>
            
            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 30 Jan 2025, 14:13 last edited by
            #5

            @hamer said in Compiling Android project with C++20 and Qt 6.5.8:

            <numbers>

            This requires C++20 - did you enable C++20?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • H Offline
              H Offline
              hamer
              wrote on 30 Jan 2025, 14:48 last edited by
              #6

              Yes. The project with its C++20 features works on others systems, as well as Qt 6.8.1 for Android but fails with 6.5.x. I cannot use Qt 6.8.1 because there is has a bug which has been fixed in Qt 6.8.2.

              J 1 Reply Last reply 30 Jan 2025, 14:52
              0
              • H hamer
                30 Jan 2025, 14:48

                Yes. The project with its C++20 features works on others systems, as well as Qt 6.8.1 for Android but fails with 6.5.x. I cannot use Qt 6.8.1 because there is has a bug which has been fixed in Qt 6.8.2.

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 30 Jan 2025, 14:52 last edited by
                #7

                @hamer But did you verify that C++20 is enabled when you build with 6.5.x? You should enabled it explicitly.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  hamer
                  wrote on 30 Jan 2025, 15:27 last edited by
                  #8

                  How can I verify it? My CMakeLists.txt has these lines:

                  set(CMAKE_CXX_STANDARD 20)
                  set(CMAKE_CXX_STANDARD_REQUIRED ON)
                  
                  J 1 Reply Last reply 31 Jan 2025, 06:25
                  0
                  • H hamer
                    30 Jan 2025, 15:27

                    How can I verify it? My CMakeLists.txt has these lines:

                    set(CMAKE_CXX_STANDARD 20)
                    set(CMAKE_CXX_STANDARD_REQUIRED ON)
                    
                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 31 Jan 2025, 06:25 last edited by
                    #9

                    @hamer said in Compiling Android project with C++20 and Qt 6.5.8:

                    How can I verify it?

                    By looking at the build log to see what parameter were passed to the compiler.

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      hamer
                      wrote on 31 Jan 2025, 08:03 last edited by
                      #10

                      The logs show c++20:

                      C:/QtCommercial/6.5.8/android_arm64_v8a/include -isystem C:/QtCommercial/6.5.8/android_arm64_v8a/include/QtCore -isystem C:/QtCommercial/6.5.8/android_arm64_v8a/mkspecs/android-clang -isystem C:/QtCommercial/6.5.8/android_arm64_v8a/include/QtGui -isystem C:/QtCommercial/6.5.8/android_arm64_v8a/include/QtNetwork -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -frtti -stdlib=libc++ -O3 -DNDEBUG -std=c++20 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fno-rtti -Wall -Wshadow -Wextra -Wno-error=tautological-constant-compare -pthread
                      
                      J 1 Reply Last reply 31 Jan 2025, 08:27
                      0
                      • H hamer
                        31 Jan 2025, 08:03

                        The logs show c++20:

                        C:/QtCommercial/6.5.8/android_arm64_v8a/include -isystem C:/QtCommercial/6.5.8/android_arm64_v8a/include/QtCore -isystem C:/QtCommercial/6.5.8/android_arm64_v8a/mkspecs/android-clang -isystem C:/QtCommercial/6.5.8/android_arm64_v8a/include/QtGui -isystem C:/QtCommercial/6.5.8/android_arm64_v8a/include/QtNetwork -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -frtti -stdlib=libc++ -O3 -DNDEBUG -std=c++20 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fno-rtti -Wall -Wshadow -Wextra -Wno-error=tautological-constant-compare -pthread
                        
                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 31 Jan 2025, 08:27 last edited by
                        #11

                        @hamer Where is this numbers header included?

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0

                        9/11

                        31 Jan 2025, 06:25

                        • Login

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