From 3244340e7a20f45cc0a67d25ceb84f88f5c2ec85 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 3 Jan 2023 13:04:18 +0100
Subject: [PATCH] Windows package: bump dependencies

In particular, add -fstack-protector to CXXFLAGS, to avoid undefined symbols at
link time.
---
 windows/build.sh         |  9 +++++++++
 windows/deps/versions.mk | 16 ++++++++--------
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/windows/build.sh b/windows/build.sh
index a59257de83..e75f42b5d5 100755
--- a/windows/build.sh
+++ b/windows/build.sh
@@ -54,6 +54,15 @@ BASENAME=dynare-$VERSION
 LIB64="$ROOT_DIRECTORY"/deps/lib64
 LIB64_MSYS2="$ROOT_DIRECTORY"/deps/lib64-msys2
 
+# MSYS2 libraries are now built with -fstack-protector-strong, see:
+# https://www.msys2.org/news/#2022-10-23-mingw-packages-now-built-with-d_fortify_source2-and-fstack-protector-strong
+# As of 2023-01-03, when linking against HDF5 (and possibly other libraries),
+# it is necessary to compile our own code with -fstack-protector to avoid undefined symbols
+# at link time.
+# Note that adding this flag is not necessary when building from MSYS2 shell.
+# Maybe revisit this once our runners are upgraded to Debian “Bookworm” 12.
+export CXXFLAGS="-O2 -fstack-protector"
+
 # Go to source root directory
 cd ..
 
diff --git a/windows/deps/versions.mk b/windows/deps/versions.mk
index 5ebaf2be0f..ed654a3351 100644
--- a/windows/deps/versions.mk
+++ b/windows/deps/versions.mk
@@ -18,7 +18,7 @@ MATLAB64_VERSION = 20200930
 ## Build dependencies
 
 # pacman -Ss mingw-w64-x86_64-boost
-MINGW64_BOOST_VERSION = 1.80.0-1
+MINGW64_BOOST_VERSION = 1.81.0-1
 
 # pacman -Ss mingw-w64-x86_64-gsl
 MINGW64_GSL_VERSION = 2.7.1-1
@@ -28,11 +28,11 @@ MINGW64_MATIO_VERSION = 1.5.23-1
 
 # Dependency of matio (and of the MinGW compiler)
 # pacman -Ss mingw-w64-x86_64-zlib
-MINGW64_ZLIB_VERSION = 1.2.12-1
+MINGW64_ZLIB_VERSION = 1.2.13-2
 
 # Dependency of matio
 # pacman -Ss mingw-w64-x86_64-hdf5
-MINGW64_HDF5_VERSION = 1.12.2-1
+MINGW64_HDF5_VERSION = 1.12.2-2
 
 # Dependency of HDF5 (provides szip library)
 # pacman -Ss mingw-w64-x86_64-libaec
@@ -41,22 +41,22 @@ MINGW64_LIBAEC_VERSION = 1.0.6-2
 ## MinGW packages for the embedded compiler
 
 # pacman -Ss mingw-w64-x86_64-gcc$
-MINGW64_GCC_VERSION = 12.2.0-1
+MINGW64_GCC_VERSION = 12.2.0-7
 
 # pacman -Ss mingw-w64-x86_64-gmp
-MINGW64_GMP_VERSION = 6.2.1-3
+MINGW64_GMP_VERSION = 6.2.1-4
 
 # pacman -Ss mingw-w64-x86_64-binutils
 MINGW64_BINUTILS_VERSION = 2.39-2
 
 # pacman -Ss mingw-w64-x86_64-headers-git
-MINGW64_HEADERS_VERSION = 10.0.0.r72.g1dd2a4993-1
+MINGW64_HEADERS_VERSION = 10.0.0.r186.gfc55e181b-1
 
 # pacman -Ss mingw-w64-x86_64-crt-git
-MINGW64_CRT_VERSION = 10.0.0.r72.g1dd2a4993-1
+MINGW64_CRT_VERSION = 10.0.0.r186.gfc55e181b-1
 
 # pacman -Ss mingw-w64-x86_64-winpthreads-git
-MINGW64_WINPTHREADS_VERSION = 10.0.0.r72.g1dd2a4993-1
+MINGW64_WINPTHREADS_VERSION = 10.0.0.r186.gfc55e181b-1
 
 # pacman -Ss mingw-w64-x86_64-zstd
 MINGW64_ZSTD_VERSION = 1.5.2-2
-- 
GitLab