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/lib/tbb_2020.3/STAN_CHANGES b/lib/tbb_2020.3/STAN_CHANGES index 8de7574b633..67193d07e32 100644 --- a/lib/tbb_2020.3/STAN_CHANGES +++ b/lib/tbb_2020.3/STAN_CHANGES @@ -2,3 +2,7 @@ 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 changed setting to use '?=', allowing override + - 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 dafd8928523..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) @@ -22,7 +22,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 +110,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 2aeb09741ee..3e9b1d0d75d 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 @@ -143,6 +139,13 @@ ifeq (Windows_NT, $(OS)) ifeq ($(IS_UCRT),true) TBB_CXXFLAGS += -D_UCRT endif + 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 + SHELL = sh.exe + endif endif # If brackets or spaces are found in MAKE on Windows @@ -157,12 +160,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) diff --git a/runTests.py b/runTests.py index 26715b52348..4bce225109b 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): @@ -375,7 +369,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"