Building Issue ConfigurationDesk 2022-A

Hi :wave:

I am trying to use acados with the MABX III DS1403 dSPACE Release Version 2022-A and MATLAB Version 2021b. I used the getting started example (pendulum) and tried to implement it onto the MABX III. The Simulink simulation works fine. After code generation, I use the created .sic file as a model in ConfigurationDesk. I also added the libraries from the (buildDS1403\install\lib) path as well as the (buildDS1403\install\include) paths to the custom code (CustomLibraries/SearchPaths) in ConfigurationDesk for the build configuration. I need to build the model in ConfigurationDesk since my application is using all four cores of the MABX III, and therefore, I have four different models. During the build process (compiling the .c function), I get lots of errors. Most of them are:

acados_mex_create_pendulum.c: In function 'mexFunction':
acados_mex_create_pendulum.c:102:16: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 102 |     l_ptr[0] = (long long) nlp_plan;

main_mex_pendulum.c: In function 'mexFunction':
main_mex_pendulum.c:77:14: error: too few arguments to function 'pendulum_acados_create'
   77 |     status = pendulum_acados_create();

In file included from main_mex_pendulum.c:39:
acados_solver_pendulum.h:160:38: note: declared here
  160 | ACADOS_SYMBOL_EXPORT ocp_nlp_config *pendulum_acados_get_nlp_config(pendulum_solver_capsule * capsule);

main_pendulum.c: In function 'main':
main_pendulum.c:135:5: error: implicit declaration of function 'd_print_exp_tran_mat' [-Werror=implicit-function-declaration]
  135 |     d_print_exp_tran_mat( NX, N+1, xtraj, NX);

I have tried different toolchains, but all lead to the same issue. What I found out from dSPACE Support is that in 2022-A, a new compiler is being used (64-bit Linux-Compiler (GNU C/C++ Compiler Ver. 10.3)) compared to, for example, 2020-B (32-bit). Can this lead to the mentioned errors?
Also as mentioned on a different Topic ( Compiling Acados for Microautobox 3) the new compiler doesnt accept -J as a Flag therefore I used as mentioned in the topic -I.
The toolchain that I am using right now is:

SET(CMAKE_SYSTEM_NAME "dSpaceDS1403")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
SET(CMAKE_SYSTEM_PROCESSOR "ppc")

file(TO_CMAKE_PATH "C:/dSPACE_RCPHIL_2022A" DSPACE_TOOLS)
set(DSPACE_RTLIB "${DSPACE_TOOLS}/DS1403/Lib")
set(DSPACE_COMPILER "${DSPACE_TOOLS}/Compiler/Linux_4_14_GCC_10_3/target/arm-linux-gnueabihf")

# C Compiler
find_program(CMAKE_C_COMPILER NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-gcc.exe)
# C++ Compiler -- not used
find_program(CMAKE_CXX_COMPILER NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-g++.exe)
# Assembler
find_program(CMAKE_ASM_COMPILER NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-as.exe)
find_program(CMAKE_ASM_COMPILER NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-as.exe)
find_program(CMAKE_AR NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-ar.exe)
find_program(CMAKE_OBJCOPY NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-objcopy.exe)
set(CMAKE_RANLIB ":")

find_program(CMAKE_MAKE_PROGRAM NAMES "${DSPACE_TOOLS}/Exe/DSMAKE.exe")

SET(CMAKE_FIND_ROOT_PATH ${DSPACE_COMPILER}) 

# Compiler flags
##set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -H -I{DSPACE_RTLIB}")
##set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -H -I{DSPACE_RTLIB}")
##set(CMAKE_C_FLAGS "-D_INLINE" CACHE STRING "" FORCE)

# acados flags
set(BLASFEO_TARGET "GENERIC" CACHE STRING "BLASFEO Target architecture")
set(HPIPM_TARGET "GENERIC" CACHE STRING "HPIPM Target architecture")
set(BUILD_SHARED_LIBS OFF CACHE STRING "Build shared libraries")
set(BLASFEO_EXAMPLES OFF CACHE BOOL "Examples disabled")
set(EXT_DEP OFF CACHE BOOL "Compile external dependencies in BLASFEO")
set(ACADOS_INSTALL_DIR "install" CACHE PATH  "Installation path to ACADOS_INSTALL_DIR")


