Problem with cross-compiling of acados for DS1401

Hi

I’m using Matlab 2018B and my final goal is to create a S-function for a MicroAutobox II (DS1401). However from what I understand from the documentations I firstly need to cross compile acados for DS1401.
I have already follow this thread Updated workflow for DS1401 - MicroAutoBox-II by FreyJo · Pull Request #723 · acados/acados · GitHub and read the last document acados/index.md at master · acados/acados · GitHub here.
In particular, as it is written in the documentation, I skip the step " Define environment variables used within the toolchain file, currently only required for DS1202 " but when I try to execute the command :
cmake -D CMAKE_TOOLCHAIN_FILE=…/cmake/Toolchain-dSPACEDS1401.cmake -G “Unix Makefiles” -S …/ -B ./
it returns me the error:

– The C compiler identification is unknown
– The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:42 (project):
The CMAKE_C_COMPILER:

QNX_HOST-NOTFOUND/usr/bin/ntoppc-gcc.exe

is not a full path and was not found in the PATH.

Tell CMake where to find the compiler by setting either the environment
variable “CC” or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.

CMake Error at CMakeLists.txt:42 (project):
The CMAKE_CXX_COMPILER:

QNX_HOST-NOTFOUND/usr/bin/ntoppc-c++.exe

is not a full path and was not found in the PATH.

Tell CMake where to find the compiler by setting either the environment
variable “CXX” or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.

– Configuring incomplete, errors occurred!
See also “D:/Acados/acados/buildDS1401/CMakeFiles/CMakeOutput.log”.
See also “D:/Acados/acados/buildDS1401/CMakeFiles/CMakeError.log”.

Thanks you for the help,
Giulio

Hi Giulio,

I think something went wrong when using the pull request. It is necessary to use the code of the pull request. Your error log says something about “QNX_HOST…”. This ist part of the Toolchain file for the DS1202 (please compare the toolchain files for the DS1401 in the pull request and in the main acados path, they are different). If you want to get the pull request locally, you can use the following git commands:

  1. Clone Acados
    a. git clone https://github.com/acados/acados.git

  2. Get Updated workflow for DS1401 - MicroAutoBox-II by FreyJo · Pull Request #723 · acados/acados · GitHub locally (in Acados folder)
    a. git fetch origin pull/723/head:pr723
    b. git checkout pr723

Best regards
Björn

Hi Bjorn,
first of all thanks for the quick response.
Actually, I have already check the toolchain file (the one in my local computer - properly modified in the image below) and the one in the pull request that you suggest me.
However, when I lunch the commmand : cmake -D CMAKE_TOOLCHAIN_FILE=…/cmake/Toolchain-dSPACEDS1401.cmake -G “Unix Makefiles” -S …/ -B ./ , from the error returned in the shell, it seems that one CMakeList file tries to find the path defined for DS1202.
Have you any other suggestions?
Thanks you in advance,
GIulio

Hi Giulio,

I don’t know why this happens, but maybe you can just copy the correct code in the DS1202 toolchain file or delete this file to check if it is really this file beeing used.

Best regards
Björn

Hi Bjorn,
as always thanks you for the reply :slight_smile:
As you suggest me, removing the Toolchain file for the DS1202 I notice that it recalled that file. For that reason i deleted all the folder “buildDS1401” , launching the cmake command.
Now the error is the following:

D:\Acados\acados\buildDS1401>cmake -D CMAKE_TOOLCHAIN_FILE=…/cmake/Toolchain-dSPACEDS1401.cmake -G “Unix Makefiles” -S …/ -B ./
– The C compiler identification is unknown
– The CXX compiler identification is unknown
– Detecting C compiler ABI info
– Detecting C compiler ABI info - failed
– Check for working C compiler: C:/ProgramData/dSPACE/AD52223F-E7EC-4A16-97FB-8ADC3C426EE0/Compiler/PPCTools/bin/mccppc.exe
– Check for working C compiler: C:/ProgramData/dSPACE/AD52223F-E7EC-4A16-97FB-8ADC3C426EE0/Compiler/PPCTools/bin/mccppc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:69 (message):

  • The C compiler*

  • “C:/ProgramData/dSPACE/AD52223F-E7EC-4A16-97FB-8ADC3C426EE0/Compiler/PPCTools/bin/mccppc.exe”*

  • is not able to compile a simple test program.*

  • It fails with the following output:*

  • Change Dir: D:/Acados/acados/buildDS1401/CMakeFiles/CMakeTmp*

  • Run Build Command(s):D:/Programs/dSPACE RCPHIL 2018-B/Exe/DSMAKE.EXE -f Makefile cmTC_fa976/fast && ‘D:/Programs/dSPACE’ is not recognized as an internal or external command,*

  • operable program or batch file.*

  • OPUS MAKE: Shell line exit status 1. Stop.*

  • CMake will not be able to correctly generate this project.*
    Call Stack (most recent call first):

  • CMakeLists.txt:42 (project)*

