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.

Compiler/TMS320F28335: CMake project for C2000 compiler

Part Number: TMS320F28335

Tool/software: TI C/C++ Compiler

Hello,

I am trying to cross-compile a simple project using CMake. I have a set up a very simple project with one library and one executable. I want to compile the library and then link it in the executable.

Currently I'm having the problem that the library I'm creating doesn't export any symbols.

To test if what I am doing is correct, I first created a static library project and a executable project in CCS. All worked fine. In order for me to test the CMake generated library, I'm trying to link the CMake generated library with the executable from CCS, and I'm getting the error:

warning #10189-D: archive symbol directory is missing from archive "libprintTest.a"
 
 undefined               first referenced
  symbol                     in file     
 ---------               ----------------
 PrintTest::PrintTest()  ./main.obj      
 PrintTest::~PrintTest() ./main.obj      
 PrintTest::doIt()       ./main.obj      
 
error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "test.out" not built

Any ideas?

I have attached my CMake test project. To run it, you just have to have CMake installed (https://cmake.org

cd <proj_dir>/build
cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ..
make

The current compile output is:

-- CGT_TOOLCHAIN_DIR not explicitly set, using /Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS
-- The C compiler identification is TI 20.2.0
-- The CXX compiler identification is TI 20.2.0
-- Check for working C compiler: /Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/bin/cl2000
-- Check for working C compiler: /Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/bin/cl2000 - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/bin/cl2000
-- Check for working CXX compiler: /Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/bin/cl2000 - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Treat warning as errors is enabled
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/Rafa/Documents/workspace/cmakeTest/build
build Rafa$ make
/Applications/CMake.app/Contents/bin/cmake -S/Users/Rafa/Documents/workspace/cmakeTest -B/Users/Rafa/Documents/workspace/cmakeTest/build --check-build-system CMakeFiles/Makefile.cmake 0
/Applications/CMake.app/Contents/bin/cmake -E cmake_progress_start /Users/Rafa/Documents/workspace/cmakeTest/build/CMakeFiles /Users/Rafa/Documents/workspace/cmakeTest/build/CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f src/CMakeFiles/printTest.dir/build.make src/CMakeFiles/printTest.dir/depend
cd /Users/Rafa/Documents/workspace/cmakeTest/build && /Applications/CMake.app/Contents/bin/cmake -E cmake_depends "Unix Makefiles" /Users/Rafa/Documents/workspace/cmakeTest /Users/Rafa/Documents/workspace/cmakeTest/src /Users/Rafa/Documents/workspace/cmakeTest/build /Users/Rafa/Documents/workspace/cmakeTest/build/src /Users/Rafa/Documents/workspace/cmakeTest/build/src/CMakeFiles/printTest.dir/DependInfo.cmake --color=
Scanning dependencies of target printTest
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f src/CMakeFiles/printTest.dir/build.make src/CMakeFiles/printTest.dir/build
[ 25%] Building CXX object src/CMakeFiles/printTest.dir/printtest.cpp.obj
cd /Users/Rafa/Documents/workspace/cmakeTest/build/src && /Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/bin/cl2000 --compile_only --cpp_file=/Users/Rafa/Documents/workspace/cmakeTest/src/printtest.cpp  --include_path=/Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/include --include_path=/Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/include/stlport --include_path=/Users/Rafa/Documents/workspace/cmakeTest/src  -v28 -ml -mt --float_support=fpu32 -Ooff --advice:performance=all --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --c++03 -pdew   --output_file=CMakeFiles/printTest.dir/printtest.cpp.obj
[ 50%] Linking CXX static library libprintTest.a
cd /Users/Rafa/Documents/workspace/cmakeTest/build/src && /Applications/CMake.app/Contents/bin/cmake -P CMakeFiles/printTest.dir/cmake_clean_target.cmake
cd /Users/Rafa/Documents/workspace/cmakeTest/build/src && /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/printTest.dir/link.txt --verbose=1
/Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/bin/ar2000 -r libprintTest.a CMakeFiles/printTest.dir/printtest.cpp.obj
  ==>  new archive 'libprintTest.a'
  ==>  building archive 'libprintTest.a'
/usr/bin/ranlib libprintTest.a
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: warning for library: libprintTest.a the table of contents is empty (no object file members in the library define global symbols)
[ 50%] Built target printTest
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f example/CMakeFiles/printTestExample.dir/build.make example/CMakeFiles/printTestExample.dir/depend
cd /Users/Rafa/Documents/workspace/cmakeTest/build && /Applications/CMake.app/Contents/bin/cmake -E cmake_depends "Unix Makefiles" /Users/Rafa/Documents/workspace/cmakeTest /Users/Rafa/Documents/workspace/cmakeTest/example /Users/Rafa/Documents/workspace/cmakeTest/build /Users/Rafa/Documents/workspace/cmakeTest/build/example /Users/Rafa/Documents/workspace/cmakeTest/build/example/CMakeFiles/printTestExample.dir/DependInfo.cmake --color=
Scanning dependencies of target printTestExample
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f example/CMakeFiles/printTestExample.dir/build.make example/CMakeFiles/printTestExample.dir/build
[ 75%] Building CXX object example/CMakeFiles/printTestExample.dir/main.cpp.obj
cd /Users/Rafa/Documents/workspace/cmakeTest/build/example && /Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/bin/cl2000 --compile_only --cpp_file=/Users/Rafa/Documents/workspace/cmakeTest/example/main.cpp  --include_path=/Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/include --include_path=/Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/include/stlport --include_path=/Users/Rafa/Documents/workspace/cmakeTest/src  -v28 -ml -mt --float_support=fpu32 -Ooff --advice:performance=all --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --c++03 -pdew   --output_file=CMakeFiles/printTestExample.dir/main.cpp.obj
[100%] Linking CXX executable printTestExample
cd /Users/Rafa/Documents/workspace/cmakeTest/build/example && /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/printTestExample.dir/link.txt --verbose=1
/Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/bin/cl2000 --run_linker --output_file=printTestExample --map_file=printTestExample.map    --search_path=/Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/lib  --search_path=/Applications/ti/c2000/C2000Ware_3_01_00_00/device_support/f2833x/headers/cmd  --search_path=/Applications/ti/c2000/C2000Ware_3_01_00_00/device_support/f2833x/common/cmd  --library=F28335.cmd --library=DSP2833x_Headers_nonBIOS.cmd -llibc.a --library=printtest  --heap_size=0x100 --stack_size=0x300 --warn_sections --reread_libs --diag_wrap=off --display_error_number --rom_model CMakeFiles/printTestExample.dir/main.cpp.obj
<Linking>
error: cannot find file "printtest"
warning #10211-D: cannot resolve archive /Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/lib/libc.a to a compatible library, as no input files have been encountered
warning #10062-D: entry-point symbol "_c_int00" undefined
error #10010: errors encountered during linking; "printTestExample" not built

>> Compilation failure
make[2]: *** [example/printTestExample] Error 1
make[1]: *** [example/CMakeFiles/printTestExample.dir/all] Error 2
make: *** [all] Error 2

  • I have forgotten to add my project as attachment. It is now attached.

    cmakeTest.zip

  • I am not familiar with CMake, and I am not aware of any examples or other material from TI on how to integrate CMake and TI compiler tools.  

    But I do see two problems in this particular case.  One ...

    Rafael Andrioli Bauer1 said:
    /usr/bin/ranlib libprintTest.a

    Do not run ranlib over the library created by the ar2000 command.  

    Two, one of the arguments to the linker invocation is ...

    Rafael Andrioli Bauer1 said:
    --library=printtest

    This needs to be --library=libprintTest.a.  The TI ARM linker does not use the library naming conventions that GCC and other Unix-like linkers use.

    Thanks and regards,

    -George

  • Thank you very much for the quick reply.

    I have done the changes as you said and now the library is working as expected (I have tested by linking it in an executable generated in CSS), but I am not yet being able to create an executable from CMake. I am still looking at it, to try to figure it out why, but I can post it and maybe you have suggestion. I am getting the following output:

    Scanning dependencies of target printTest
    /Applications/Xcode.app/Contents/Developer/usr/bin/make -f src/CMakeFiles/printTest.dir/build.make src/CMakeFiles/printTest.dir/build
    [ 25%] Building CXX object src/CMakeFiles/printTest.dir/printtest.cpp.obj
    cd /Users/Rafa/Documents/workspace/cmakeTest/build/src && /Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/bin/cl2000 --compile_only --cpp_file=/Users/Rafa/Documents/workspace/cmakeTest/src/printtest.cpp  --include_path=/Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/include --include_path=/Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/include/stlport --include_path=/Users/Rafa/Documents/workspace/cmakeTest/src  -v28 -ml -mt --float_support=fpu32 -Ooff --advice:performance=all --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --c++03 -pdew   --output_file=CMakeFiles/printTest.dir/printtest.cpp.obj
    [ 50%] Linking CXX static library libprintTest.a
    cd /Users/Rafa/Documents/workspace/cmakeTest/build/src && /Applications/CMake.app/Contents/bin/cmake -P CMakeFiles/printTest.dir/cmake_clean_target.cmake
    cd /Users/Rafa/Documents/workspace/cmakeTest/build/src && /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/printTest.dir/link.txt --verbose=1
    /Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/bin/ar2000 -r libprintTest.a CMakeFiles/printTest.dir/printtest.cpp.obj
      ==>  new archive 'libprintTest.a'
      ==>  building archive 'libprintTest.a'
    [ 50%] Built target printTest
    /Applications/Xcode.app/Contents/Developer/usr/bin/make -f example/CMakeFiles/printTestExample.dir/build.make example/CMakeFiles/printTestExample.dir/depend
    cd /Users/Rafa/Documents/workspace/cmakeTest/build && /Applications/CMake.app/Contents/bin/cmake -E cmake_depends "Unix Makefiles" /Users/Rafa/Documents/workspace/cmakeTest /Users/Rafa/Documents/workspace/cmakeTest/example /Users/Rafa/Documents/workspace/cmakeTest/build /Users/Rafa/Documents/workspace/cmakeTest/build/example /Users/Rafa/Documents/workspace/cmakeTest/build/example/CMakeFiles/printTestExample.dir/DependInfo.cmake --color=
    Scanning dependencies of target printTestExample
    /Applications/Xcode.app/Contents/Developer/usr/bin/make -f example/CMakeFiles/printTestExample.dir/build.make example/CMakeFiles/printTestExample.dir/build
    [ 75%] Building CXX object example/CMakeFiles/printTestExample.dir/main.cpp.obj
    cd /Users/Rafa/Documents/workspace/cmakeTest/build/example && /Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/bin/cl2000 --compile_only --cpp_file=/Users/Rafa/Documents/workspace/cmakeTest/example/main.cpp  --include_path=/Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/include --include_path=/Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/include/stlport --include_path=/Users/Rafa/Documents/workspace/cmakeTest/src  -v28 -ml -mt --float_support=fpu32 -Ooff --advice:performance=all --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --c++03 -pdew   --output_file=CMakeFiles/printTestExample.dir/main.cpp.obj
    [100%] Linking CXX executable printTestExample
    cd /Users/Rafa/Documents/workspace/cmakeTest/build/example && /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/printTestExample.dir/link.txt --verbose=1
    /Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/bin/cl2000 --run_linker --output_file=printTestExample --map_file=printTestExample.map    --search_path=/Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/lib  --search_path=/Applications/ti/c2000/C2000Ware_3_01_00_00/device_support/f2833x/headers/cmd  --search_path=/Applications/ti/c2000/C2000Ware_3_01_00_00/device_support/f2833x/common/cmd  --library=F28335.cmd --library=DSP2833x_Headers_nonBIOS.cmd -llibc.a ../src/libprintTest.a  --heap_size=0x100 --stack_size=0x300 --warn_sections --reread_libs --diag_wrap=off --display_error_number --rom_model CMakeFiles/printTestExample.dir/main.cpp.obj
    <Linking>
    warning #10211-D: cannot resolve archive /Applications/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/lib/libc.a to a compatible library, as no input files have been encountered
    warning #10062-D: entry-point symbol "_c_int00" undefined
    [100%] Built target printTestExample
    /Applications/CMake.app/Contents/bin/cmake -E cmake_progress_start /Users/Rafa/Documents/workspace/cmakeTest/build/CMakeFiles 0
    

    Thank you very much and regards,

    Rafael

  • I have added another library to link against. It is the rts2800_fpu32.lib. It doesn't give any compiler or linking error any more. I will try to flash it in the microprocessor to check if it works.

  • A better solution is to move this linker input ...

    Rafael Andrioli Bauer1 said:
    -llibc.a

    ... to the very end of the linker invocation.  Then the linker automatically selects the best RTS library to use, based on the build attributes in the object files seen earlier in the link.

    Thanks and regards,

    -George