siegelaaron94 / atom-build-cmake

Generate and build cmake projects from within Atom.
MIT License
6 stars 12 forks source link

On Ninja, `clean` target fails due to `-j4` #16

Closed neumannrf closed 7 years ago

neumannrf commented 7 years ago

I am getting this error message

usage: ninja -t clean [options] [targets]

options:
  -g     also clean files marked as ninja generator output
clean: invalid option -- 'j'
  -r     interpret targets as a list of rules to clean instead

every time I try to run clean from the ctrl+alt+t menu inside Atom.

Doing so currently invokes

cmake --build ${PROJECT}/build --target clean -- -j4

Maybe, besides removing the parallelism option -j4 from the clean target directive, there is also a way to add a clean-cmake target by exploring the -g option shown above.

siegelaaron94 commented 7 years ago

I can not seem to reproduce this bug what OS and compiler are you using?

neumannrf commented 7 years ago

I am using GCC 5.3 on Ubuntu 14.04 with -GNinja as generator. If it does not suffice, I can try to provide a minimal example.

siegelaaron94 commented 7 years ago

Weird I am on GCC 5.4.0 and Ubuntu 16.04 it works for me. The ninja-build package on 14.04 is an old version that must have had a bug in it. Did you check that removing the '-j4' argument fixed the problem? I can't just eliminate the flag without removing it for all targets; there is nothing special about the clean target it is just like all of the rest.

neumannrf commented 7 years ago

Yes, if I go to the terminal and issue

$> cmake --build build/ --target clean
Cleaning... 23 files.

it works well, as opposed to

$> cmake --build build/ --target clean -- -j4
usage: ninja -t clean [options] [targets]

options:
  -g     also clean files marked as ninja generator output
  -r     interpret targets as a list of rules to clean instead
clean: invalid option -- 'j'

To which version of Ninja do you suggest I upgrade?

neumannrf commented 7 years ago

@siegelaaron94, I have upgraded to v0.6.2 but the -j4 remains. I am on Ninja v1.3.4.

siegelaaron94 commented 7 years ago

Opps, missed a hunk.

neumannrf commented 7 years ago

The latest version (0.6.3) even improved Atom's ability to catch compilation warnings. Thank you!

neumannrf commented 7 years ago

Since last update Atom freezes every time I need to recompile 3+ files. It even pops out a window asking me if I want to force close or keep editing. The exact same build in VS Code takes as much time as it would in the terminal.

My project has 13 .cpp files and as many .hpp, so not too large I would say. Did anyone observe a similar behaviour too?

siegelaaron94 commented 7 years ago

I think that you are one of the very few that uses Ninja build, so I do not have a lot of people testing. On my machine, I do not notice any freezing with 48 .hpp 42 .cpp and like 30 boost headers. It is nice to see that people are adding support for native to VSCode though.

neumannrf commented 7 years ago

Well, as it turns out, I get the exact same freezing behaviour when I use GNU Make instead of Ninja as generator. It takes ~2 minutes to build via Atom a project that builds in 30/17 seconds in the terminal (or in VS Code for that matter) using GNU Make/Ninja. I have been using Atom + build-cmake as my default tool for months, even before finding and adopting Ninja, and this freeze was unknown to me until I updated to v0.6.3.

Since it is not Ninja-related, would it make more sense to split it into another issue? Is there a log-file I could post here or is it more of a profiling issue?