GCC parallel builds may be unstable

69 views
Skip to first unread message

Liviu Ionescu

unread,
Jul 6, 2017, 11:57:46 AM7/6/17
to RISC-V SW Dev
while doing **lots** of lengthy GCC builds recently, I noticed a very annoying behaviour: when started with -j8, the builds occasionally fail, claiming missing files or folders, that, after inspection, were there. restarting the builds solved the problem.

I cannot tell for sure, but my feeling is that the problem is caused by missing or not enforced dependencies; for example if a program has to build two libraries, but the second one depends on the first, without explicit dependencies, a parallel build will start the builds for the two libraries in parallel, leading to a race. probably a regular build will serialise the two builds and simply listing them in the proper order is enough.

although the impact on the build time is major, for reliability reasons I had to disable parallel builds in my scripts :-(


regards,

Liviu




Tommy Murphy

unread,
Jul 6, 2017, 12:01:06 PM7/6/17
to RISC-V SW Dev
I wonder if adding -O aka --output-sync to synchronize output of multiple parallel jobs might make any difference?
I would not expect it to change the build behaviour as opposed to make the output easier to read but you never know...

Bruce Hoult

unread,
Jul 6, 2017, 12:06:44 PM7/6/17
to Liviu Ionescu, RISC-V SW Dev
Almost certainly it's missing dependencies. That's very dangerous.

If you can tell us exactly *which* things it complains are missing, and when building what, then that gives a chance for someone to check the declared and actual dependencies.





--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+unsubscribe@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/7B0625E8-8150-4123-B617-74D65E9728B9%40livius.net.

Liviu Ionescu

unread,
Jul 6, 2017, 12:44:26 PM7/6/17
to Bruce Hoult, RISC-V SW Dev

> On 6 Jul 2017, at 19:06, Bruce Hoult <br...@hoult.org> wrote:
>
> Almost certainly it's missing dependencies. That's very dangerous.

indeed. that's why I decided to no longer use it for my release builds.

> If you can tell us exactly *which* things it complains are missing, and when building what, then that gives a chance for someone to check the declared and actual dependencies.

yeah, unfortunately I did not keep track of all those problems, not to mention the surprise to see builds that passed before fail mysteriously.

but the first to check would be the recursive makes, usually libraries, inside the main project folders (binutils, gcc, newlib). if some of them have inter-dependencies not explicitly marked in the main file, that's a clear cause of troubles.

for regular builds I think using parallel build is still acceptable, if something breaks a rerun is usually ok.

however for release builds (like GNU MCU Eclipse RISC-V Embedded GCC), I installed a separate macMini, which might not be the fastest machine in town, but does nothing else then run the build scripts. with so many multilibs, plus the newlib-nano that practically builds everything twice, a build for a platform takes many, many hours. and there are 5 platforms... but as long as it runs unattended, for all 5 platforms in sequence, it's not that bad...


regards,

Liviu

Reply all
Reply to author
Forward
0 new messages