|
|
Andy <oneklema@xxxxxxxxx> writes:
> My issue with parallel compiles is obviously an issue with make, not
> gcc (my bad!).
Actually, it's likely not even an issue with "make", but rather an
incorrect Makefile.
> But, can anyone help as to why I would have such
> linking problems when make operates in parallel?
What likely happens is that two separate 'ar' commands execute
in parallel:
ar ru libfoo.a foo1.o
ar ru libfoo.a foo2.o
Each creates a separate temporary copy of libfoo.a, and adds
foo{1,2}.o respectively. Each of the 'ar' commands then performs an
"atomic" rename from the temporary file to libfoo.a.
Whichever 'ar' does it last "wins", and completely wipes out the
effect of the other one.
The end result is that "make" thinks it has completely rebuilt
libfoo.a, but in fact libfoo.a is incomplete, and does not contain
many of the object files that it should have had, eventually causing
link errors.
If you repeat make several times, eventually you'll end up with a
complete libfoo.a, and the link errors will disappear.
Correct solution is to keep all object files, and archive them all
in a single command.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
|
|