Paul Smith <p...@mad-scientist.net> added the comment:

I've tried on both MacOS 10.12 and 10.14.  I'm using GNU make 4.2.1 (built 
myself, not the one that comes with Xcode).

I have not tried Python3 builds.  I agree with you that -jN probably has little 
impact on the install step, but the build infrastructure I'm using simply 
provides it by default on both the build and install steps.

All my builds are completely from scratch and scripted; I start with a tarball, 
unpack it, then do an out-of-tree builds that run configure, then run "make" 
then "make install".

Note that these commands are _themselves_ invoked from a makefile the controls 
the build so they are recursive make invocations and the parent make was 
started with -j8 or so, causing the child makes to inherit that parallelism.

I doubt much of that is relevant though.  Here's the issue:

  install: commoninstall ...

  commoninstall: ... altbininstall ... libainstall ...

  altbininstall: $(BUILDPYTHON)

  libainstall: all python-config

So, these two targets altbininstall and libainstall are both prerequisites of 
commoninstall, which is a prerequisite of install.

Since there's no dependency relationship between altbininstall and libainstall, 
make is free to run them both at the same time if you invoke it with 
parallelism enabled.

Both of these targets try to create directories; altbininstall uses:

        @for i in $(BINDIR) $(LIBDIR); \
        do \
                if test ! -d $(DESTDIR)$$i; then \
                        echo "Creating directory $$i"; \
                        $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
                else    true; \
                fi; \
        done

and libainstall uses:

        @for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
        do \
                if test ! -d $(DESTDIR)$$i; then \
                        echo "Creating directory $$i"; \
                        $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
                else    true; \
                fi; \
        done

You can see that both try to create the directory $(LIBDIR).  They do test for 
directory existence first but that's not sufficient when running in parallel: 
if they are running at the same time they might both test at the same time and 
succeed, then one will create the directory first.

Because the rule uses install -d, which (unlike mkdir -p for example) will fail 
if the directory already exists, you have a potential problem here.

If the Python 3 makefile has similar target constructs it will have the same 
issue.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36464>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to