Boost logo

Boost-Build :

Subject: Re: [Boost-build] Issue running bjam with multiple jobs and custom code generator
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2016-11-04 18:50:46


AMDG

On 11/04/2016 10:27 AM, Christophe B. wrote:
>
> I developed a protoc.jam (see attachment) allowing to invoke an external
> code generator tool (protoc from protobuf library). The tool generates
> c++ unit files X.pb.h X.pb.cc from a source X.proto.
>
> When I run bjam -j1 from scratch everything works like a charm.
>
> When I run bjam -j6 from scratch, I get compilation issues complaining
> that the generated X.pb.h file is missing, because the compiler compiles
> other cpp units in parallel before protoc has fully finished.
>
> Why it does work correctly with one job and not with multiple jobs
> remains a mystery to me.

It only works with one job by accident.

> I would expect that bjam detects the
> dependencies of cpp units with the generated X.pb.h file and waits for
> its generation before starting compilation of depending cpp units.
>

The dependency is being missed for some reason.

> I also attached the Jamfile of my project.
>

I'm not sure exactly where the problem is, but there
are a couple of issues I can see with protoc.jam:
- The generator should list both H and CPP as its outputs.
- override generated-targets instead of run and
  don't bother checking the source type.

Minor extra note:
- actions can access any module scope variables,
  so there's no need to create an on TARGET variable
  for .prefix.

In Christ,
Steven Watanabe


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk