From 1485b656bc314f8204891dea94d87f2e51032355 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 8 Jan 2024 21:39:10 +0200 Subject: [PATCH 1/9] Patch TBB makefile, add testing workflow --- .github/workflows/rtools-make.yml | 51 +++++++++++++++++++++++++++++++ lib/tbb_2020.3/build/windows.inc | 12 +++++--- make/libraries | 11 ++----- runTests.py | 12 ++------ test/sig_utils.py | 2 +- 5 files changed, 66 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/rtools-make.yml diff --git a/.github/workflows/rtools-make.yml b/.github/workflows/rtools-make.yml new file mode 100644 index 00000000000..c8c9fcc44cf --- /dev/null +++ b/.github/workflows/rtools-make.yml @@ -0,0 +1,51 @@ +name: Windows Rtools40 + +on: + pull_request: + branches: [ develop, master ] + push: + branches: [ tbb-rtools-make ] + paths-ignore: + - 'doygen/**' + - 'hooks/**' + - 'licenses/**' + - 'LICENSE.md' + - 'README.md' + - 'RELEASE-NOTES.txt' +permissions: + contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + rtools-build-check: + runs-on: windows-latest + name: R ${{ matrix.config.r }} with Rtools ${{ matrix.config.rtools }} + + strategy: + fail-fast: false + matrix: + config: + - {os: windows-latest, r: '4.3.2', rtools: '43', path: 'C:/rtools43/x86_64-w64-mingw32.static.posix/bin;C:/rtools43/usr/bin'} + - {os: windows-latest, r: '4.2.3', rtools: '42', path: 'C:/rtools42/x86_64-w64-mingw32.static.posix/bin;C:/rtools42/usr/bin'} + - {os: windows-latest, r: '4.1.3', rtools: '40', path: 'C:/rtools40/mingw64/bin;C:/rtools40/usr/bin'} + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + rtools-version: ${{ matrix.config.rtools }} + + - name: Set path for Rtools${{ matrix.config.rtools }} + run: echo "${{ matrix.config.path }}" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + + - name: Build Math libs + shell: powershell + run: | + Add-Content make\local "O=1`n" + make -f make/standalone math-libs -j2 diff --git a/lib/tbb_2020.3/build/windows.inc b/lib/tbb_2020.3/build/windows.inc index dafd8928523..bc34d6be2f2 100644 --- a/lib/tbb_2020.3/build/windows.inc +++ b/lib/tbb_2020.3/build/windows.inc @@ -12,7 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -export SHELL = cmd +ifeq (true,$(USING_RTOOLS)) + export SHELL = sh.exe +else + export SHELL = cmd +endif ifdef tbb_build_dir test_dir:=$(tbb_build_dir) @@ -22,7 +26,7 @@ endif # A convenience wrapper for calls to detect.js. # $(1) is the full command line for the script, e.g. /minversion icl 12 -detect_js = $(shell cmd /C "cscript /nologo /E:jscript $(tbb_root)/build/detect.js $(1)") +detect_js = $(shell cmd //C "cscript //nologo //E:jscript $(tbb_root)/build/detect.js $(1)") # TODO give an error if archs doesn't match ifndef arch @@ -110,8 +114,8 @@ ifneq ($(filter vc8 vc9,$(runtime)),) RML.MANIFEST = tbbmanifest.exe.manifest endif -MAKE_VERSIONS = cmd /C cscript /nologo /E:jscript $(subst \,/,$(tbb_root))/build/version_info_windows.js $(compiler) $(arch) $(subst \,/,"$(VERSION_FLAGS)") > version_string.ver -MAKE_TBBVARS = cmd /C "$(subst /,\,$(tbb_root))\build\generate_tbbvars.bat" +MAKE_VERSIONS = cmd //C cscript //nologo //E:jscript $(subst \,/,$(tbb_root))/build/version_info_windows.js $(compiler) $(arch) $(subst \,/,"$(VERSION_FLAGS)") > version_string.ver +MAKE_TBBVARS = cmd //C "$(subst /,\,$(tbb_root))\build\generate_tbbvars.bat" TEST_LAUNCHER = $(subst /,\,$(tbb_root))\build\test_launcher.bat $(largs) diff --git a/make/libraries b/make/libraries index 516318cdfcf..e846161ee2a 100644 --- a/make/libraries +++ b/make/libraries @@ -143,6 +143,7 @@ ifeq (Windows_NT, $(OS)) ifeq ($(IS_UCRT),true) TBB_CXXFLAGS += -D_UCRT endif + USING_RTOOLS := true endif # If brackets or spaces are found in MAKE on Windows @@ -157,12 +158,6 @@ $(TBB_BIN)/tbb-make-check: ifeq ($(OS),Windows_NT) ifneq ($(MAKE),$(MAKE_ESCAPED)) $(error '$nError:$n$nThe RTools toolchain is installed in a path with spaces or brackets.$nPlease reinstall the toolchain.$n$n') -else - if ! [[ $(MAKE) =~ mingw32 ]]; then \ - echo "ERROR: Please use mingw32-make on Windows to build the Intel TBB library."; \ - echo "This is packaged with RTools, for example."; \ - exit 1; \ - fi endif endif @mkdir -p $(TBB_BIN) @@ -172,11 +167,11 @@ endif $(TBB_BIN)/tbb.def: $(TBB_BIN)/tbb-make-check @mkdir -p $(TBB_BIN) touch $(TBB_BIN)/version_$(notdir $(TBB)) - tbb_root="$(TBB_RELATIVE_PATH)" CXX="$(CXX)" CC="$(TBB_CC)" LDFLAGS='$(LDFLAGS_TBB)' '$(MAKE)' -C "$(TBB_BIN)" -r -f "$(TBB_ABSOLUTE_PATH)/build/Makefile.tbb" compiler=$(TBB_CXX_TYPE) cfg=release stdver=c++1y CXXFLAGS="$(TBB_CXXFLAGS)" + USING_RTOOLS=$(USING_RTOOLS) tbb_root="$(TBB_RELATIVE_PATH)" CXX="$(CXX)" CC="$(TBB_CC)" LDFLAGS='$(LDFLAGS_TBB)' '$(MAKE)' -C "$(TBB_BIN)" -r -f "$(TBB_ABSOLUTE_PATH)/build/Makefile.tbb" compiler=$(TBB_CXX_TYPE) cfg=release stdver=c++1y CXXFLAGS="$(TBB_CXXFLAGS)" $(TBB_BIN)/tbbmalloc.def: $(TBB_BIN)/tbb-make-check @mkdir -p $(TBB_BIN) - tbb_root="$(TBB_RELATIVE_PATH)" CXX="$(CXX)" CC="$(TBB_CC)" LDFLAGS='$(LDFLAGS_TBB)' '$(MAKE)' -C "$(TBB_BIN)" -r -f "$(TBB_ABSOLUTE_PATH)/build/Makefile.tbbmalloc" compiler=$(TBB_CXX_TYPE) cfg=release stdver=c++1y malloc CXXFLAGS="$(TBB_CXXFLAGS)" + USING_RTOOLS=$(USING_RTOOLS) tbb_root="$(TBB_RELATIVE_PATH)" CXX="$(CXX)" CC="$(TBB_CC)" LDFLAGS='$(LDFLAGS_TBB)' '$(MAKE)' -C "$(TBB_BIN)" -r -f "$(TBB_ABSOLUTE_PATH)/build/Makefile.tbbmalloc" compiler=$(TBB_CXX_TYPE) cfg=release stdver=c++1y malloc CXXFLAGS="$(TBB_CXXFLAGS)" $(TBB_BIN)/libtbb.dylib: $(TBB_BIN)/tbb.def $(TBB_BIN)/libtbbmalloc.dylib: $(TBB_BIN)/tbbmalloc.def diff --git a/runTests.py b/runTests.py index 7f695c8a4a2..7b0a1e954ba 100755 --- a/runTests.py +++ b/runTests.py @@ -177,10 +177,7 @@ def doCommand(command, exit_on_failure=True): def generateTests(j): """Generate all tests and pass along the j parameter to make.""" - if isWin(): - doCommand("mingw32-make -j%d generate-tests -s" % (j or 1)) - else: - doCommand("make -j%d generate-tests -s" % (j or 1)) + doCommand("make -j%d generate-tests -s" % (j or 1)) def divide_chunks(l, n): @@ -238,10 +235,7 @@ def cleanupJumboTests(paths): def makeTest(name, j): """Run the make command for a given single test.""" - if isWin(): - doCommand("mingw32-make -j%d %s" % (j or 1, name)) - else: - doCommand("make -j%d %s" % (j or 1, name)) + doCommand("make -j%d %s" % (j or 1, name)) def commandExists(command): @@ -374,7 +368,7 @@ def handleExpressionTests(tests, only_functions, n_test_files): def checkToolchainPathWindows(): if isWin(): p1 = subprocess.Popen( - "where.exe mingw32-make", + "where.exe make", stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, diff --git a/test/sig_utils.py b/test/sig_utils.py index 73c52f83a90..d8500c3bbe1 100644 --- a/test/sig_utils.py +++ b/test/sig_utils.py @@ -6,7 +6,7 @@ import sys if os.name == "nt": # Windows - make = "mingw32-make" + make = "make" exe_extension = ".exe" else: make = "make" From 9d69c91e3437354999101328faf6f4a102ce09cb Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 8 Jan 2024 21:40:45 +0200 Subject: [PATCH 2/9] Remove interim testing workflow --- .github/workflows/rtools-make.yml | 51 ------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 .github/workflows/rtools-make.yml diff --git a/.github/workflows/rtools-make.yml b/.github/workflows/rtools-make.yml deleted file mode 100644 index c8c9fcc44cf..00000000000 --- a/.github/workflows/rtools-make.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Windows Rtools40 - -on: - pull_request: - branches: [ develop, master ] - push: - branches: [ tbb-rtools-make ] - paths-ignore: - - 'doygen/**' - - 'hooks/**' - - 'licenses/**' - - 'LICENSE.md' - - 'README.md' - - 'RELEASE-NOTES.txt' -permissions: - contents: read -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - rtools-build-check: - runs-on: windows-latest - name: R ${{ matrix.config.r }} with Rtools ${{ matrix.config.rtools }} - - strategy: - fail-fast: false - matrix: - config: - - {os: windows-latest, r: '4.3.2', rtools: '43', path: 'C:/rtools43/x86_64-w64-mingw32.static.posix/bin;C:/rtools43/usr/bin'} - - {os: windows-latest, r: '4.2.3', rtools: '42', path: 'C:/rtools42/x86_64-w64-mingw32.static.posix/bin;C:/rtools42/usr/bin'} - - {os: windows-latest, r: '4.1.3', rtools: '40', path: 'C:/rtools40/mingw64/bin;C:/rtools40/usr/bin'} - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - uses: r-lib/actions/setup-r@v2 - with: - r-version: ${{ matrix.config.r }} - rtools-version: ${{ matrix.config.rtools }} - - - name: Set path for Rtools${{ matrix.config.rtools }} - run: echo "${{ matrix.config.path }}" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - - - name: Build Math libs - shell: powershell - run: | - Add-Content make\local "O=1`n" - make -f make/standalone math-libs -j2 From 5ab1e6d0b9a27f8e32e124e8016f365baf120a3f Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 8 Jan 2024 21:48:26 +0200 Subject: [PATCH 3/9] Document changes --- lib/tbb_2020.3/STAN_CHANGES | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/tbb_2020.3/STAN_CHANGES b/lib/tbb_2020.3/STAN_CHANGES index 8de7574b633..fa31216f77d 100644 --- a/lib/tbb_2020.3/STAN_CHANGES +++ b/lib/tbb_2020.3/STAN_CHANGES @@ -2,3 +2,12 @@ This file documents changes done for the stan-math project - drop -g flag from makefiles for release mode builds to decrease size of binaries - Add `tbb::` to line 252 of `task.h` to fix a build failure with gcc 13. This was done upstream in https://github.com/oneapi-src/oneTBB/pull/833 + +- build/windows.inc patches for RTools make: + - L15 added: + add ifeq (true,$(USING_RTOOLS)) + export SHELL = sh.exe + else + export SHELL = cmd + endif + - L25,L113,L114 added additional '/' to each cmd flag From 551e8597af97dee28fb20c7b4147556cf113dbc6 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 8 Jan 2024 21:58:40 +0200 Subject: [PATCH 4/9] Remove additional stray usage --- .github/workflows/main.yml | 46 +++++--------------------------------- make/libraries | 4 ---- 2 files changed, 5 insertions(+), 45 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 444560a4353..dd66a7cc52b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,21 +35,12 @@ jobs: - name: Set path for Rtools40 if: runner.os == 'Windows' run: echo "C:/rtools40/usr/bin;C:/rtools40/mingw64/bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - - name: Install mingw32-make and check toolchain path - if: runner.os == 'Windows' - run: | - pacman -Syu mingw-w64-x86_64-make --noconfirm - g++ --version - Get-Command g++ | Select-Object -ExpandProperty Definition - mingw32-make --version - Get-Command mingw32-make | Select-Object -ExpandProperty Definition - shell: powershell - name: Build Math libs shell: powershell run: | Add-Content make\local "O=1`n" - mingw32-make -f make/standalone math-libs -j2 + make -f make/standalone math-libs -j2 - name: Add TBB to PATH shell: powershell run: echo "D:/a/math/math/lib/tbb" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 @@ -85,21 +76,12 @@ jobs: - name: Set path for Rtools40 if: runner.os == 'Windows' run: echo "C:/rtools40/usr/bin;C:/rtools40/mingw64/bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - - name: Install mingw32-make and check toolchain path - if: runner.os == 'Windows' - run: | - pacman -Syu mingw-w64-x86_64-make --noconfirm - g++ --version - Get-Command g++ | Select-Object -ExpandProperty Definition - mingw32-make --version - Get-Command mingw32-make | Select-Object -ExpandProperty Definition - shell: powershell - name: Build Math libs shell: powershell run: | Add-Content make\local "O=1`n" - mingw32-make -f make/standalone math-libs -j2 + make -f make/standalone math-libs -j2 - name: Add TBB to PATH shell: powershell run: echo "D:/a/math/math/lib/tbb" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 @@ -139,21 +121,12 @@ jobs: - name: Set path for Rtools40 if: runner.os == 'Windows' run: echo "C:/rtools40/usr/bin;C:/rtools40/mingw64/bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - - name: Install mingw32-make and check toolchain path - if: runner.os == 'Windows' - run: | - pacman -Syu mingw-w64-x86_64-make --noconfirm - g++ --version - Get-Command g++ | Select-Object -ExpandProperty Definition - mingw32-make --version - Get-Command mingw32-make | Select-Object -ExpandProperty Definition - shell: powershell - name: Build Math libs shell: powershell run: | Add-Content make\local "O=1`n" - mingw32-make -f make/standalone math-libs -j2 + make -f make/standalone math-libs -j2 - name: Add TBB to PATH shell: powershell run: echo "D:/a/math/math/lib/tbb" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 @@ -171,7 +144,7 @@ jobs: with: name: gtest_outputs_xml path: '**/*_test.xml' - + mix-fun-2: name: mix/fun tests 2 runs-on: windows-latest @@ -188,21 +161,12 @@ jobs: - name: Set path for Rtools40 if: runner.os == 'Windows' run: echo "C:/rtools40/usr/bin;C:/rtools40/mingw64/bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - - name: Install mingw32-make and check toolchain path - if: runner.os == 'Windows' - run: | - pacman -Syu mingw-w64-x86_64-make --noconfirm - g++ --version - Get-Command g++ | Select-Object -ExpandProperty Definition - mingw32-make --version - Get-Command mingw32-make | Select-Object -ExpandProperty Definition - shell: powershell - name: Build Math libs shell: powershell run: | Add-Content make\local "O=1`n" - mingw32-make -f make/standalone math-libs -j2 + make -f make/standalone math-libs -j2 - name: Add TBB to PATH shell: powershell run: echo "D:/a/math/math/lib/tbb" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 diff --git a/make/libraries b/make/libraries index e846161ee2a..0300edc9735 100644 --- a/make/libraries +++ b/make/libraries @@ -102,10 +102,6 @@ clean-sundials: # Note that the tbb targets must not be build in parallel (so no concurrent # build of tbb and tbbmalloc, for example). This is ensured here with proper # dependencies. -# -# On windows the mingw32-make (part of RTools, for example) is required to build -# the TBB as this make has proper POSIX extensions needed by the used downstream -# TBB makefiles. ifndef TBB_LIB From fc61b2f8c6306b019b00dc6e42d4393d356f360d Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 9 Jan 2024 19:49:39 +0200 Subject: [PATCH 5/9] Move shell setting to makefile --- lib/tbb_2020.3/STAN_CHANGES | 6 ------ lib/tbb_2020.3/build/windows.inc | 6 +----- make/libraries | 11 ++++++++--- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/lib/tbb_2020.3/STAN_CHANGES b/lib/tbb_2020.3/STAN_CHANGES index fa31216f77d..13e9b6a8275 100644 --- a/lib/tbb_2020.3/STAN_CHANGES +++ b/lib/tbb_2020.3/STAN_CHANGES @@ -4,10 +4,4 @@ This file documents changes done for the stan-math project - Add `tbb::` to line 252 of `task.h` to fix a build failure with gcc 13. This was done upstream in https://github.com/oneapi-src/oneTBB/pull/833 - build/windows.inc patches for RTools make: - - L15 added: - add ifeq (true,$(USING_RTOOLS)) - export SHELL = sh.exe - else - export SHELL = cmd - endif - L25,L113,L114 added additional '/' to each cmd flag diff --git a/lib/tbb_2020.3/build/windows.inc b/lib/tbb_2020.3/build/windows.inc index bc34d6be2f2..a740ba9df70 100644 --- a/lib/tbb_2020.3/build/windows.inc +++ b/lib/tbb_2020.3/build/windows.inc @@ -12,11 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -ifeq (true,$(USING_RTOOLS)) - export SHELL = sh.exe -else - export SHELL = cmd -endif +export SHELL = cmd ifdef tbb_build_dir test_dir:=$(tbb_build_dir) diff --git a/make/libraries b/make/libraries index 0300edc9735..48f998a9394 100644 --- a/make/libraries +++ b/make/libraries @@ -139,7 +139,12 @@ ifeq (Windows_NT, $(OS)) ifeq ($(IS_UCRT),true) TBB_CXXFLAGS += -D_UCRT endif - USING_RTOOLS := true + ifneq (,$(shell sh --version 2>/dev/null)) + WINDOWS_HAS_SH ?= true + endif + ifeq ($(WINDOWS_HAS_SH), true) # Stop TBB makefile changing SHELL on RTools + MAKEOVERRIDES += SHELL=sh.exe + endif endif # If brackets or spaces are found in MAKE on Windows @@ -163,11 +168,11 @@ endif $(TBB_BIN)/tbb.def: $(TBB_BIN)/tbb-make-check @mkdir -p $(TBB_BIN) touch $(TBB_BIN)/version_$(notdir $(TBB)) - USING_RTOOLS=$(USING_RTOOLS) tbb_root="$(TBB_RELATIVE_PATH)" CXX="$(CXX)" CC="$(TBB_CC)" LDFLAGS='$(LDFLAGS_TBB)' '$(MAKE)' -C "$(TBB_BIN)" -r -f "$(TBB_ABSOLUTE_PATH)/build/Makefile.tbb" compiler=$(TBB_CXX_TYPE) cfg=release stdver=c++1y CXXFLAGS="$(TBB_CXXFLAGS)" + tbb_root="$(TBB_RELATIVE_PATH)" CXX="$(CXX)" CC="$(TBB_CC)" LDFLAGS='$(LDFLAGS_TBB)' '$(MAKE)' -C "$(TBB_BIN)" -r -f "$(TBB_ABSOLUTE_PATH)/build/Makefile.tbb" compiler=$(TBB_CXX_TYPE) cfg=release stdver=c++1y CXXFLAGS="$(TBB_CXXFLAGS)" $(TBB_BIN)/tbbmalloc.def: $(TBB_BIN)/tbb-make-check @mkdir -p $(TBB_BIN) - USING_RTOOLS=$(USING_RTOOLS) tbb_root="$(TBB_RELATIVE_PATH)" CXX="$(CXX)" CC="$(TBB_CC)" LDFLAGS='$(LDFLAGS_TBB)' '$(MAKE)' -C "$(TBB_BIN)" -r -f "$(TBB_ABSOLUTE_PATH)/build/Makefile.tbbmalloc" compiler=$(TBB_CXX_TYPE) cfg=release stdver=c++1y malloc CXXFLAGS="$(TBB_CXXFLAGS)" + tbb_root="$(TBB_RELATIVE_PATH)" CXX="$(CXX)" CC="$(TBB_CC)" LDFLAGS='$(LDFLAGS_TBB)' '$(MAKE)' -C "$(TBB_BIN)" -r -f "$(TBB_ABSOLUTE_PATH)/build/Makefile.tbbmalloc" compiler=$(TBB_CXX_TYPE) cfg=release stdver=c++1y malloc CXXFLAGS="$(TBB_CXXFLAGS)" $(TBB_BIN)/libtbb.dylib: $(TBB_BIN)/tbb.def $(TBB_BIN)/libtbbmalloc.dylib: $(TBB_BIN)/tbbmalloc.def From 7201e326575d40ca6316c2cce1ff2de257abc7f4 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 9 Jan 2024 20:10:23 +0200 Subject: [PATCH 6/9] Using rtools check --- make/libraries | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/make/libraries b/make/libraries index 48f998a9394..dd7ac07e24a 100644 --- a/make/libraries +++ b/make/libraries @@ -139,10 +139,8 @@ ifeq (Windows_NT, $(OS)) ifeq ($(IS_UCRT),true) TBB_CXXFLAGS += -D_UCRT endif - ifneq (,$(shell sh --version 2>/dev/null)) - WINDOWS_HAS_SH ?= true - endif - ifeq ($(WINDOWS_HAS_SH), true) # Stop TBB makefile changing SHELL on RTools + USING_RTOOLS ?= true + ifeq ($(USING_RTOOLS), true) # Stop TBB makefile changing SHELL on RTools MAKEOVERRIDES += SHELL=sh.exe endif endif From 66ba97c3e88cc184adce5b11fa46d3804dd086b4 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 9 Jan 2024 20:35:21 +0200 Subject: [PATCH 7/9] mingw32-make compatible override --- lib/tbb_2020.3/build/windows.inc | 2 +- make/libraries | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/tbb_2020.3/build/windows.inc b/lib/tbb_2020.3/build/windows.inc index a740ba9df70..33ef9619cf8 100644 --- a/lib/tbb_2020.3/build/windows.inc +++ b/lib/tbb_2020.3/build/windows.inc @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -export SHELL = cmd +SHELL ?= cmd ifdef tbb_build_dir test_dir:=$(tbb_build_dir) diff --git a/make/libraries b/make/libraries index dd7ac07e24a..0ad7a021081 100644 --- a/make/libraries +++ b/make/libraries @@ -139,9 +139,11 @@ ifeq (Windows_NT, $(OS)) ifeq ($(IS_UCRT),true) TBB_CXXFLAGS += -D_UCRT endif - USING_RTOOLS ?= true - ifeq ($(USING_RTOOLS), true) # Stop TBB makefile changing SHELL on RTools - MAKEOVERRIDES += SHELL=sh.exe + ifeq (true,$(shell sh --version 2>/dev/null)) + WINDOWS_HAS_SH ?= true + endif + ifeq ($(WINDOWS_HAS_SH), true) # Stop TBB makefile changing SHELL on RTools + SHELL = sh.exe endif endif From bd4ccfa42ca66d1e225377385c3c4b24d49ce3c4 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 9 Jan 2024 20:38:23 +0200 Subject: [PATCH 8/9] Update notes --- lib/tbb_2020.3/STAN_CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/tbb_2020.3/STAN_CHANGES b/lib/tbb_2020.3/STAN_CHANGES index 13e9b6a8275..67193d07e32 100644 --- a/lib/tbb_2020.3/STAN_CHANGES +++ b/lib/tbb_2020.3/STAN_CHANGES @@ -4,4 +4,5 @@ This file documents changes done for the stan-math project - Add `tbb::` to line 252 of `task.h` to fix a build failure with gcc 13. This was done upstream in https://github.com/oneapi-src/oneTBB/pull/833 - build/windows.inc patches for RTools make: + - L15 changed setting to use '?=', allowing override - L25,L113,L114 added additional '/' to each cmd flag From e5b364b7fb1ac4253cb99ea051d3e83d0bf14572 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 9 Jan 2024 20:59:52 +0200 Subject: [PATCH 9/9] Alt sh check --- make/libraries | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/make/libraries b/make/libraries index 0ad7a021081..e7861a2bc2e 100644 --- a/make/libraries +++ b/make/libraries @@ -139,7 +139,8 @@ ifeq (Windows_NT, $(OS)) ifeq ($(IS_UCRT),true) TBB_CXXFLAGS += -D_UCRT endif - ifeq (true,$(shell sh --version 2>/dev/null)) + SH_CHECK := $(shell command -v sh 2>/dev/null) + ifdef SH_CHECK WINDOWS_HAS_SH ?= true endif ifeq ($(WINDOWS_HAS_SH), true) # Stop TBB makefile changing SHELL on RTools