Hello,
There seems to be a race condition in Makefile.libs that occurs
sporadically when doing parallel builds (make -j). I believe the culprit
part is this:
$(NAME): $(LIB_RUNTIME_NAME) $(LIB_LINK_NAME) $(LIBINAME_F)
$(LIB_RUNTIME_NAME):
-@ln -s $(LIB_NAME) $(LIB_RUNTIME_NAME)
$(LIB_LINK_NAME):
ifeq ($(OS), freebsd)
-@ln -s $(LIB_RUNTIME_NAME) $(LIB_LINK_NAME)
else
-@ln -s $(LIB_NAME) $(LIB_LINK_NAME)
endif
The problem is that dependencies (the ln -s commands) get built first,
and the actual target ($(NAME)) last. The result is that for a while,
the symlinks already exist while the lib itself is not fully built yet.
In the meantime, other make children build something else that depends
on the lib, see that the symlink already exists and hence think the
target has already been built, which then results in various funny
errors when the linker tries to read a non-existent or half-finished .so
file. At least I think that's what happens.
Unfortunately I have no idea how to fix this within the current makefile
framework. I tried reordering the dependencies (making the symlink
targets depend on the lib instead of the other way around) but those all
resulted in build failures.
cheers