Open helmesjo opened 1 year ago
The trigger is the custom ad hoc recipe to install exe{hello}
:
exe{hello}:
% install
{{
...
}}
The cxx
module which provides the rule to build exe{hello}
actually supplied two rules, to update
and to install
, which perform a pretty tricky dance in order to be able to link things differently when building for install, etc. So what happens here is that you kept the update
rule provided by cxx
but replaced install
with your own ad hoc recipe which commits all kinds of faux pas during that dance. In this particular case, the update
rule from cxx
picked one of the lib{}
group members (libs{}
in this case) when linking the executable. The install
rule from cxx
also knows to do the same but not your ad hoc recipe, which tries to install both members of lib{}
while only libs{}
was updated.
I think at this stage you have only two options: either use both rules from cxx
or neither because it's not going to be easy to support that dance in an ad hoc recipe written in Buildscript (your could probably pull it off in C++ but I wouldn't recommend it). If you need to "hook" some post-install steps to an executable or library built by cxx
, I suggest that you use an alias, for example:
./: alias{hello}: exe{hello}: ...
alias{hello}:
% install
{{
...
}}
We will also try to fix this assert and issue proper diagnostics at some point but it's not a high priority right now.
Okay, thanks. I gave the example with
Edit.
Never mind, I accidentally added it as a prerequisite to the dir target with alias{}
a try but still got the built for install
error though../: alias{}
instead of just alias{}
.
bdep init -C @clang cc config.cxx=clang++
b install: hello/ !config.install.root=./out !config.install.scope=project
Reproduced on MacOS, haven't tested Linux or Windows.