– Configuring incomplete, errors occurred!
See also “D:/Acados/acados/buildDS1401/CMakeFiles/CMakeOutput.log”.
See also “D:/Acados/acados/buildDS1401/CMakeFiles/CMakeError.log”.

Of course I have already check that the file mccppc.exe exists, but i’m not very familiar with this type of problem. Any other suggestion ?
Thanks you (as always) in advance,
Giulio

Hi Giulio,

I did not have this error… I am not sure what you could try next, sorry.

If you make progress and get a new error, do not hesitate to ask again :slight_smile:

Best regards
Björn

Hi Bjorn,
I have a question for you: what version of Matlab & dSPACE are you using?
I really don’t understand from where the problem can came from.
Thanks in advance for the patience :slight_smile: :pray:
Giulio

Hi Giulio,

I use the following program versions:
MATLAB R2017b
dSpace 2018b
CMake 3.19.4

Best regards
Björn

Hi @gibor

were you able to solve this? I managed to compile it yesterday with some help of @FreyJo , feel free to bug me about this. I am happy to help.

Cheers,
Alex

I Alex !
Yesterday I finally managed to cross compile acados and then compile my s function for DS1401! :smiley: Soon I will start doing some banchmarking of its performance on the dspace!
Thanks for your time and we keep in touch! :slight_smile:

1 Like

Awesome, happy to hear!
Feel free to share results. :slight_smile:

Alex

Hi,@gibor @AlexWin @bmasterk

In the first step, I finished cross compiling and compile my s function for DS1401:
image

but when I download into the dspace by control desk,it cannot run in hardware:

image

I don’t know how to find the problem.

Thanks in advance for the patience.

Best regards
Gaofei

Hi Gaofei,
I still couldn’t upload the code into dspace/control desk. I will let you know if I have the same problem.
Giulio

Thanks. I hope you can run smoothly.

Hi gibor. It’s happy to hear your success. I meet the similar problem when cross-compile acados for dspace 1401. The versions are Matlab 2016b, dspace 2017 A, and cmake 3.23.1 respectively.
When I run the command " D:\acados_root_folder\buildDS1401> cmake -D CMAKE_TOOLCHAIN_FILE=…/cmake/Toolchain-dSPACEDS1401.cmake -G “MinGW Makefiles” -S …/ -B ./" in the powershell of windows, I get the similar error:
The C compiler identification is unknown
– The CXX compiler identification is unknown …(and so on)
When I run the command “D:\acados_root_folder\buildDS1401> cmake -D CMAKE_TOOLCHAIN_FILE=…/cmake/Toolchain-dSPACEDS1401.cmake -G “Unix Makefiles” -S …/ -B ./” in the powershell of windows, I get the following error:
CMake Error: CMake was unable to find a build program corresponding to “Unix Makefiles”. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
– Configuring incomplete, errors occurred!
Do you have any idea about this error? Thanks you in advance

Hi AlexWin. It’s happy to hear your success. I meet the some problem when cross-compile acados for dspace 1401. The versions are Matlab 2016b, dspace 2017 A, and cmake 3.23.1 respectively.
When I run the command " D:\acados_root_folder\buildDS1401> cmake -D CMAKE_TOOLCHAIN_FILE=…/cmake/Toolchain-dSPACEDS1401.cmake -G “MinGW Makefiles” -S …/ -B ./" in the powershell of windows, I get the similar error:
The C compiler identification is unknown
– The CXX compiler identification is unknown …(and so on)
When I run the command “D:\acados_root_folder\buildDS1401> cmake -D CMAKE_TOOLCHAIN_FILE=…/cmake/Toolchain-dSPACEDS1401.cmake -G “Unix Makefiles” -S …/ -B ./” in the powershell of windows, I get the following error:
CMake Error: CMake was unable to find a build program corresponding to “Unix Makefiles”. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
– Configuring incomplete, errors occurred!
Do you have any idea about this error? Thanks you in advance