# import from platform folder
set(CMAKE_IMPORT_LIBRARY_PREFIX "")
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_SHARED_MODULE_PREFIX  "")
set(CMAKE_STATIC_LIBRARY_PREFIX "")

set(CMAKE_EXECUTABLE_SUFFIX     ".exe")
set(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".lib")
set(CMAKE_SHARED_MODULE_SUFFIX  ".lib")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")

SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

# set(CMAKE_C_FLAGS "\"-J${DSPACE_RTLIB}\"")

##set(CMAKE_INCLUDE_FLAG_C "-J")
##set(CMAKE_INCLUDE_FLAG_CXX "-J")

# add_definitions(-D__MABX2__)
##remove_definitions(-DLINUX)
##remove_definitions(-DOS_WINDOWS)
##remove_definitions(-D__LINUX__)

The different Toolchains that i have tried so far aswell are:

SET(CMAKE_SYSTEM_NAME "dSpaceDS1403")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
SET(CMAKE_SYSTEM_PROCESSOR "ppc")

file(TO_CMAKE_PATH "C:/dSPACE_RCPHIL_2022A" DSPACE_TOOLS)
set(DSPACE_RTLIB "${DSPACE_TOOLS}/DS1401/RTLib")
set(DSPACE_COMPILER "${DSPACE_TOOLS}/Compiler/Linux_4_14_GCC_10_3/target/arm-linux-gnueabihf")

# C Compiler
find_program(CMAKE_C_COMPILER NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-gcc.exe)
# C++ Compiler -- not used
find_program(CMAKE_CXX_COMPILER NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-g++.exe)
# Assembler
find_program(CMAKE_ASM_COMPILER NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-as.exe)
find_program(CMAKE_ASM_COMPILER NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-as.exe)
set(CMAKE_RANLIB ":")

find_program(CMAKE_MAKE_PROGRAM NAMES "${DSPACE_TOOLS}/Exe/DSMAKE.exe")

SET(CMAKE_FIND_ROOT_PATH ${DSPACE_COMPILER}) 

# Compiler flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -H -I{DSPACE_RTLIB}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -H -I{DSPACE_RTLIB}")
set(CMAKE_C_FLAGS "-D_INLINE" CACHE STRING "" FORCE)

# acados flags
set(BLASFEO_TARGET "GENERIC" CACHE STRING "BLASFEO Target architecture")
set(HPIPM_TARGET "GENERIC" CACHE STRING "HPIPM Target architecture")
set(BUILD_SHARED_LIBS OFF CACHE STRING "Build shared libraries")
set(BLASFEO_EXAMPLES OFF CACHE BOOL "Examples disabled")
set(EXT_DEP OFF CACHE BOOL "Compile external dependencies in BLASFEO")
set(ACADOS_INSTALL_DIR "install" CACHE PATH  "Installation path to ACADOS_INSTALL_DIR")


# import from platform folder
set(CMAKE_IMPORT_LIBRARY_PREFIX "")
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_SHARED_MODULE_PREFIX  "")
set(CMAKE_STATIC_LIBRARY_PREFIX "")

set(CMAKE_EXECUTABLE_SUFFIX     ".exe")
set(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".lib")
set(CMAKE_SHARED_MODULE_SUFFIX  ".lib")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")

SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

# set(CMAKE_C_FLAGS "\"-J${DSPACE_RTLIB}\"")

set(CMAKE_INCLUDE_FLAG_C "-J")
set(CMAKE_INCLUDE_FLAG_CXX "-J")

# add_definitions(-D__MABX2__)
remove_definitions(-DLINUX)
remove_definitions(-DOS_WINDOWS)
remove_definitions(-D__LINUX__)

Thanks in advance for any support and Greetings
Sören

Hi Sören,

The errors you report seem very unrelated to the target hardware.
I think you include this main MEX file, which is outdated and should no be used anymore as far as I understand.
I made a PR to remove it here: Remove main mex template by FreyJo · Pull Request #1149 · acados/acados · GitHub

