Windows package: fix random build failure due to race condition

The MEX files are built out-of-tree (because we want to do them in parallel).
This would create a potential race condition if several builds want to create
the symlinks under mex/matlab/ or mex/octave/.

The solution is to disable those symlinks for out-of-tree builds.
time-shift
Sébastien Villemot 2019-09-04 11:38:44 +02:00
parent 677caab21e
commit 35acc111ff
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
3 changed files with 19 additions and 12 deletions

View File

@ -13,11 +13,15 @@ LIBS += $(MATLAB_LIBS)
mexdir = $(libdir)/dynare/mex/matlab
all-local: $(PROGRAMS)
$(MKDIR_P) $(top_srcdir)/../../matlab
cd $(top_srcdir)/../../matlab && \
for p in $(PROGRAMS); do \
$(LN_S) -f $(abs_builddir)/$$p $$p; \
done
## Create symlinks in mex/matlab/, but only if the build is not
## out-of-tree (because of the Windows installer)
if [ "$(abs_srcdir)" = "$(abs_builddir)" ]; then \
$(MKDIR_P) $(top_srcdir)/../../matlab && \
cd $(top_srcdir)/../../matlab && \
for p in $(PROGRAMS); do \
$(LN_S) -f $(abs_builddir)/$$p $$p; \
done; \
fi
clean-local:
if test -d $(top_srcdir)/../../matlab; then \

View File

@ -20,11 +20,15 @@ LIBS += $(shell $(MKOCTFILE) -p FLIBS)
mexdir = $(libdir)/dynare/mex/octave
all-local: $(PROGRAMS)
$(MKDIR_P) $(top_srcdir)/../../octave
cd $(top_srcdir)/../../octave && \
for p in $(PROGRAMS); do \
$(LN_S) -f $(abs_builddir)/$$p $$p; \
done
## Create symlinks in mex/octave/, but only if the build is not
## out-of-tree (because of the Windows installer)
if [ "$(abs_srcdir)" = "$(abs_builddir)" ]; then \
$(MKDIR_P) $(top_srcdir)/../../octave && \
cd $(top_srcdir)/../../octave && \
for p in $(PROGRAMS); do \
$(LN_S) -f $(abs_builddir)/$$p $$p; \
done; \
fi
clean-local:
if test -d $(top_srcdir)/../../octave; then \

View File

@ -220,8 +220,7 @@ cd "$ROOT_DIRECTORY"
export TMP_DIRECTORY ROOT_DIRECTORY LIB32 LIB64 VERSION NTHREADS
export -f "${TASKS[@]}"
parallel "set -ex;shopt -s globstar;" ::: "${TASKS[@]}"
# Clean up bogus symlinks left by parallel builds of MEX
rm -f ../mex/matlab/*.mexw32 ../mex/matlab/*.mexw64 ../mex/octave/*.mex
# Add supported_octave_version.m (see matlab/dynare.m)
while read -r line
do