matlab-actions / setup-matlab

Set up your GitHub Actions workflow with a specific version of MATLAB.
BSD 3-Clause "New" or "Revised" License
76 stars 10 forks source link

Regression: mex command failed to find mingw64 g++ even `MW_MINGW64_LOC` was defined #75

Closed fangq closed 11 months ago

fangq commented 12 months ago

this seems to be a recent regression on setup-matlab (although I can't exclude the possibility that something in my script that has caused this, or github's windows-2019 runner).

previously, my github action script can build a mex file on windows without any issue using mingw64 g++ (by defining MW_MINGW64_LOC), see a successful build on Oct 7 (expand the section Build mcxlabcl for MATLAB)

https://github.com/fangq/mcxcl/actions/runs/6443229681/job/17494922687

however, I just made some changes in my C code without touching the github action script, mex failed with the following error:

Supported compiler not detected. You can install the freely available MinGW-w64 C/C++ compiler; visit https://www.mathworks.com/matlabcentral/fileexchange/52848-matlab-support-for-mingw-w64-c-c-compiler. For more options, visit https://www.mathworks.com/support/compilers.

switching matlab from latest to R2022a did not solve this problem

https://github.com/fangq/mcxcl/actions/runs/6684861633/job/18162546536 (using latest) https://github.com/fangq/mcxcl/actions/runs/6684966422/job/18162772877 (using R2022a)

from the log, you can see MW_MINGW64_LOC was defined the same way as it was before.

I am not sure if this is caused by github runner image changes, or this is related to matlab changes. Please let me know if have any suggestions.

fangq commented 12 months ago

I further confirm this issue by rerunning one of the previously successful jobs without changing anything, yet, the resubmitted job failed with the same error:

here is the failed job log: https://github.com/fangq/mmc/actions/runs/6356350750/job/18163174446

here is the previous successful job https://github.com/fangq/mmc/actions/runs/6356350750/attempts/1

no change was made to the code.

mcafaro commented 11 months ago

I would not expect setup-matlab to be involved here. latest switched to R2023b in mid-September and the original successful build was run long after that (Oct 7th), so I would not expect that switch to be involved either.

Have you tried to confirm chocolatey is still installing mingw64 in the same location?

mcafaro commented 11 months ago

Looking at some of the changes to the windows-2019 GitHub runner README, it looks like Mingw-w64 was removed from the list of preinstalled software recently: https://github.com/actions/runner-images/commit/2ffd260f96f5a2b471001413a861e9338891d70e#diff-816219d3c9f30fcc1c40f88ca826c1662bf99eded781c1b419dd2dfb577ae227L75

That seems like a potential culprit. You may need to install it manually now.

fangq commented 11 months ago

thank you so much for noticing this package change in the log! after installing mingw64 on windows, the issue is gone.

much appreciated!