This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I'm trying to use CMake to build my project and need some help. I've read the CMake wiki on cross compiling with a tool chain file and seen other people discussing in the forums using CMake, so I'm optimistic that is can be done.
My setup:
CCS v5.4.0 for ARM Cortext R (Hercules RM46)
Ubuntu Linux 12.04
CMake v2.8.12.1
To start, I'm trying to compile some c and asm files from HalCoGen into a library. I invoke CMake with the following results:
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=debug -DCMAKE_TOOLCHAIN_FILE=../RM46_CCS.cmake ..
-- The C compiler identification is TI 5.0.4
-- The CXX compiler identification is TI 5.0.4
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Configuring done
-- Generating done
-- Build files have been written to: /home/michael/ws/workspace/cmake_spike/_debug
When I invoke make, it compiles the c files, ignores the asm files, and tries to link with the following error message:
Linking C static library librm4.a
Error running link command: No such file or directory
If you look at my toolchain file (
set(CMAKE_SYSTEM_NAME Hercules_CCS) set(HERCULES_PATH /opt/ti/ccsv5/tools/compiler/arm_5.0.4) # specify the cross compiler set(CMAKE_C_COMPILER "${HERCULES_PATH}/bin/armcl") set(CMAKE_CXX_COMPILER ${CMAKE_C_COMPILER}) set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_COMPILER}) set(CMAKE_LINKER ${CMAKE_C_COMPILER}) set(CMAKE_STRIP "${HERCULES_PATH}/bin/armstrip") #ENABLE_LANGUAGE(ASM) set(CMAKE_AR "${HERCULES_PATH}/bin/armar") # skip compiler tests set(CMAKE_ASM_COMPILER_WORKS 1) set(CMAKE_C_COMPILER_WORKS 1) set(CMAKE_CXX_COMPILER_WORKS 1) set(CMAKE_DETERMINE_ASM_ABI_COMPILED 1) set(CMAKE_DETERMINE_C_ABI_COMPILED 1) set(CMAKE_DETERMINE_CXX_ABI_COMPILED 1) # set target environment set(CMAKE_FIND_ROOT_PATH ${HERCULES_PATH}) # Adjust the default behaviour of the FIND_XXX() commands: # - search programs in the target environment # - search headers and libraries in the target environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# This is a platform definition file for platforms without # operating system, typically embedded platforms. # It is used when CMAKE_SYSTEM_NAME is set to "Generic" # # It is intentionally empty, since nothing is known # about the platform. So everything has to be specified # in the system/compiler files ${CMAKE_SYSTEM_NAME}-<compiler_basename>.cmake # and/or ${CMAKE_SYSTEM_NAME}-<compiler_basename>-${CMAKE_SYSTEM_PROCESSOR}.cmake # (embedded) targets without operating system usually don't support shared libraries SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) # To help the find_xxx() commands, set at least the following so CMAKE_FIND_ROOT_PATH # works at least for some simple cases: SET(CMAKE_SYSTEM_INCLUDE_PATH ${HERCULES_PATH}/include ) SET(CMAKE_SYSTEM_LIBRARY_PATH ${HERCULES_PATH}/lib ) SET(CMAKE_SYSTEM_PROGRAM_PATH ${HERCULES_PATH}/bin )
Any help would be appreciated to get the asm files compiling and the linker working.
Thanks,
Mike
We at TI have no collateral related to cmake. If you search cmake in the forums (use the box up and to the right), you can find other discussions about it that look useful.
Thanks and regards,
-George
Update:
I got through the first linker problem and can now create a lib file and am trying to link the library with sys_main.c to create the executable. I don't know how to specify the linker command file and other linker options. I still can't turn ASM with out cmake segfaulting. Current toolchain file:
set(CMAKE_SYSTEM_NAME Generic) set(HERCULES_PATH "/opt/ti/ccsv5/tools/compiler/arm_5.0.4") # specify the cross compiler set(CMAKE_C_COMPILER "${HERCULES_PATH}/bin/armcl") set(CMAKE_CXX_COMPILER "${CMAKE_C_COMPILER}") set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}") #ENABLE_LANGUAGE(ASM) #set(CMAKE_AR "${HERCULES_PATH}/bin/armar") # skip compiler tests set(CMAKE_ASM_COMPILER_WORKS 1) set(CMAKE_C_COMPILER_WORKS 1) set(CMAKE_CXX_COMPILER_WORKS 1) set(CMAKE_DETERMINE_ASM_ABI_COMPILED 1) set(CMAKE_DETERMINE_C_ABI_COMPILED 1) set(CMAKE_DETERMINE_CXX_ABI_COMPILED 1) # Add the default include and lib directories for tool chain include_directories(${HERCULES_PATH}/include) link_directories(${HERCULES_PATH}/lib) # set target environment set(CMAKE_FIND_ROOT_PATH ${HERCULES_PATH}) # Adjust the default behaviour of the FIND_XXX() commands: # - search programs in the host environment # - search headers and libraries in the target environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Still would appreciate any help!
Mike