Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting codegen to work in MATLAB #38

Open
makeller1 opened this issue Apr 29, 2021 · 0 comments
Open

Getting codegen to work in MATLAB #38

makeller1 opened this issue Apr 29, 2021 · 0 comments

Comments

@makeller1
Copy link

makeller1 commented Apr 29, 2021

After troubleshooting getting codegen to work in MATLAB, I've got some errors to report and solutions for people struggling like I was. If these cannot be fixed, it would be helpful to have some messages in the docs about these specifics.

  • In MATLAB 2021a the supported minGW compiler (installed in the MATLAB gui as a support package) fails with error "Error configuring CMAKE environment" because "CMAKE_MAKE_PROGRAM" is not set. The osqp docs currently suggest installing this compiler through a url to matlab's supported compilers, so this error is bound to happen for others.

Solution:

  1. Install the minGW compiler from TDM-GCC at https://jmeubank.github.io/tdm-gcc/download/
  2. Add this line to your matlab code:
    setenv('MW_MINGW64_LOC', 'C:\TDM-GCC-64');
  3. Add this line to your matlab code:
    setenv('PATH', [getenv('PATH') ';C:\TDM-GCC-64\bin']);
    where C:\TDM-GCC-64 is replaced in 2 and 3 with the location of your TDM-GCC installation.
  • When installing osqp from the MATLAB terminal using the commands given in the osqp docs:
    >>websave('install_osqp.m', 'https://dl.bintray.com/bstellato/generic/OSQP/0.6.2/install_osqp.m');
    >>install_osqp
    the installation is saved to whatever directory is matlab's current working directory. If this path is too long, codegen will fail at some point due to mex.

Solution:

  1. Delete the osqp folder.
  2. Set matlab's working directory to a short path.
  3. Reinstall osqp using the same commands as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant