Acados Makefile Error on Windows for simulink_example.m

Hi,
I am new to acados and installed it on Windows 10. I am using it with Matlab 2017b and want to generete c-code and then a simulink s-function for later use on a dSpace MAB 2.
After managing to install and building acaodos properly, placing the t_renderer.exe file correctly and installing casadi in the matlab-casadi folder, I finally got the minimal_example_ocp.m to work.

However, when I try to test the simulink_example.m I run into the following error:

Successfully rendered acados templates!
Compilation of generated C code main file not thoroughly tested under Windows. Attempting to continue.
Error using acados_template_mex.compile_main (line 86)
Building templated code failed.
Got status 2, result: del \Q *.o 2>nul
del \Q *.so 2>nul
del \Q main_pendulum 2>nul
cc -fPIC -std=c99   -IC:\Users\May\Documents\MATLAB\acados\examples\acados_matlab_octave\..\../include
-IC:\Users\May\Documents\MATLAB\acados\examples\acados_matlab_octave\..\../include/acados
-IC:\Users\May\Documents\MATLAB\acados\examples\acados_matlab_octave\..\../include/blasfeo/include
-IC:\Users\May\Documents\MATLAB\acados\examples\acados_matlab_octave\..\../include/hpipm/include  -c -o main_sim_pendulum.o main_sim_pendulum.c
<builtin>: recipe for target 'main_sim_pendulum.o' failed
process_begin: CreateProcess(NULL, cc -fPIC -std=c99 -IC:\Users\May\Documents\MATLAB\acados\examples\acados_matlab_octave\..\../include
-IC:\Users\May\Documents\MATLAB\acados\examples\acados_matlab_octave\..\../include/acados
-IC:\Users\May\Documents\MATLAB\acados\examples\acados_matlab_octave\..\../include/blasfeo/include
-IC:\Users\May\Documents\MATLAB\acados\examples\acados_matlab_octave\..\../include/hpipm/include -c -o main_sim_pendulum.o main_sim_pendulum.c,
...) failed.
make (e=2): Das System kann die angegebene Datei nicht finden.

mingw32-make.exe: *** [main_sim_pendulum.o] Error 2


Error in ocp_generate_c_code (line 280)
    acados_template_mex.compile_main()

Error in acados_ocp/generate_c_code (line 229)
            ocp_generate_c_code(obj)

Error in simulink_example (line 11)
ocp.generate_c_code;

It seems to have an issue with compiling and linking the main_sim_pendulum.c file, although the C file is generated correctly.
I tried to change the compiler symbol $(CC) in the makefile to gcc and removed the compiler flag -fPIC.
Thereby I could manually run the makefile, then generate the code and got it to work in simulink.

Am I missing any installation step which sets the $(CC) symbol correctly? What do I have to change to get it running automatically? Maybe the Makefile templates?

Thanks for any help,
Max

Hi Max,

this warning is essential:
Compilation of generated C code main file not thoroughly tested under Windows. Attempting to continue.

Since it is not tested and also not needed for Simulink, I disabled using the Makefile on Windows.
The Sfunctions are built using the make_sfun* functions.

You can just run the rest of the Simulink example (from cd c_generated_code onwards)
or checkout this version:

Best,
Jonathan

1 Like