Closed ia closed 1 year ago
Linking Hexfile/Pinecilv2_multi_compressed_European.elf
lto1: fatal error: bytecode stream in file 'Objects/Pinecilv2/./Core/BSP/Pinecilv2/bl_mcu_sdk/common/partition/partition.o' generated with GCC compiler older than 10.0
compilation terminated.
lto-wrapper: fatal error: riscv-none-elf-g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/riscv-none-elf/11.2.0/../../../../riscv-none-elf/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:846: Hexfile/Pinecilv2_multi_compressed_European.elf] Error 1
make[1]: Leaving directory '/build/ironos/source'
make: *** [Makefile:162: firmware-multi_compressed_European] Error 2
make -jX target1 target2 ... targetY
and you use only one Makefile
then make
tool using X for parallel build speculatively will try to run needed internal dependencies/internal targets in parallel but every external target from input will be executed one-by-one in order, not in parallel;make -jX target1 target2 ... targetY
but inside main Makefile
you pass through input targets to be executed through another one call make
of another one Makefile
, then external targets will be run in parallel as well, i.e. make
will just call in parallel make target1
, make target2
up until make targetX
(as much as X
s for -j
).I looked through logs before/after changes in push.yml
very carefully and noticed that by the way how the logs report building, it seems that in the scenario with cd source && make -j2 multi_...
OR in the scenario with make -C source/
(tested locally) option for parallel build -jN
if not ignored but applied inside of making every input target in sequential order (one output of Building for Pine64 Pinecilv2
line because make
process is the only one).
While after the changes in push.yml
targets themselves are run in parallel (two outputs of Building for Pine64 Pinecilv2
line in parallel because make
process forked into nproc
processes of itself and they started to compile target firmware-multi_compressed_European
& target firmware-multi_compressed_Bulgarian+Russian+Serbian+Ukrainian
in parallel, hence conflict of binary data in files generated/overwritten leading to compilation error).
I just added -C source/
to test.sh
from the original report and after that I got more than a dozen successful cycles of building. PR is ready here. I had zero idea about such nuances of behavior of make
BTW.
Neither did I so I never caught it 😓 Thanks for getting a fix figured out before I woke up; very nice to wake up to a fixed issue 😁
Thanks for getting a fix figured out before I woke up; very nice to wake up to a fixed issue
Sure, no problem! Sorry to bring this bug in the first place to the repo. :|
And I could be wrong in the terminology in root cause part but the bottom line is - as far as I could understand:
sub-targets
for main target
which is being called by one make
external call using one Makefile
is good & ok;targets
which is being called by one make
but splitting into more than one make
calls (one for each independent target) using the same Makefile
may lead to nondeterministic behavior (as they say).Something like that as far as I did manage to figure out this in a brief only to fix the issue in the most fast & suitable way.
This does make sense, but also makes it hairy to debug 😓
Describe the bug Multi-lang builds for
Pinecilv2
fail withld
/lto1
errors.To Reproduce
Expected behavior Successful multi-lang builds for
PinecilV2
.Details of your device: Build problem, not a device one.
Additional context
I create this issue to:
If you work on your branch in forked repo and see similar problem, please, add comment providing:
Here are the examples of this issue:
lto1 error / upstream:
lto1 error / branch:
ld error / branch:
lto1 error / branch:
At first, I couldn't reproduce it locally, not without
-j$(nproc)
at all nor with-j4
(since it's the value ofnproc
on my system). But when I did put-j2
which seems the case with github CI, I got interesting result almost right away:Binary files mentioned in the log above can be found here.
My further plan is to:
-j
, with-j2
, and with-j4
to see the behavior;make
:make -C source multi_...
vsmake multi_...
vscd source && make multi_...
(I doubt that this could be the reason but just to exclude the probability that it somehow related to changing build job command for respective build on github CI).My current suspicious that it probably may be somehow related to parallel building creating race condition-like situation (i.e. some binary file is not fully generated yet when some related dependency in a target inside
Makefile
"thinks" that it's ready.Less (but not impossible BTW) it could be a bug in the toolchain.