Bug 404487

Summary: When building Qt 5, global make options are ignored
Product: [Developer tools] kdesrc-build Reporter: jm.ouwerkerk
Component: generalAssignee: Michael Pyne <mpyne>
Status: RESOLVED FIXED    
Severity: normal CC: ashark, butirsky
Priority: NOR    
Version First Reported In: Git   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description jm.ouwerkerk 2019-02-17 17:05:21 UTC
SUMMARY
When building Qt 5 with kdesrc-build, the global make options appear to be ignored. This manifests itself in noticeably less fan noise than expected when you configured a global `-j12` but effectively get `-j1`. It also takes a lot longer.

STEPS TO REPRODUCE
1. On fresh system without Qt set up kdesrc-build
2. Make sure to include kf5-qt5-build-include and qt5-build-include
3. Run kdesrc-build qt5

OBSERVED RESULT
On an 8-core CPU, the load as reported by ksysguard stays effectively pegged at ~ 12% (i.e. ~ 1 core)

EXPECTED RESULT
I expect the CPU to be given a bit more of a workout with a load of roughly ~100%.

ADDITIONAL INFORMATION
This issue can be worked around by manually configuring kdesrc-build.rc with:

```
options qt5-set
    make-options -j12
end options
```
Comment 1 jm.ouwerkerk 2019-02-17 17:08:12 UTC
The relevant bit of my global configuration in kdesrc-build.rc is:

```
global
    make-options -j12
end global
```
Comment 2 Michael Pyne 2019-02-20 03:35:18 UTC
Interesting. I suspect this might be because of a feature I'd added a couple of years back to filter out global build flags for build systems that weren't using the CMake ("KDE4") build system, since that was also sometimes causing problems for people trying to add global make options that worked under CMake's Makefiles but not in autotools or qmake-descended makefiles.
Comment 3 jm.ouwerkerk 2019-02-20 06:31:55 UTC
May also be related to https://phabricator.kde.org/T9727 ?
Comment 4 Nate Graham 2020-07-13 14:26:46 UTC
*** Bug 424158 has been marked as a duplicate of this bug. ***
Comment 5 Andrey 2020-07-13 19:29:27 UTC
(In reply to Michael Pyne from comment #2)
> Interesting. I suspect this might be because of a feature I'd added a couple
> of years back

Any solution for now?
Comment 6 jm.ouwerkerk 2020-07-15 11:32:32 UTC
(In reply to Andrey from comment #5)
> 
> Any solution for now?

You can manually add `make-options -j12` or `set-env MAKEFLAGS=-j12` or similar to the module set or module options. Additionally a MR is being worked on that tackles parallel builds more comprehensively: https://invent.kde.org/sdk/kdesrc-build/-/merge_requests/54
Comment 7 Andrew Shark 2024-04-20 15:53:06 UTC
The qt5-set module-set is handled very differently, it creates a Qt5 supermodule, which then handle building of its submodules itself.

The mentioned mr was merged. The module definitions now contain:
```
module-set qt5-set
    set-env MAKEFLAGS -j${num-cores}
end module-set

options qtwebengine
    set-env NINJAFLAGS -j${num-cores-low-mem}
end options
```

So the several cores building is no longer a problem.