acados OCP code generation fails for steady-state nonlinear optimization

Hi everyone,

I am trying to implement a steady-state nonlinear optimization problem in MATLAB using acados on Windows (MATLAB R2024b, MinGW from MATLAB support package).

Problem for solving steady state optimization.

  • State: w = [x; u] with size nx + nu
    Terminal constraint

x_next = A * x + B1 * u + (B2 * kron(eye(nu), x)) * u + Bd*p;
con_h_expr_e = x - x_next ;

  • Terminal cost: cost_type_e = 'EXTERNAL'

cost_expr_ext_cost_e = -(g.’ * (Cg * C * x));

  • No horizon: N_horizon = 0 (solve only for steady state)

Solver options
solver_options.qp_solver = ‘FULL_CONDENSING_HPIPM’;
solver_options.hessian_approx = ‘EXACT’;
solver_options.integrator_type = ‘DISCRETE’;
solver_options.regularize_method = ‘MIRROR’;
solver_options.globalization = ‘MERIT_BACKTRACKING’;

the compilation step fails with the following error:

Error using AcadosOcpSolver/compile_ocp_shared_lib (line 686)
Building templated code as shared library failed.
Got status 2, result: [ 12%] Building C object CMakeFiles/ocp_KL_ss_model.dir/KL_ss_model_cost/KL_ss_model_cost_ext_cost_e_fun.c.obj
[ 25%] Building C object CMakeFiles/ocp_KL_ss_model.dir/KL_ss_model_cost/KL_ss_model_cost_ext_cost_e_fun_jac.c.obj
[ 37%] Building C object CMakeFiles/ocp_KL_ss_model.dir/KL_ss_model_cost/KL_ss_model_cost_ext_cost_e_fun_jac_hess.c.obj
[ 50%] Building C object CMakeFiles/ocp_KL_ss_model.dir/KL_ss_model_constraints/KL_ss_model_constr_h_e_fun.c.obj
[ 62%] Building C object CMakeFiles/ocp_KL_ss_model.dir/KL_ss_model_constraints/KL_ss_model_constr_h_e_fun_jac_uxt_zt.c.obj
[ 75%] Building C object CMakeFiles/ocp_KL_ss_model.dir/KL_ss_model_constraints/KL_ss_model_constr_h_e_fun_jac_uxt_zt_hess.c.obj
mingw32-make.exe[2]: *** [CMakeFiles\ocp_KL_ss_model.dir\build.make:154:
CMakeFiles/ocp_KL_ss_model.dir/KL_ss_model_constraints/KL_ss_model_constr_h_e_fun_jac_uxt_zt_hess.c.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:89: CMakeFiles/ocp_KL_ss_model.dir/all] Error 2
mingw32-make.exe: *** [Makefile:135: all] Error 2

Hi,

it seems like the code generation worked, but the compilation failed.
If you can share code to reproduce the issue, ideally as a minimal example, we can try to look into it.