Best,
Jonathan

Hi Jonathan,

thanks for the reply and the help. I included only the C files listed in make_sfun.m and make_sfun_sim.m in ConfigurationDesk. As you predicted, the original error disappeared, but now I am encountering a new error when compiling the model via ConfigurationDesk:

fatal error: simstruc.h: No such file or directory

Currently, my Custom Code settings in ConfigurationDesk are as follows:

Search Paths:

C:\acados\buildDS1403\install\include; C:\acados\buildDS1403\install\include\blasfeo\include; C:\acados\buildDS1403\install\include\hpipm\include

Custom Source Files:

C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\acados_sim_solver_sfunction_pendulum.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\acados_sim_solver_pendulum.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\pendulum_model\pendulum_expl_ode_fun.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\pendulum_model\pendulum_expl_vde_forw.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\pendulum_model\pendulum_expl_vde_adj.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\pendulum_model\pendulum_expl_ode_fun.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\pendulum_model\pendulum_expl_vde_forw.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\pendulum_constraints\pendulum_constr_h_0_fun.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\pendulum_constraints\pendulum_constr_h_0_fun_jac_uxt_zt_hess.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\pendulum_constraints\pendulum_constr_h_0_fun_jac_uxt_zt.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\acados_solver_sfunction_pendulum.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\acados_solver_pendulum.c

Include Directories:

C:\acados\buildDS1403\install\lib\libacados.a; C:\acados\buildDS1403\install\lib\libblasfeo.a; C:\acados\buildDS1403\install\lib\libhpipm.a

I attempted to include C:\Program Files\MATLAB\R2021b\simulink\include, hoping to resolve the issue, but this resulted in a different error:

fatal error: rtwtypes.h: No such file or directory

I suspect this new error might be related to ConfigurationDesk/dSpace and not acados, since i think dSpace should include the necessary directories for S-Functions automatically. Therfore I have contacted their support too, lets see if I get an awnser. As soon as i solve the issue I will update this topic, maybe this might help someone else aswell.

Greetings Sören

1 Like

Hi,

Here’s an update on the topic, as I received a response from dSpace. The issue was that the S-functions (acados_solver_sfunction_pendulum.c / acados_sim_solver_sfunction_pendulum.c) are already built when compiling the model with Simulink. Therefore, they do not need to be included in the Custom Source Files in ConfigurationDesk. This solved the issue, and the model compiled successfully in ConfigurationDesk. The next steps will be to implement it on the DS1403 MABXIII and see if it works.

For those interested, here are the settings I used:

In Simulink settings, I didn’t add anything under custom code or additional build information. In ConfigurationDesk, I used the following settings for the build configuration:
Search Paths:

C:\acados\buildDS1403\install\include; C:\acados\buildDS1403\install\include\blasfeo\include; C:\acados\buildDS1403\install\include\hpipm\include

Custom Source Files:

C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\acados_sim_solver_pendulum.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\pendulum_model\pendulum_expl_ode_fun.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\pendulum_model\pendulum_expl_vde_forw.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\pendulum_model\pendulum_expl_vde_adj.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\pendulum_model\pendulum_expl_ode_fun.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\pendulum_model\pendulum_expl_vde_forw.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\pendulum_constraints\pendulum_constr_h_0_fun.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\pendulum_constraints\pendulum_constr_h_0_fun_jac_uxt_zt_hess.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\pendulum_constraints\pendulum_constr_h_0_fun_jac_uxt_zt.c; C:\acados\examples\acados_matlab_octave\getting_started\c_generated_code\acados_solver_pendulum.c

Include Directories:

C:\acados\buildDS1403\install\lib\libacados.a; C:\acados\buildDS1403\install\lib\libblasfeo.a; C:\acados\buildDS1403\install\lib\libhpipm.a

Greetings Sören

1 Like

Hi Sören,

I currently try to implement an MPC on a MicroAutoBox III.

I am having Issues with the build step in ConfigurationDesk and am a bit stuck.

I have created a thread in the Forum: Cimpiling Error for MicroAutoBox III

Maybe you can take a look at it.

Any help would be highly appreciated : )

Thanks

Jannis