[build2] Error message for output dir missing

Moldmann Max (DC-MH/ENG52-NA) Max.Moldmann at boschrexroth-us.com
Tue Nov 21 17:28:09 UTC 2017

Perfect thanks!


-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Tuesday, November 21, 2017 4:52 AM
To: Moldmann Max (DC-MH/ENG52-NA) <Max.Moldmann at boschrexroth-us.com>
Cc: users at build2.org
Subject: Re: [build2] Error message for output dir missing

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.


More information about the users mailing list