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.
parent 677caab2
......@@ -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 \
......
......@@ -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 \
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment