Skip to content
Snippets Groups Projects
Verified Commit 35acc111 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

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
No related branches found
No related tags found
No related merge requests found
...@@ -13,11 +13,15 @@ LIBS += $(MATLAB_LIBS) ...@@ -13,11 +13,15 @@ LIBS += $(MATLAB_LIBS)
mexdir = $(libdir)/dynare/mex/matlab mexdir = $(libdir)/dynare/mex/matlab
all-local: $(PROGRAMS) all-local: $(PROGRAMS)
$(MKDIR_P) $(top_srcdir)/../../matlab ## 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 && \ cd $(top_srcdir)/../../matlab && \
for p in $(PROGRAMS); do \ for p in $(PROGRAMS); do \
$(LN_S) -f $(abs_builddir)/$$p $$p; \ $(LN_S) -f $(abs_builddir)/$$p $$p; \
done done; \
fi
clean-local: clean-local:
if test -d $(top_srcdir)/../../matlab; then \ if test -d $(top_srcdir)/../../matlab; then \
......
...@@ -20,11 +20,15 @@ LIBS += $(shell $(MKOCTFILE) -p FLIBS) ...@@ -20,11 +20,15 @@ LIBS += $(shell $(MKOCTFILE) -p FLIBS)
mexdir = $(libdir)/dynare/mex/octave mexdir = $(libdir)/dynare/mex/octave
all-local: $(PROGRAMS) all-local: $(PROGRAMS)
$(MKDIR_P) $(top_srcdir)/../../octave ## 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 && \ cd $(top_srcdir)/../../octave && \
for p in $(PROGRAMS); do \ for p in $(PROGRAMS); do \
$(LN_S) -f $(abs_builddir)/$$p $$p; \ $(LN_S) -f $(abs_builddir)/$$p $$p; \
done done; \
fi
clean-local: clean-local:
if test -d $(top_srcdir)/../../octave; then \ if test -d $(top_srcdir)/../../octave; then \
......
...@@ -220,8 +220,7 @@ cd "$ROOT_DIRECTORY" ...@@ -220,8 +220,7 @@ cd "$ROOT_DIRECTORY"
export TMP_DIRECTORY ROOT_DIRECTORY LIB32 LIB64 VERSION NTHREADS export TMP_DIRECTORY ROOT_DIRECTORY LIB32 LIB64 VERSION NTHREADS
export -f "${TASKS[@]}" export -f "${TASKS[@]}"
parallel "set -ex;shopt -s globstar;" ::: "${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) # Add supported_octave_version.m (see matlab/dynare.m)
while read -r line while read -r line
do do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment