CMake Error while building DSpace cross compilation with acados Matlab

Hi :wave:
I am trying to cross-compile acados for DS1401 using the steps that are given in the acados page. I have executed the CMake command to build and I am getting the below error. I am using the following versions
Windows Matlab 2018b,
DSpace 2017-B
Cmake 3.26.1.

I have successfully build the acados and generated S-function for my application. If anyone find any leads, please let me know.

I tried setting the BLASFEO_TARGET to x64_automatic but still i get this error.

PS D:\SVN\acados> cd .\buildDS1401\
PS D:\SVN\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 - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/ProgramData/dSPACE/AD52223F-E7EC-4A16-97FB-8ADC3C426EE0/Compiler/PPCTools/bin/mccppc.exe
-- Check for working CXX compiler: C:/ProgramData/dSPACE/AD52223F-E7EC-4A16-97FB-8ADC3C426EE0/Compiler/PPCTools/bin/mccppc.exe - works
-- 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/AD52223F-E7EC-4A16-97FB-8ADC3C426EE0/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 [failed]
Compile output:
Change Dir: D:/SVN/acados/buildDS1401/compilerTest/GENERIC/CMakeFiles/CMakeTmp Run Build Command(s):C:/Program Files/CMake/bin/cmake.exe -E env VERBOSE=1 C:/PROGRA~1/DSPACE~3/Exe/DSMAKE.EXE -f Makefile cmTC_a23e4/fast && Building C object CMakeFiles/cmTC_a23e4.dir/isa_test.c.obj
Linking C static library cmTC_a23e4.lib
CMAKE_AR-NOTFOUND qc cmTC_a23e4.lib CMakeFiles/cmTC_a23e4.dir/isa_test.c.obj
Error running link command: Das System kann die angegebene Datei nicht finden OPUS MAKE: Shell line exit status 2. Stop. OPUS MAKE: Shell line exit status 3. Stop. 
CMake Error at external/blasfeo/cmake/TestSingleTarget.cmake:26 (message):
  Unable to compile with assembly for target GENERIC
Call Stack (most recent call first):
  external/blasfeo/CMakeLists.txt:375 (TestSingleTarget) 
-- Configuring incomplete, errors occurred!

Thanks and Regards
Raghu Boppana

Have you solved it ? I have the same problem when run “cmake -D CMAKE_TOOLCHAIN_FILE=…/cmake/Toolchain-dSPACEDS1202.cmake -G “Unix Makefiles” -S …/ -B ./”. Thanks!!

I suggest to use

set(BLASFEO_TARGET "GENERIC" CACHE STRING "BLASFEO Target architecture")
set(HPIPM_TARGET "GENERIC" CACHE STRING "HPIPM Target architecture")

This is also done in the toolchain file cmake/Toolchain-dSpaceDS1401.cmake.

Hi @FreyJo
Thank you for your prompt response.
As attached in the snapshot, I used the same default settings as GENERIC in the cmake/Toolchain-dSpaceDS1401.cmake . file(line 35,36) . But still, I am getting the error.

Linking C static library cmTC_a23e4.lib
CMAKE_AR-NOTFOUND qc cmTC_a23e4.lib CMakeFiles/cmTC_a23e4.dir/isa_test.c.obj
Error running link command: Das System kann die angegebene Datei nicht finden OPUS MAKE: Shell line exit status 2. Stop. OPUS MAKE: Shell line exit status 3. Stop. 
CMake Error at external/blasfeo/cmake/TestSingleTarget.cmake:26 (message):
  Unable to compile with assembly for target GENERIC

I am running this on my company desktop. As I am getting the above error, do you think I need to give any special permissions because the object file is not being found?

Please Let me know if you need any further information on this specific error.

Thanks and Regards
Raghu

@raghuboppana Is your toolchain file setting the variable CMAKE_CROSSCOMPILING (or setting the CMAKE_SYSTEM_NAME variable)? If it is, then the target detection shouldn’t be running.

To completely remove the target detection, you can include the CMake variable BLASFEO_CROSSCOMPILING=TRUE in your CMake invocation, which will forcefully disable it (this variable is normally set automatically from CMAKE_CROSSCOMPILING though).

1 Like

Hi @imcinerney
Thank you for your reply.

Yes In the tool chain file the CMAKE_SYSTEM_NAME variable is set like this

SET(CMAKE_SYSTEM_NAME "dSpaceDS1401")

So I tried I included BLASFEO_CROSSCOMPILING=TRUE in Cmake invocation as below

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

But still, I got the same error so I commented out the first line in Toolchain file and tried building again and it worked.

I followed the next step in workflow

cmake --build ./

Now I get new errors. In the first error, it is not finding the include files.

PS D:\SVN\acados\buildDS1401> cmake --build ./
[  1%] Building C object external/blasfeo/CMakeFiles/blasfeo.dir/auxiliary/blasfeo_stdlib.c.obj
(F) C0005; "D:\SVN\acados\external\blasfeo\auxiliary\blasfeo_stdlib.c", line 40 pos 28; could not open source file "blasfeo_stdlib.h"
  #include <blasfeo_stdlib.h>
                             ^
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 I started manually including the directories in .c files and then I get a different error as below.

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.

I hope you guys are able to follow my long post. I really appreciate if you have any suggestions to resolve these errors.

Regards
Raghu

1 Like

Hello Guys,

Does anyone have any idea about how to resolve this error? I tried different ways but I am still getting errors.
Thanks in advance.

Regards
Raghu

Hello @FreyJo

Do you think if you have any suggestions on this topic or no?

Thanks
Raghu

This is surely not the right way to get it cross compiled correctly.
Did you make sure to remove the CmakeCaches?

Unfortunately, I do not know what could be the issue.
The workflow worked for multiple other people.

Hello @FreyJo

Thank you for your reply. I just commented that line because as mentioned below I could not able to compile by adding BLASFEO_CROSSCOMPILING=TRUE in my CMake invocation. So I commented the CMAKE_SYSTEM_NAME line.

But I cleared my Caches and tried everything fresh but I get below error.

PS D:\SVN\acados\buildDS1401> cmake --build ./
[  1%] Building C object external/blasfeo/CMakeFiles/blasfeo.dir/auxiliary/blasfeo_stdlib.c.obj
(F) C0005; "D:\SVN\acados\external\blasfeo\auxiliary\blasfeo_stdlib.c", line 40 pos 28; could not open source file "blasfeo_stdlib.h"
  #include <blasfeo_stdlib.h>
                             ^
OPUS MAKE: Shell line exit status 1. Stop.
OPUS MAKE: Shell line exit status 3. Stop.
OPUS MAKE: Shell line exit status 3. Stop.

Let me know if you have any leads on this error.

Thanks and Regards
Raghu

Hi @raghuboppana
Have you got some idea about this issue? I met exactly the same error when I cross compiled Acados on my laptop. I also tried the approaches you said below and also met the new error as you stated. I found it has been one month since the topic was raised and could you tell me whether you get some idea about how to solve the problem?

Thanks in advance!