MATLAB: The problem when I want to install IPOPT and need mex.pl

ipoptmex compiler

It said this
Can't open perl script "c:/PROGRA~1/MATLAB/R2019a/bin/mex.pl": No such file or directory
make: *** [ipopt.mexw64] Error 2
And I have installed MinGW for mex.
What should I do to have a file named mex.pl in c:/PROGRA~1/MATLAB/R2019a/bin/?

Best Answer

Here's what worked for me:
1) Open the Makefile found at $IPOPTDIR/build/contrib/MatlabInterface/src
2) Find the 2 lines that start MEX= (for me that is 26-27)
3) Uncomment the first of these two lines and comment out the second.
4) Check your MATLAB folder and see where the mex.exe file is found (for me it is in bin/win64) and update the MEX= path accordingly. (I ended up with MEX = $(MATLAB_HOME)/bin/win64/mex )
5) Try running "make install" again
If next you get the error "No supported compiler found. You can install the freely available MinGW-w64 C/C++ complier..." even though you already have that installed, please let me know because I'm currently working through that issue!