Hi hanyu,

Did you adjust the compilers in the Toolchain file, like it is stated in the embedded workflow on the acados webpage?
You have to point to the right MABX power pc compilers. Please check all paths in the Toolchain file.
Let me know if you have made any progress!
There might be an actual problem with some kernel code of blasfeo with the latest acados release. But you definitely should be able to compile and buuikd the model.
If you encounter any errors when uploading to MABX, reset acados to a former release (September 2021) with "git reset --hard “commit sha” " commit sha is from the commit on the acados GitHub page. Then do a “git submodule Update” and redo the cross compilation.

Cheers, Alex

Thanks for your patience. I have checked the compiler in the Toolchain file as the stated in acados webpage. Then run the command:“D:\acados_root_folder\buildDS1401> cmake -D CMAKE_TOOLCHAIN_FILE=…/cmake/Toolchain-dSPACEDS1401.cmake -G “Unix Makefiles” -S …/ -B ./” in the windows powershell, I get the following message:


– The C compiler identification is unknown
– The CXX compiler identification is unknown
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: C:/Program Files/dSPACE RCPHIL 2017-A/Compiler/PPCTools/bin/mccppc.exe - skipped
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: C:/Program Files/dSPACE RCPHIL 2017-A/Compiler/PPCTools/bin/mccppc.exe - skipped
– Build type is Release
– ACADOS_WITH_OPENMP: OFF
– The ASM compiler identification is unknown
– Found assembler: C:/Program Files/dSPACE RCPHIL 2017-A/Compiler/PPCTools/bin/asmppc.exe
– Warning: Did not find file Compiler/-ASM
– Using linear algebra: HIGH_PERFORMANCE
– Using matrix format: PANELMAJ
– Using external BLAS: 0
– Testing target GENERIC: assembly compilation [success]
– Testing target GENERIC: intrinsic compilation [success]
– Compiling for target: GENERIC
– Using BLASFEO path:
– Installation directory: install

– Target: BLASFEO is GENERIC, HPIPM is GENERIC
– Linear algebra: HIGH_PERFORMANCE
– Matlab MEX (OFF)
– Octave MEX (OFF)
– Octave Templates (OFF)
– System name:version dSpaceDS1401:
– Build type is Release
– Installation directory is install
– OpenMP parallelization is OFF

– Configuring done
– Generating done
– Build files have been written to: D:/acados_root_folder/buildDS1401


I googled why the cmake shows " The C compiler identification is unknown", and get answers that I need to install Windows 10 SDK in my visual studio 2017. I have tried this solution, but it turns out not to help. And I can compile and build acados model in Matlab.
Thanks in advance for your kindness and patience!

Hey everyone,

I have a similar problem while trying to cross-compile acados for DS1401 and i can’t find the fault. The Installation of acados worked without any problems and I was able to solve acados optimization problems in Matlab as well using the S-Function in Simulink.
Can someone please help me? I am almost in dispair…

First, I adapted the Toolchain-dSpaceDS1401 cmake-file as follows:

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

# TODO: cmake_path instead?
# cmake_path(CONVERT "C:\\ProgramData\\dSPACE\\AD52223F-E7EC-4A16-97FB-8ADC3C426EE0\\Compiler\\PPCTools" TO_CMAKE_PATH_LIST DSPACE_DS1401_COMPILER_DIR NORMALIZE)
# 
file(TO_CMAKE_PATH "C:/ProgramData/dSPACE/7290F786-B6F7-4BA3-9178-C21B0382F310" DSPACE_TOOLS)
set(DSPACE_RTLIB "C:/Program Files/dSPACE RCPHIL 2021-A/DS1401/RTLib")
set(DSPACE_PPCTOOLS "${DSPACE_TOOLS}/Compiler/PPCTools")

# C Compiler
find_program(CMAKE_C_COMPILER NAMES ${DSPACE_PPCTOOLS}/bin/mccppc.exe)
# C++ Compiler -- not used
find_program(CMAKE_CXX_COMPILER NAMES ${DSPACE_PPCTOOLS}/bin/mccppc.exe)
# Assembler
find_program(CMAKE_ASM_COMPILER NAMES ${DSPACE_PPCTOOLS}/bin/asmppc.exe)
set(CMAKE_RANLIB ":")

