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. Qt6 running an example from the documentation
Forum Updated to NodeBB v4.3 + New Features

Qt6 running an example from the documentation

Scheduled Pinned Locked Moved Solved Mobile and Embedded
18 Posts 2 Posters 3.6k Views 1 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.
  • JoeCFDJ JoeCFD

    @Ivelin run
    locate .apk
    to find where your apk is located and copy it into your device.

    I Offline
    I Offline
    Ivelin
    wrote on last edited by
    #6

    @JoeCFD, I tried.

    I can't find an apk file anywhere in the current directory.

    JoeCFDJ 1 Reply Last reply
    0
    • I Ivelin

      @JoeCFD, I tried.

      I can't find an apk file anywhere in the current directory.

      JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by
      #7

      @Ivelin did you build? run
      make -j4

      I 1 Reply Last reply
      0
      • JoeCFDJ JoeCFD

        @Ivelin did you build? run
        make -j4

        I Offline
        I Offline
        Ivelin
        wrote on last edited by
        #8

        @JoeCFD 6bfe42a3-523f-4ac5-ac6c-639f60fa787f-image.png

        That's what I get after make -j4

        JoeCFDJ 2 Replies Last reply
        0
        • I Ivelin

          @JoeCFD 6bfe42a3-523f-4ac5-ac6c-639f60fa787f-image.png

          That's what I get after make -j4

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by JoeCFD
          #9

          @Ivelin I am not sure if your app is built. I have a dir android-build which you do not have.

          run
          locate .apk

          normally better to
          mkdir build
          cd build
          cmake ..
          make

          cmake has messy stuff which you do not want it in your project dir.

          1 Reply Last reply
          0
          • I Ivelin

            @JoeCFD 6bfe42a3-523f-4ac5-ac6c-639f60fa787f-image.png

            That's what I get after make -j4

            JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by
            #10

            @Ivelin take a look at how to pass Android settings to cmake file.
            https://developer.android.com/ndk/guides/cmake
            What you did will not build.

            I 1 Reply Last reply
            0
            • JoeCFDJ JoeCFD

              @Ivelin take a look at how to pass Android settings to cmake file.
              https://developer.android.com/ndk/guides/cmake
              What you did will not build.

              I Offline
              I Offline
              Ivelin
              wrote on last edited by
              #11

              @JoeCFD, thank you for providing this information. I have clearer picture right now, but I got another problem

              At the moment after I do

              cmake -DCMAKE_TOOLCHAIN_FILE=/opt/android-ndk/build/cmake/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=26 .
              

              I get

              -- Detecting CXX compiler ABI info
              -- Detecting CXX compiler ABI info - done
              -- Check for working CXX compiler: /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ - skipped
              -- Detecting CXX compile features
              -- Detecting CXX compile features - done
              CMake Error at CMakeLists.txt:16 (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:
              
                  Qt6Config.cmake
                  qt6-config.cmake
              
                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 "/home/ivelin/Qt/Examples/Qt-6.2.4/corelib/platform/androidnotifier/CMakeFiles/CMakeOutput.log".
              

              which is weird because when I do

              cmake .
              

              only

              I get

              -- The CXX compiler identification is GNU 9.4.0
              -- Detecting CXX compiler ABI info
              -- Detecting CXX compiler ABI info - done
              -- Check for working CXX compiler: /usr/bin/c++ - skipped
              -- Detecting CXX compile features
              -- Detecting CXX compile features - done
              -- 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 - Failed
              -- Check if compiler accepts -pthread
              -- Check if compiler accepts -pthread - yes
              -- Found Threads: TRUE  
              -- Could NOT find Qt6WidgetsTools (missing: Qt6WidgetsTools_DIR)
              CMake Warning at /home/ivelin/Qt/6.2.4/android_x86_64/lib/cmake/Qt6/Qt6Config.cmake:209 (find_package):
                Found package configuration file:
              
                  /home/ivelin/Qt/6.2.4/android_x86_64/lib/cmake/Qt6Widgets/Qt6WidgetsConfig.cmake
              
                but it set Qt6Widgets_FOUND to FALSE so package "Qt6Widgets" is considered
                to be NOT FOUND.  Reason given by package:
              
                Target "Qt6::Widgets" was not found.
              
              Call Stack (most recent call first):
                CMakeLists.txt:16 (find_package)
              
              
              -- Configuring done
              -- Generating done
              -- Build files have been written to: /home/ivelin/Qt/Examples/Qt-6.2.4/corelib/platform/androidnotifier
              

              Why is that ? Could you help me out ?

              JoeCFDJ 1 Reply Last reply
              0
              • I Ivelin

                @JoeCFD, thank you for providing this information. I have clearer picture right now, but I got another problem

                At the moment after I do

                cmake -DCMAKE_TOOLCHAIN_FILE=/opt/android-ndk/build/cmake/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=26 .
                

                I get

                -- Detecting CXX compiler ABI info
                -- Detecting CXX compiler ABI info - done
                -- Check for working CXX compiler: /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ - skipped
                -- Detecting CXX compile features
                -- Detecting CXX compile features - done
                CMake Error at CMakeLists.txt:16 (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:
                
                    Qt6Config.cmake
                    qt6-config.cmake
                
                  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 "/home/ivelin/Qt/Examples/Qt-6.2.4/corelib/platform/androidnotifier/CMakeFiles/CMakeOutput.log".
                

                which is weird because when I do

                cmake .
                

                only

                I get

                -- The CXX compiler identification is GNU 9.4.0
                -- Detecting CXX compiler ABI info
                -- Detecting CXX compiler ABI info - done
                -- Check for working CXX compiler: /usr/bin/c++ - skipped
                -- Detecting CXX compile features
                -- Detecting CXX compile features - done
                -- 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 - Failed
                -- Check if compiler accepts -pthread
                -- Check if compiler accepts -pthread - yes
                -- Found Threads: TRUE  
                -- Could NOT find Qt6WidgetsTools (missing: Qt6WidgetsTools_DIR)
                CMake Warning at /home/ivelin/Qt/6.2.4/android_x86_64/lib/cmake/Qt6/Qt6Config.cmake:209 (find_package):
                  Found package configuration file:
                
                    /home/ivelin/Qt/6.2.4/android_x86_64/lib/cmake/Qt6Widgets/Qt6WidgetsConfig.cmake
                
                  but it set Qt6Widgets_FOUND to FALSE so package "Qt6Widgets" is considered
                  to be NOT FOUND.  Reason given by package:
                
                  Target "Qt6::Widgets" was not found.
                
                Call Stack (most recent call first):
                  CMakeLists.txt:16 (find_package)
                
                
                -- Configuring done
                -- Generating done
                -- Build files have been written to: /home/ivelin/Qt/Examples/Qt-6.2.4/corelib/platform/androidnotifier
                

                Why is that ? Could you help me out ?

                JoeCFDJ Offline
                JoeCFDJ Offline
                JoeCFD
                wrote on last edited by
                #12

                @Ivelin Can you try?
                CMAKE_PREFIX_PATH "/home/ivelin/Qt/6.2.4/android_x86_64/lib/cmake/Qt6"

                I 3 Replies Last reply
                0
                • JoeCFDJ JoeCFD

                  @Ivelin Can you try?
                  CMAKE_PREFIX_PATH "/home/ivelin/Qt/6.2.4/android_x86_64/lib/cmake/Qt6"

                  I Offline
                  I Offline
                  Ivelin
                  wrote on last edited by
                  #13

                  @JoeCFD said in Qt6 running an example from the documentation:

                  /home/ivelin/Qt/6.2.4/android_x86_64/lib/cmake/Qt6"

                  I have set it in the CMakeLists.txt file as

                  set(CMAKE_PREFIX_PATH "/home/ivelin/Qt/6.2.4/android_x86_64/lib/cmake/Qt6")
                  

                  Now I get

                  -- Detecting CXX compiler ABI info
                  -- Detecting CXX compiler ABI info - done
                  -- Check for working CXX compiler: /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ - skipped
                  -- Detecting CXX compile features
                  -- Detecting CXX compile features - done
                  CMake Warning at CMakeLists.txt:15 (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:
                  
                      Qt6Config.cmake
                      qt6-config.cmake
                  
                    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.
                  
                  
                  CMake Error at CMakeLists.txt:26 (qt_add_executable):
                    Unknown CMake command "qt_add_executable".
                  
                  
                  -- Configuring incomplete, errors occurred!
                  See also "/home/ivelin/Qt/Examples/Qt-6.2.4/corelib/platform/androidnotifier/CMakeFiles/CMakeOutput.log".
                  
                  1 Reply Last reply
                  0
                  • JoeCFDJ JoeCFD

                    @Ivelin Can you try?
                    CMAKE_PREFIX_PATH "/home/ivelin/Qt/6.2.4/android_x86_64/lib/cmake/Qt6"

                    I Offline
                    I Offline
                    Ivelin
                    wrote on last edited by
                    #14

                    @JoeCFD, perhaps something is wrong with my toolchain file?

                    I have downloaded this Qt from Qt creator and I got my ndk, sdk and toolchain file ask from the Android Studio

                    JoeCFDJ 1 Reply Last reply
                    0
                    • I Ivelin

                      @JoeCFD, perhaps something is wrong with my toolchain file?

                      I have downloaded this Qt from Qt creator and I got my ndk, sdk and toolchain file ask from the Android Studio

                      JoeCFDJ Offline
                      JoeCFDJ Offline
                      JoeCFD
                      wrote on last edited by
                      #15

                      @Ivelin Try to upgrade your Qt to 6.6.1 and show your command here. I can test it for you. I guess lower Qt6 versions have more bugs.

                      1 Reply Last reply
                      0
                      • JoeCFDJ JoeCFD

                        @Ivelin Can you try?
                        CMAKE_PREFIX_PATH "/home/ivelin/Qt/6.2.4/android_x86_64/lib/cmake/Qt6"

                        I Offline
                        I Offline
                        Ivelin
                        wrote on last edited by Ivelin
                        #16

                        @JoeCFD, I have made some progress.

                        As I said I have downloaded Qt6 from the Qt Maintenance. I looked in the Qt/6.2.4 folder and saw there there is a qt.toolchain.cmake file in Qt/6.2.4/android_x86_64/lib/cmake/Qt6/qt.toolchain.cmake, so I used that one.

                        It gave me an error that it is searching for /opt/android/android-ndk-r22b, but I hadn't had /opt/android, so I created a folder and downloaded the anroid-ndk-r22b file from the official android ndk downloads. It was also searching for an sdk, but I already had one ( Don't remember where I got it from )

                        After that I ran this command:

                        cmake -DCMAKE_TOOLCHAIN_FILE=/home/ivelin/Qt/6.2.4/android_x86_64/lib/cmake/Qt6/qt.toolchain.cmake .
                        

                        I got

                        -- The CXX compiler identification is Clang 11.0.5
                        -- Detecting CXX compiler ABI info
                        -- Detecting CXX compiler ABI info - done
                        -- Check for working CXX compiler: /opt/android/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ - skipped
                        -- Detecting CXX compile features
                        -- Detecting CXX compile features - done
                        -- 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 - Failed
                        -- Check if compiler accepts -pthread
                        -- Check if compiler accepts -pthread - yes
                        -- Found Threads: TRUE  
                        -- Performing Test HAVE_STDATOMIC
                        -- Performing Test HAVE_STDATOMIC - Success
                        -- Found WrapAtomic: TRUE  
                        -- Performing Test HAVE_EGL
                        -- Performing Test HAVE_EGL - Success
                        -- Found EGL: /opt/android/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include (found version "1.5") 
                        -- Performing Test HAVE_GLESv2
                        -- Performing Test HAVE_GLESv2 - Success
                        -- Found GLESv2: /opt/android/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include  
                        -- Found WrapVulkanHeaders: /opt/android/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include  
                        -- Found android platform plugin at: /home/ivelin/Qt/6.2.4/android_x86_64/./plugins/platforms/libplugins_platforms_qtforandroid_x86_64.so
                        -- Configuring done
                        -- Generating done
                        -- Build files have been written to: /home/ivelin/Qt/Examples/Qt-6.2.4/corelib/platform/androidnotifier
                        

                        which seems like a successful build. Then I ran make and got

                        8b18b9a0-6f70-4d11-b42a-850029993378-image.png

                        Why is that ? Any ideas on how to fix it ?

                        JoeCFDJ 1 Reply Last reply
                        0
                        • I Ivelin

                          @JoeCFD, I have made some progress.

                          As I said I have downloaded Qt6 from the Qt Maintenance. I looked in the Qt/6.2.4 folder and saw there there is a qt.toolchain.cmake file in Qt/6.2.4/android_x86_64/lib/cmake/Qt6/qt.toolchain.cmake, so I used that one.

                          It gave me an error that it is searching for /opt/android/android-ndk-r22b, but I hadn't had /opt/android, so I created a folder and downloaded the anroid-ndk-r22b file from the official android ndk downloads. It was also searching for an sdk, but I already had one ( Don't remember where I got it from )

                          After that I ran this command:

                          cmake -DCMAKE_TOOLCHAIN_FILE=/home/ivelin/Qt/6.2.4/android_x86_64/lib/cmake/Qt6/qt.toolchain.cmake .
                          

                          I got

                          -- The CXX compiler identification is Clang 11.0.5
                          -- Detecting CXX compiler ABI info
                          -- Detecting CXX compiler ABI info - done
                          -- Check for working CXX compiler: /opt/android/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ - skipped
                          -- Detecting CXX compile features
                          -- Detecting CXX compile features - done
                          -- 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 - Failed
                          -- Check if compiler accepts -pthread
                          -- Check if compiler accepts -pthread - yes
                          -- Found Threads: TRUE  
                          -- Performing Test HAVE_STDATOMIC
                          -- Performing Test HAVE_STDATOMIC - Success
                          -- Found WrapAtomic: TRUE  
                          -- Performing Test HAVE_EGL
                          -- Performing Test HAVE_EGL - Success
                          -- Found EGL: /opt/android/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include (found version "1.5") 
                          -- Performing Test HAVE_GLESv2
                          -- Performing Test HAVE_GLESv2 - Success
                          -- Found GLESv2: /opt/android/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include  
                          -- Found WrapVulkanHeaders: /opt/android/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include  
                          -- Found android platform plugin at: /home/ivelin/Qt/6.2.4/android_x86_64/./plugins/platforms/libplugins_platforms_qtforandroid_x86_64.so
                          -- Configuring done
                          -- Generating done
                          -- Build files have been written to: /home/ivelin/Qt/Examples/Qt-6.2.4/corelib/platform/androidnotifier
                          

                          which seems like a successful build. Then I ran make and got

                          8b18b9a0-6f70-4d11-b42a-850029993378-image.png

                          Why is that ? Any ideas on how to fix it ?

                          JoeCFDJ Offline
                          JoeCFDJ Offline
                          JoeCFD
                          wrote on last edited by
                          #17

                          @Ivelin Read the error messages. Install Android studio and then use it to install SDK build tool 30.0.2.

                          I 1 Reply Last reply
                          0
                          • JoeCFDJ JoeCFD

                            @Ivelin Read the error messages. Install Android studio and then use it to install SDK build tool 30.0.2.

                            I Offline
                            I Offline
                            Ivelin
                            wrote on last edited by
                            #18

                            @JoeCFD, sorry that was a stupid mistake from mine.

                            I have installed the corresponding SDK from Android Studio and moved the file from where the Android Studio was configured to download it to where qt6 cmake is searching for it - /opt/android and now it is working.

                            Thank you for your patience and support. I wouldn't make it without your patience and guidance.

                            Cheers.

                            1 Reply Last reply
                            0
                            • I Ivelin has marked this topic as solved on

                            • Login

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