Android Project - Make.exe parallel jobs

  • Hello everybody!

    I'm currently working on a Qt project targeting Android and I noticed a really strange behavior: if I add a "-j" argument to the Make build step, the compilation (obviously) ends up requiring too much resources (in particular RAM) so I tried to change it to "-j4" or any "-jn" but it does not work, it spawns only a single process.

    I investigated a little bit and saw that someone complains about the MinGW version of Make provided by the Android NDK. To be sure I made a quick test creating a Makefile calling two children Makefiles underneath and launching it with the same Make version and it works perfectly.

    I suppose then that the issue is not related to Make.exe but probably something else; initially I thought to Qt Creator as the guilt but launching the build from command line reproduces the same issue.

    Could it be something related to QMake?

    My build command is

    qmake.exe "C:\Projects\MyProject\" -r -spec android-clang "QMAKE_PROJECT_DEPTH=0" "CONFIG+=debug" -after DEFINES+=BLM_APP_BUILD_VERSION=\\\\\\\"\"000\\\\\\\"\" && C:\Tools\android\android-ndk-r18b\prebuilt\windows-x86_64\bin\make.exe -j 100

    Details about the environment:

    • Project target: Android ARMv7
    • NDK: r18b
    • Qt version: 5.12.1
    • Qt Creator version: 4.9.2
    • Host operating system: Windows 10

    Any suggestion? I don't see why "-j" should work while "-jn" doesn't...

    Thanks a lot!

  • @paolot

    Hi and welcome to devnet forum

    Apparently you are starting qmake outside of Qt creator. How do you that?
    You should be able to check the actual make command being carried out. Alternatively, you can start the make in the command separately to ensure that qmake has no influence which I doubt anyway.

  • Hi, thanks for replying.

    Looking at the "Compile Output" tab I see the following when I start the build:

    13:08:39: Running steps for project stpalm...
    13:08:39: Configuration unchanged, skipping qmake step.
    13:08:39: Starting: "C:\Tools\android\android-ndk-r18b\prebuilt\windows-x86_64\bin\make.exe" -j12
    cd utility\ && ( if not exist Makefile C:\Qt\5.12.1\android_armv7\bin\qmake.exe -o Makefile C:\Projects\MyProject\utility\ -spec android-clang "CONFIG+=debug" "CONFIG+=qml_debug" ) && C:/Tools/android/android-ndk-r18b/prebuilt/windows-x86_64/bin/make -f Makefile 

    As you can see this is just the first step since my project consists of several subfolders (one of which is "utility"), so the make command is run once for each subfolder.

    The flag "-j12" is applied but does not work at all unfortunately.

  • @paolot

    Do you define a sequence of those subfolders?
    If yes, it will follow the order you are giving. E.g. if subfolder3 depends on subfolder2, subfolder 2 depends on subfolder 1 and subfolder1 depends on subfolder, you cannot expect those subfolders re compiled in parallel. I have a similar structure and the subfolders will be processed in sequence.

    Otherwise this is anyway something up to the make you are using. qmake is preparing only the different make files for processing by make.

  • I know that dependencies between projects have to be processed sequentially, in fact I'm talking about parallel build within the single project. It is working if I use just "-j" without specifying the number of jobs, so I would expect that it worked similarly even with "-j".

    I already reached the Android NDK forum and they think that the issue could be related to QMake (obviously), but the most reasonable argument right now is that, as you already said, QMake just prepares the Makefiles, any issue with the parallel building should be caused by Make itself.

    I'll try to find an example project to build on my machine in order to reproduce the issue, so that I can share with you and with the NDK developers.

    Thanks a lot for the moment!

  • @paolot

    How do you set in creator the flag?

    In creator on building settings page you can add -j12 or whatever you like that shall be used resp. in my creator 4.9.2 there is now the possibility to set the number of parallel jobs and it says 8. Never entered this number probably taken out of my environment.

    IIRC in the past I did not want to add the flag per project/application. Therefore I have added in my windows environment


    That may explain also why creator is recognizing the number of parallel jobs.

    As it looks in your last post make is not started with an additional command line argument for parallel jobs.


Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.