find_program(CMAKE_MAKE_PROGRAM NAMES "C:/Program Files/dSPACE RCPHIL 2021-A/Exe/DSMAKE.EXE")

SET(CMAKE_FIND_ROOT_PATH ${DSPACE_PPCTOOLS}) 
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

add_definitions(-D__MABX2__ -D__DSPACE__)

# Compiler flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -H -J{DSPACE_RTLIB}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -H -J{DSPACE_RTLIB}")
set(CMAKE_C_FLAGS "-Ot -Oi -Or -Ox -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_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__)

After running the cmake command

cmake -D CMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-dSpaceDS1401.cmake -G "Unix Makefiles" -S ../ -B ./

I get the following output - I think it’s the same which hy_lyy got :

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/ProgramData/dSPACE/7290F786-B6F7-4BA3-9178-C21B0382F310/Compiler/PPCTools/bin/mccppc.exe - skipped
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/ProgramData/dSPACE/7290F786-B6F7-4BA3-9178-C21B0382F310/Compiler/PPCTools/bin/mccppc.exe - skipped
-- Build type is Release
-- ACADOS_WITH_OPENMP: OFF
CMake Deprecation Warning at external/blasfeo/CMakeLists.txt:36 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The ASM compiler identification is unknown
-- Found assembler: C:/ProgramData/dSPACE/7290F786-B6F7-4BA3-9178-C21B0382F310/Compiler/PPCTools/bin/asmppc.exe
-- Warning: Did not find file Compiler/-ASM
-- Using linear algebra: HIGH_PERFORMANCE
-- Using matrix format: PANELMAJ
-- Using external BLAS: 0
-- Testing target GENERIC: assembly compilation [success]
-- Testing target GENERIC: intrinsic compilation [success]
-- Compiling for target: GENERIC
CMake Deprecation Warning at external/hpipm/CMakeLists.txt:36 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Using BLASFEO path:
-- Installation directory: install
--
-- Target: BLASFEO is GENERIC, HPIPM is GENERIC
-- Linear algebra: HIGH_PERFORMANCE
-- Matlab MEX (OFF)
-- Octave MEX (OFF)
-- Octave Templates (OFF)
-- System name:version dSpaceDS1401:
-- Build type is Release
-- Installation directory is install
-- OpenMP parallelization is OFF
--
-- Configuring done
-- Generating done
-- Build files have been written to: .../acados/buildDS1401

I don’t know if this is really an error, as I don’t know how this output should look like. But for me it seems like the compiler cannot be found or is incompatible. But the path to the PPCTools compiler is definitely correct.
However, when I run the next command from the Embedded Workflow instructions, I receive the following error:

PS ...\acados\buildDS1401> cmake --build ./
Scanning dependencies of target blasfeo
[  1%] Building C object external/blasfeo/CMakeFiles/blasfeo.dir/auxiliary/blasfeo_processor_features.c.obj
[  1%] Building C object external/blasfeo/CMakeFiles/blasfeo.dir/auxiliary/blasfeo_stdlib.c.obj
(E) C0513; "...\acados\external\blasfeo\auxiliary\blasfeo_stdlib.c", line 59 pos 7; a value of type "int" cannot be assigned to an entity of type "void *"
        *ptr = _aligned_malloc( size, CACHE_LINE_SIZE );
             ^

1 Error     2 Informationals (2 suppressed)

OPUS MAKE: Shell line exit status 1. Stop.

OPUS MAKE: Shell line exit status 3. Stop.

OPUS MAKE: Shell line exit status 3. Stop.

So if any of you did have the same errors and solved them or can tell me more about the errors, please help me. I would be very thankful!

Thanks in advance,
Jasper

Hi @jasper_fr and @hy_lyy ,

@FreyJo and me were thoroughly testing the dSPACE Toolchain with the newest acados release and were fixing some memory alignment and cmake errors, whose fixes have been now pushed to the main. Can you pull the latest acados and retry?

@hy_lyy this message is totally normal. Just continue with the build then and try that one! It actually looks good.

FYI: The MABX2 is like 20 times slower than my i7 laptop CPU.

let me now if you have any problem,
Alex

1 Like