Windows+Matlab: Error while trying basic example

Hi :wave:

I tried to get into Acados. Installed everything according to the docs and always get this error message while trying to compile the minimal_example_ocp.m:

compiling C:\Users\phman\Documents\repos\acados\examples\acados_matlab_octave\..\..\interfaces\acados_matlab_octave\ocp_create.c
Building with 'MinGW64 Compiler (C)'.
Error using mex
C:\Users\phman\Documents\repos\acados\examples\acados_matlab_octave\..\..\lib\acados.lib(ocp_nlp_common.c.obj):ocp_nlp_common:(.text+0x2a):
undefined reference to `__imp___acrt_iob_func'
C:\Users\phman\Documents\repos\acados\examples\acados_matlab_octave\..\..\lib\acados.lib(ocp_nlp_reg_common.c.obj):ocp_nlp_reg_common.c:(.text+0x25):
undefined reference to `__imp___acrt_iob_func'
C:\Users\phman\Documents\repos\acados\examples\acados_matlab_octave\..\..\lib\acados.lib(ocp_qp_xcond_solver.c.obj):ocp_qp_xcond_solver.c:(.text+0x755):
undefined reference to `__imp___acrt_iob_func'
C:\Users\phman\Documents\repos\acados\examples\acados_matlab_octave\..\..\lib\acados.lib(sim_common.c.obj):sim_common.c:(.text+0x2a):
undefined reference to `__imp___acrt_iob_func'
C:\Users\phman\Documents\repos\acados\examples\acados_matlab_octave\..\..\lib\acados.lib(math.c.obj):math.c:(.text+0x25):
undefined reference to `__imp___acrt_iob_func'
C:\Users\phman\Documents\repos\acados\examples\acados_matlab_octave\..\..\lib\acados.lib(ocp_nlp_interface.c.obj):ocp_nlp_interface.c:(.text+0x2a):
more undefined references to `__imp___acrt_iob_func' follow
collect2.exe: error: ld returned 1 exit status


Error in ocp_compile_interface (line 176)
        mex(mex_flags, FLAGS, LDFLAGS, COMPDEFINES, COMPFLAGS, acados_include, acados_interfaces_include, external_include,
        blasfeo_include, hpipm_include,...

Error in acados_ocp (line 181)
                ocp_compile_interface(obj.opts_struct);

Error in minimal_example_ocp (line 108)
ocp = acados_ocp(ocp_model, ocp_opts);

The error is similar to what was discussed in this thread. However, I have tried disabling the external solvers like OSQP and QPoases without any improvement. I am at my wits end :slight_smile:
Further, I have seen that the cmake file includes a ACADOS_MATLAB option which is set to OFF by default. What does that do? I recompiled with the flag ON, but didn’t change anything.

System:

  • Windows 11 10.0.22621 Build 22621
  • Matlab R2021a

I have as well noticed, that the acados_env_variables_windows.m is missing in the up-to-date branch on github [here].

Thanks!
Philipp

Problem solved:

  • Didn’t read the docs carefully enough: Add the subfolders `bin` and `x86_64-w64-mingw32\bin`. only added the second one.
  • Additionally I had a msys2 installation on my system which could have interfered with the mingw from matlab. So I removed it. To find it use: where.exe mingw32-make.exe
2 Likes

Thanks for posting this, I had exactly the same issue. Now it’s running fine :slight_smile: