Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using compilers other than MinGW
Forum Update on Monday, May 27th 2025

Using compilers other than MinGW

Scheduled Pinned Locked Moved Unsolved General and Desktop
34 Posts 5 Posters 2.3k 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.
  • jsulmJ jsulm

    @tomy said in Using compilers other than MinGW:

    this time with Clang, please?

    Please take a closer look at the output you get:

    D:\Qt_Stuff\android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++ -c -target armv7a-linux-an
    

    Do you see clang++ ?
    The android Kit already uses Clang to compile.

    tomyT Offline
    tomyT Offline
    tomy
    wrote on last edited by
    #22

    @jsulm

    The problem is that I'm not experienced in it.
    Anyways, yes, I see the above section which is part of a very long line.

    Should I use this method?

    • Going to the "Build" folder using CMD
    • Typing D:\Qt_Stuff\android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++ -c -target armv7a-linux-androideabi21 followed by the path to the project's directory
    jsulmJ 1 Reply Last reply
    0
    • tomyT tomy

      @jsulm

      The problem is that I'm not experienced in it.
      Anyways, yes, I see the above section which is part of a very long line.

      Should I use this method?

      • Going to the "Build" folder using CMD
      • Typing D:\Qt_Stuff\android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++ -c -target armv7a-linux-androideabi21 followed by the path to the project's directory
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #23

      @tomy said in Using compilers other than MinGW:

      Should I use this method?

      Why do you want to do this? This line calls the compiler to compile a source code file. There is usually no need to do it manually, especially in bigger projects. This is how a QMake based project is usually build:

      qmake
      make
      make install
      

      As you can see there is no manual compiler call . Make calls compiler for you.
      Can you please explain what you're trying to achieve?

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

      tomyT 1 Reply Last reply
      0
      • jsulmJ jsulm

        @tomy said in Using compilers other than MinGW:

        Should I use this method?

        Why do you want to do this? This line calls the compiler to compile a source code file. There is usually no need to do it manually, especially in bigger projects. This is how a QMake based project is usually build:

        qmake
        make
        make install
        

        As you can see there is no manual compiler call . Make calls compiler for you.
        Can you please explain what you're trying to achieve?

        tomyT Offline
        tomyT Offline
        tomy
        wrote on last edited by
        #24

        @jsulm

        I think I said that in our prior posts. I'm aiming at building projects using GCC and Clang compilers from command line instead of the hammer button on the IDE (ctrl+B). For the GCC compiler, we made it above and built the project.
        For Clang, you said it's similar. So I thought of that set of instructions.

        For an empty folder called "BuildApk" on desktop to be used for building: C:\Users\ME\Desktop\BuildApk
        and the project's directory on the path: D:\Projects\QML\QML_test_1\QML_test_1
        what expressions do I need to use to build the project QML_test_1 using Clang?

        jsulmJ 1 Reply Last reply
        0
        • tomyT tomy

          @jsulm

          I think I said that in our prior posts. I'm aiming at building projects using GCC and Clang compilers from command line instead of the hammer button on the IDE (ctrl+B). For the GCC compiler, we made it above and built the project.
          For Clang, you said it's similar. So I thought of that set of instructions.

          For an empty folder called "BuildApk" on desktop to be used for building: C:\Users\ME\Desktop\BuildApk
          and the project's directory on the path: D:\Projects\QML\QML_test_1\QML_test_1
          what expressions do I need to use to build the project QML_test_1 using Clang?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by jsulm
          #25

          @tomy If you want to build Qt apps with CLang you need Qt build with that compiler (and of cource CLang). Then you do it as usual: qmake, make.
          For Android this is already the case as Android NDK uses CLang and Qt for Android is built using CLang from Android NDK.
          For which other platform do you want to use CLang?

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

          tomyT 1 Reply Last reply
          0
          • jsulmJ jsulm

            @tomy If you want to build Qt apps with CLang you need Qt build with that compiler (and of cource CLang). Then you do it as usual: qmake, make.
            For Android this is already the case as Android NDK uses CLang and Qt for Android is built using CLang from Android NDK.
            For which other platform do you want to use CLang?

            tomyT Offline
            tomyT Offline
            tomy
            wrote on last edited by
            #26

            @jsulm

            I just want to build a project using Clang manually. And since the Android kit has that compiler on my Qt, so I chose a QML project.

            So I think I must go this way:

            • C:\Users\ME\Desktop\BuildApk>C:\Qt\5.14.0\android\bin\qmake.exe D:\Projects\QML\QML_test_1\QML_test_1

            *the make file but what is the name of that and on what address on Qt!?

            I guess I also need to setup the environment. But is the name of the file for Clang qtenv2.bat as well?

            jsulmJ 1 Reply Last reply
            0
            • tomyT tomy

              @jsulm

              I just want to build a project using Clang manually. And since the Android kit has that compiler on my Qt, so I chose a QML project.

              So I think I must go this way:

              • C:\Users\ME\Desktop\BuildApk>C:\Qt\5.14.0\android\bin\qmake.exe D:\Projects\QML\QML_test_1\QML_test_1

              *the make file but what is the name of that and on what address on Qt!?

              I guess I also need to setup the environment. But is the name of the file for Clang qtenv2.bat as well?

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #27

              @tomy said in Using compilers other than MinGW:

              the make file but what is the name of that and on what address on Qt!?

              I don't understand this. Do you mean the name and location of the make file?
              Makefile is created in the directory from which you call qmake and it is called Makefile.

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

              tomyT 1 Reply Last reply
              0
              • jsulmJ jsulm

                @tomy said in Using compilers other than MinGW:

                the make file but what is the name of that and on what address on Qt!?

                I don't understand this. Do you mean the name and location of the make file?
                Makefile is created in the directory from which you call qmake and it is called Makefile.

                tomyT Offline
                tomyT Offline
                tomy
                wrote on last edited by tomy
                #28

                @jsulm

                No I meant the make and qmake files.
                Please look at your previous set:

                • 1- Open CMD
                • 2- Create a build directory somewhere
                • 3- Change to that directory
                • 4- PATH_TO_MINGW_QT/qmake.exe PATH_TO_YOUR_PROJECT_DIRECTORY
                • 5- PATH_TO_QT_Tools/mingw730_64/bin/mingww32-make.exe

                I think number 4 should change to this:

                • 4- PATH_TO_ANDROID/qmake.exe PATH_TO_YOUR_PROJECT_DIRECTORY

                I found the qmake.exe file here: C:\Qt\5.14.0\android\bin\qmake.exe

                Agree up to here?
                If so, then we need to look up the make.exe file but this time not inside the mingw730_64 folder. Right?

                jsulmJ 1 Reply Last reply
                0
                • tomyT tomy

                  @jsulm

                  No I meant the make and qmake files.
                  Please look at your previous set:

                  • 1- Open CMD
                  • 2- Create a build directory somewhere
                  • 3- Change to that directory
                  • 4- PATH_TO_MINGW_QT/qmake.exe PATH_TO_YOUR_PROJECT_DIRECTORY
                  • 5- PATH_TO_QT_Tools/mingw730_64/bin/mingww32-make.exe

                  I think number 4 should change to this:

                  • 4- PATH_TO_ANDROID/qmake.exe PATH_TO_YOUR_PROJECT_DIRECTORY

                  I found the qmake.exe file here: C:\Qt\5.14.0\android\bin\qmake.exe

                  Agree up to here?
                  If so, then we need to look up the make.exe file but this time not inside the mingw730_64 folder. Right?

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #29

                  @tomy said in Using compilers other than MinGW:

                  If so, then we need to look up the make.exe file but this time not inside the mingw730_64 folder. Right?

                  It's right there in the build log you posted before:

                  20:08:05: Starting: "D:\Qt_Stuff\android-ndk-r21\prebuilt\windows-x86_64\bin\make.exe"
                  

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

                  tomyT 1 Reply Last reply
                  1
                  • jsulmJ jsulm

                    @tomy said in Using compilers other than MinGW:

                    If so, then we need to look up the make.exe file but this time not inside the mingw730_64 folder. Right?

                    It's right there in the build log you posted before:

                    20:08:05: Starting: "D:\Qt_Stuff\android-ndk-r21\prebuilt\windows-x86_64\bin\make.exe"
                    
                    tomyT Offline
                    tomyT Offline
                    tomy
                    wrote on last edited by tomy
                    #30

                    @jsulm

                    I ran the following and got the error for the environment. I'm sure the file for this is not that qtenv2.bat we used for GCC.

                    C:\Users\ME\Desktop\BuildApk>C:\Qt\5.14.0\android\bin\qmake.exe D:\Projects\QML\QML_test_1\QML_test_1
                    Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
                    Could not read qmake configuration file C:/Qt/5.14.0/android/mkspecs/android-clang/qmake.conf.
                    Error processing project file: D:\Projects\QML\QML_test_1\QML_test_1\QML_test_1.pro
                    

                    Should I firstly run this line on CMD?
                    C:\Qt\5.14.0\android\mkspecs\android-clang\qmake.conf

                    jsulmJ 1 Reply Last reply
                    0
                    • tomyT tomy

                      @jsulm

                      I ran the following and got the error for the environment. I'm sure the file for this is not that qtenv2.bat we used for GCC.

                      C:\Users\ME\Desktop\BuildApk>C:\Qt\5.14.0\android\bin\qmake.exe D:\Projects\QML\QML_test_1\QML_test_1
                      Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
                      Could not read qmake configuration file C:/Qt/5.14.0/android/mkspecs/android-clang/qmake.conf.
                      Error processing project file: D:\Projects\QML\QML_test_1\QML_test_1\QML_test_1.pro
                      

                      Should I firstly run this line on CMD?
                      C:\Qt\5.14.0\android\mkspecs\android-clang\qmake.conf

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #31

                      @tomy said in Using compilers other than MinGW:

                      C:\Qt\5.14.0\android\mkspecs\android-clang\qmake.conf

                      This is a config file, nothing you can run.
                      The error message tells you what is missing: "You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK".
                      Check the Build settings for that Kit in QtCreator (left side "Projects/Build/Build Environment") and look there for ANDROID_NDK_ROOT variable there. Then, before running qmake, set ANDROID_NDK_ROOT in the same way it is set in Build settings.

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

                      tomyT 1 Reply Last reply
                      1
                      • jsulmJ jsulm

                        @tomy said in Using compilers other than MinGW:

                        C:\Qt\5.14.0\android\mkspecs\android-clang\qmake.conf

                        This is a config file, nothing you can run.
                        The error message tells you what is missing: "You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK".
                        Check the Build settings for that Kit in QtCreator (left side "Projects/Build/Build Environment") and look there for ANDROID_NDK_ROOT variable there. Then, before running qmake, set ANDROID_NDK_ROOT in the same way it is set in Build settings.

                        tomyT Offline
                        tomyT Offline
                        tomy
                        wrote on last edited by tomy
                        #32

                        @jsulm

                        Check the Build settings for that Kit in QtCreator (left side "Projects/Build/Build Environment") and look there for ANDROID_NDK_ROOT variable there.

                        I found it and its root there is: D:\Qt_Stuff\android-ndk-r21

                        Then, before running qmake, set ANDROID_NDK_ROOT in the same way it is set in Build settings.

                        I sat that this way, on Windows Environment:

                        1.PNG

                        Then ran the CMD command:

                        C:\Users\ME\Desktop\BuildApk>C:\Qt\5.14.0\android\bin\qmake.exe D:\Projects\QML\QML_test_1\QML_test_1
                        Info: creating stash file C:\Users\ME\Desktop\BuildApk\.qmake.stash
                        
                        C:\Users\ME\Desktop\BuildApk>
                        

                        Then a number of files were created in the folder:

                        2.PNG

                        But still there isn't any .apk file there!

                        tomyT 1 Reply Last reply
                        0
                        • tomyT tomy

                          @jsulm

                          Check the Build settings for that Kit in QtCreator (left side "Projects/Build/Build Environment") and look there for ANDROID_NDK_ROOT variable there.

                          I found it and its root there is: D:\Qt_Stuff\android-ndk-r21

                          Then, before running qmake, set ANDROID_NDK_ROOT in the same way it is set in Build settings.

                          I sat that this way, on Windows Environment:

                          1.PNG

                          Then ran the CMD command:

                          C:\Users\ME\Desktop\BuildApk>C:\Qt\5.14.0\android\bin\qmake.exe D:\Projects\QML\QML_test_1\QML_test_1
                          Info: creating stash file C:\Users\ME\Desktop\BuildApk\.qmake.stash
                          
                          C:\Users\ME\Desktop\BuildApk>
                          

                          Then a number of files were created in the folder:

                          2.PNG

                          But still there isn't any .apk file there!

                          tomyT Offline
                          tomyT Offline
                          tomy
                          wrote on last edited by
                          #33

                          Sorry, I forgot to run the last command which is the path to make.exe:
                          D:\Qt_Stuff\android-ndk-r21\prebuilt\windows-x86_64\bin\make.exe

                          After this, a few more files, including .exe files, were added to the BuildApk folder (which is expected as we're on the windows-x86_64 path). But still no .apk file.

                          When we built the project using Gcc for Windows, we obtained the executable file. So we must obtain the .apk file for Android when we build the project using Clang for Android kit. Not right?

                          Where have I gone wrong and how to built the project completely so that we also have the apk file, please?

                          mrjjM 1 Reply Last reply
                          0
                          • tomyT tomy

                            Sorry, I forgot to run the last command which is the path to make.exe:
                            D:\Qt_Stuff\android-ndk-r21\prebuilt\windows-x86_64\bin\make.exe

                            After this, a few more files, including .exe files, were added to the BuildApk folder (which is expected as we're on the windows-x86_64 path). But still no .apk file.

                            When we built the project using Gcc for Windows, we obtained the executable file. So we must obtain the .apk file for Android when we build the project using Clang for Android kit. Not right?

                            Where have I gone wrong and how to built the project completely so that we also have the apk file, please?

                            mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on last edited by
                            #34

                            @tomy
                            Hi
                            Normally the APk is build by Creator. When you compile in the commandline, you have to do this step manually.
                            Details here.
                            https://doc.qt.io/qt-5/deployment-android.html

                            I think when running androiddeployqt its will make the APK file but i cant tell what parameters to use.

                            1 Reply Last reply
                            1

                            • Login

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