[sr-dev] Race condition in Makefile.libs

Daniel-Constantin Mierla miconda at gmail.com
Wed Jan 30 13:15:53 CET 2013


Hello,

haven't looked at it yet, just wondering if the symlink cannot be 
created as extra command in the make target building the object.

Cheers,
Daniel

On 1/26/13 12:30 AM, Richard Fuchs wrote:
> 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):
>          - at ln -s $(LIB_NAME) $(LIB_RUNTIME_NAME)
>
> $(LIB_LINK_NAME):
> ifeq ($(OS), freebsd)
>          - at ln -s $(LIB_RUNTIME_NAME) $(LIB_LINK_NAME)
> else
>          - at 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
>
>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, April 16-17, 2013, Berlin
  - http://conference.kamailio.com -

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20130130/f3b13d2f/attachment.htm>


More information about the sr-dev mailing list