[build2] Rerunning build2 and getting different results (errors)
Wilhelm Meier
wilhelm.meier at hs-kl.de
Tue May 16 06:25:59 UTC 2023
On 14.05.23 18:35, Wilhelm Meier via users wrote:
> On 14.05.23 16:26, Boris Kolpackov wrote:
>> Wilhelm Meier via users <users at build2.org> writes:
>>
>>> If this is incorrect: why does it work (sometimes), but sometimes it
>>> does
>>> not, without changing anything?
>>
>> Because build2 is a multi-threaded build system that does things in
>> parallel. And your incorrect setup is racy.
>
> Ok, that was my assumption too. If there is no synchronization, how can
> I achiebe that? I did not find anything in the manual.
>
Sorry for my dumb questions! But I can't get it working.
In
https://github.com/wimalopaan/build2_test
you find a complete minimum example, that shows my problem. In this
example I want to build the executable test from test.cc and two
internal libs A and B. The internal libs must be built before building
the executable, especially the object-file test.o because test.cc should
use modules and therefore needs the bmi-files of the two libraries.
In this run of "b clean update"
rm src/test/exe{test}
rm src/test/obje{test}
rm src/libs/B/bmis{b}
rm src/libs/A/bmis{a}
c++ src/test/cxx{test} -> src/test/obje{test}
c++ src/libs/B/mxx{b} -> src/libs/B/bmis{b}
c++ src/libs/A/mxx{a} -> src/libs/A/bmis{a}
ld src/test/exe{test}
the object-file test is built before the two libs A and B. This does not
work for sources that contain c++ modules of lib A or B, because
compiling test.cc would give errors due to missing bmi-files. There
might be other build sequences like
rm src/test/exe{test}
rm src/test/obje{test}
rm src/libs/A/bmis{a}
rm src/libs/B/bmis{b}
c++ src/libs/B/mxx{b} -> src/libs/B/bmis{b}
c++ src/test/cxx{test} -> src/test/obje{test}
c++ src/libs/A/mxx{a} -> src/libs/A/bmis{a}
ld src/test/exe{test}
or
rm src/test/exe{test}
rm src/test/obje{test}
rm src/libs/A/bmis{a}
rm src/libs/B/bmis{b}
c++ src/libs/B/mxx{b} -> src/libs/B/bmis{b}
c++ src/libs/A/mxx{a} -> src/libs/A/bmis{a}
c++ src/test/cxx{test} -> src/test/obje{test}
ld src/test/exe{test}
because the order of execution not fixed.
Please give me some hints.
Thank you,
Wilhelm
More information about the users
mailing list