[build2] Error message for output dir missing

Boris Kolpackov boris at codesynthesis.com
Tue Nov 21 09:52:11 UTC 2017


Hi Max,

Sorry for the delay in getting back to you on this.


Moldmann Max (DC-MH/ENG52-NA) <Max.Moldmann at boschrexroth-us.com> writes:

> $out_base/_bin/exe{myproject.elf}: {c}{**}
> 
> I am always getting this error when I delete the "_bin" folder before
> executing build2 [...]

Ok, now I can see what's going on. If you want to stash a target in an
otherwise non-existent subdirectory, then you have to add an explicit
fsdir{} prerequisite which will be responsible for its creation/cleanup:

_bin/exe{myproject.elf}: fsdir{_bin/} {c}{**}

I've also improved the diagnostics in this area. Now you will get
something along these lines:

error: unable to create bin/hello.d
  info: did you forget to add fsdir{} prerequisite for output directory?
  info: while updating bin/exe{hello}

Also, as a sidenote, stashing things into "output directories" like this
is not a "build2 way". The recommended way is to place the result in the
same directory as the source and to use out of tree builds if you don't
like mixing source with output. This way everything works auto-magically
without any explicit fsdir{}'s.

Boris



More information about the users mailing list