crosscompile for armclang

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

crosscompile for armclang

Martin Herrmann
Hi,
currently I am working with cmake 3.9.0 on windows 10.
I want to use cmake to crosscompile some C sources with armclang.
The wiki page contains a section called "The toolchain file" (see https://cmake.org/Wiki/CMake_Cross_Compiling).
My toolchain file looks as follows:
SET(CMAKE_SYSTEM_NAME Generic)     # Target is an embedded system without OS
SET(CMAKE_SYSTEM_PROCESSOR arm)    # The name of the cpu cmake is building for ARM
SET(CMAKE_C_COMPILER "C:/Program Files/ARMCompiler6.6.1/bin/armclang.exe")
SET(CMAKE_CXX_COMPILER "C:/Program Files/ARMCompiler6.6.1/bin/armclang.exe")
SET(CMAKE_ASM_COMPILER "C:/Program Files/ARMCompiler6.6.1/bin/armasm.exe")
SET(CMAKE_LINKER "C:/Program Files/ARMCompiler6.6.1/bin/armlink.EXE")
SET(FROMELF "C:/Program Files/ARMCompiler6.6.1/bin/fromelf.EXE")

The cmake execution leads to the following output:
==================================================================================================
A subdirectory or file CMakeMakefile already exists.
-- The C compiler identification is unknown
-- The ASM compiler identification is ARMCC
-- Found assembler: C:/Program Files/ARMCompiler6.6.1/bin/armasm.exe
-- Check for working C compiler: C:/Program Files/ARMCompiler6.6.1/bin/armclang.exe
-- Check for working C compiler: C:/Program Files/ARMCompiler6.6.1/bin/armclang.exe -- broken
...
 
  armclang.exe: fatal error: no target architecture given; use
  --target=arm-arm-none-eabi or --target=aarch64-arm-none-eabi
...

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

-- Configuring incomplete, errors occurred!
See also "CMakeMakefile/CMakeFiles/CMakeOutput.log".
See also "CMakeMakefile/CMakeFiles/CMakeError.log".
==================================================================================================

The CMakeError.log looks as follows:
==================================================================================================
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/Program Files/ARMCompiler6.6.1/bin/armclang.exe
Build flags:
Id flags:  
The output was:
1
armclang.exe: fatal error: no target architecture given; use --target=arm-arm-none-eabi or --target=aarch64-arm-none-eabi

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/Program Files/ARMCompiler6.6.1/bin/armclang.exe
Build flags:
Id flags: -c
The output was:
1
armclang.exe: fatal error: no target architecture given; use --target=arm-arm-none-eabi or --target=aarch64-arm-none-eabi

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/Program Files/ARMCompiler6.6.1/bin/armclang.exe
Build flags:
Id flags: -Aa
The output was:
1
armclang.exe: fatal error: no target architecture given; use --target=arm-arm-none-eabi or --target=aarch64-arm-none-eabi

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/Program Files/ARMCompiler6.6.1/bin/armclang.exe
Build flags:
Id flags: -D__CLASSIC_C__
The output was:
1
armclang.exe: fatal error: no target architecture given; use --target=arm-arm-none-eabi or --target=aarch64-arm-none-eabi

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/Program Files/ARMCompiler6.6.1/bin/armclang.exe
Build flags:
Id flags:  
The output was:
1
armclang.exe: fatal error: no target architecture given; use --target=arm-arm-none-eabi or --target=aarch64-arm-none-eabi

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/Program Files/ARMCompiler6.6.1/bin/armclang.exe
Build flags:
Id flags: -c
...
==================================================================================================
The compiler identification seems to fail.

Further on I was checking the possibility of "CMakeForceCompiler". But for version 3.9 this option is deprecated
(see https://cmake.org/cmake/help/v3.9/module/CMakeForceCompiler.html?highlight=cmakeforcecompiler)
The CMAKE_TRY_COMPILE_TARGET_TYPE was instead recommended.
In my case neither set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) nor set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE) was working.
The error message was still the same.
Can you give me some advice?
How can I switch of the compiler checks?
Thanks a lot for your help.
Best regards.

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake