Bug 568397 - External builder command '-j' option is jeopardized if mix of parallel build enabled and end user settings
Summary: External builder command '-j' option is jeopardized if mix of parallel build ...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build-managed (show other bugs)
Version: 10.0.1   Edit
Hardware: PC All
: P3 minor (vote)
Target Milestone: 10.3.0   Edit
Assignee: Jonah Graham CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-30 09:56 EDT by cartu38 opendev CLA
Modified: 2022-01-12 15:38 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cartu38 opendev CLA 2020-10-30 09:56:47 EDT
How to reproduce:
1) Create a managed C/C++ project
2) Move to project Properties > C/C++ Build
3) If Behavior tab enable parallel build. Let's say defined job count is 2. 
4) If Builder Settings tab disable "Use default build command" and see promoted command. Should be 'make -j2'
5) If Builder Settings tab let's update by hand build command to 'make -j3'
6) Move to Behavior tab then  Builder Settings tab back.
7) See build command is now 'make -j3 -j2'
Comment 1 Eclipse Genie CLA 2020-11-04 05:00:02 EST
New Gerrit change created: https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/171735
Comment 2 Eclipse Genie CLA 2020-11-08 12:55:45 EST
New Gerrit change created: https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/171951
Comment 4 Jonah Graham CLA 2020-11-09 19:34:01 EST
Needs a N&N entry due to change in behaviour - see Marc-Andre's comment in the gerrit:

I'm not 100% sure about this change. I've used this build command field in the case to replace 'make' with a drop-in replacement, like 'gmake'. Perhaps one could also use field to specify an absolute path to 'make'. Then in those case you'd want to preserve the other flags as configured in the UI. As it is, this change would likely break existing configs and probably warrants an entry in N&N as projects would need to be updated to account for this.
Comment 5 Jonah Graham CLA 2020-11-09 19:35:51 EST
> I'm not 100% sure about this change. I've used this build command field in
> the case to replace 'make' with a drop-in replacement, like 'gmake'. Perhaps
> one could also use field to specify an absolute path to 'make'. Then in
> those case you'd want to preserve the other flags as configured in the UI.

It may be better to have multiple text fields to match the contents of .cproject where the command and flags are separate. That would mean that where the command was non-default (e.g. gmake) but the args were default (e.g. null) you would get it still.
Comment 6 Torbjörn Svensson CLA 2020-11-17 15:25:45 EST
(In reply to Jonah Graham from comment #5)
> It may be better to have multiple text fields to match the contents of
> .cproject where the command and flags are separate. That would mean that
> where the command was non-default (e.g. gmake) but the args were default
> (e.g. null) you would get it still.

Is this the way we want to go?
Comment 7 jan baeyens CLA 2020-12-01 09:28:26 EST
I personally don't think this is a bug/issue.
First of all running "make -j2 -j3" works fine (I assume that -in compliance with gcc habits- the latest option will be used but I didn't check)
So the only possible impact is that you may use a different number of threads than expected. I would assume someone smart enough to uncheck "use default build command" and modify the build command; would be smart enough to see that look at the console and see the "make -j2 -j3" line and figure things out.

My conclusion "After uncheking the option and modifying the build command as suggested; everything works fine, possible side effect: different number of build threads than expected are being used" So not an issue.

Now look at the option "generate makefiles automatically"
If you uncheck this option many of the changes done in the settings will not be taken into account. New files added to the project will not be taken into account.
Deleting the configuration output folder (like Release) will make building the project impossible.

My conclusion "After uncheking the option; secondary steps will lead to a blocking situation requiring to turn the option back on.

My proposal: leave as is.
Comment 8 jan baeyens CLA 2020-12-01 10:20:35 EST
Reading up more on this issue I see that the proposed solution is <disable the settings when one disables "use default build command">

I don't think this is a good solution.
My main comment is that there are very valid reasons to change the default make command without wanting to disable setting the options.
A) Stuff like using a FQN for make because... there are many makes in the world and having a sh in the make folder changes some makes to behave differently.
B)you may not want make in the path and there fore you can not use the ""default make command" as default cdt default build command is make without FQN.
C) make may come with a desired option without a GUI. (very unlikely but this is why you have this kind of stuff)
D) All kind of creative solutions. Like I remember replacing the default build command by a script that would launch make and dump the actual commands I got.

Secondly only "disabling the GUI" is not going to cut it.
Assume I set parallelbuild to on with 2 threads and then opt not to use the default build command and set it to make -j3
You will still get "make -j3 -j2" as build command.
But now you can no longer undo the -j2 without turning "default build command" on
To get "make -j3" as build command you must modify the code that generates the command.
But doing so makes it impossible to quickly set the path (keeping the same settings)

My conclusion: The current solution is not perfect but I can't think of something that is really better. Only turning of the GUI may look better to you but it looks worse to me.
Comment 9 Eclipse Genie CLA 2020-12-01 12:03:32 EST
New Gerrit change created: https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/173118
Comment 10 Eclipse Genie CLA 2020-12-01 12:06:44 EST
New Gerrit change created: https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/173126
Comment 11 Eclipse Genie CLA 2020-12-01 12:08:58 EST
New Gerrit change created: https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/173119
Comment 12 Jonah Graham CLA 2020-12-01 12:13:38 EST
I would like to revert this change for 10.1.0 and then restore it with the follow up in 10.2.0 M1.

Please let me know if there is any objection to reverting this for 10.1.
Comment 13 Jonah Graham CLA 2020-12-01 13:21:54 EST
Change reverted for 10.1 to be revisited in 10.2
Comment 16 Jonah Graham CLA 2021-05-18 16:31:52 EDT
All done now - N&N updated https://wiki.eclipse.org/CDT/User/NewIn103#Build