1

I have a C project, which supports many platforms. Its generator has Borland Makefiles, NMake Makefiles, MSVC 6, 7, 8, 9, 11, Eclipse CDT4 ‐ Unix Makefiles etc. I have generated MSVC 9 solution with cmake on Windows 7. It is OK.

Now, I would like to generate ARM Cortex A8 project on TI Sitara SDK, of the above C project. The TI Sitara SDK is installed on Ubuntu 14.04 OS host computer. There is a cross-compiling tool chain: Linaro on Ubuntu PC.

From the original C project document, it looks like below selection is appropriate for Sitara SDK because it uses Eclipse (but it has 8.1.1 on its help window, higher than CDT4)

Eclipse CDT4 ‐ Unix Makefiles
                              = Generates Eclipse CDT 4.0 project files.

I have set compiler path:

export CMAKE_C_COMPILER=/home/u64rj/ti-processor-sdk-linux-am335x-evm-01.00.00.03/linux-devkit/sysroots/i686-arago-linux/usr/bin/arm-linux-gnueabihf-gcc

export CMAKE_ECLIPSE_VERSION=4.2

When I run cmake, there are still such errors:

u64rj@u64rj-MS-7696:~/u64rj-Fixed/sdk-2-src$ cmake -G "Eclipse CDT4 - Unix Makefiles" -DBUILD=LINUX-ARMv7a -DCFG=Debug -DMATH=I32
-- CMAKE SCRIPTS VERSION 1.1.1.0
CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:90 (file):
  file Internal CMake error when trying to open file:
  /home/u64rj-Fixed/sdk-2-src/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c
  for writing.
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:100 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
  /usr/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:39 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /usr/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake:131 (CMAKE_DETERMINE_COMPILER_ID)
  common-build/cmake/sdk-project-include.cmake:1189 (project)
  CMakeLists.txt:4 (SDK_PROJECT)


CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:90 (file):
  file Internal CMake error when trying to open file:
  /home/u64rj-Fixed/sdk-2-src/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c
  for writing.
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:100 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
  /usr/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:39 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /usr/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake:131 (CMAKE_DETERMINE_COMPILER_ID)
  common-build/cmake/sdk-project-include.cmake:1189 (project)
  CMakeLists.txt:4 (SDK_PROJECT)


CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:90 (file):
  file Internal CMake error when trying to open file:
  /home/u64rj-Fixed/sdk-2-src/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c
  for writing.
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:100 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
  /usr/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:39 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /usr/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake:131 (CMAKE_DETERMINE_COMPILER_ID)
  common-build/cmake/sdk-project-include.cmake:1189 (project)
  CMakeLists.txt:4 (SDK_PROJECT)


-- The C compiler identification is unknown
CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:90 (file):
  file Internal CMake error when trying to open file:
  /home/u64rj-Fixed/sdk-2-src/CMakeFiles/2.8.12.2/CompilerIdCXX/CMakeCXXCompilerId.cpp
  for writing.
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:100 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
  /usr/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:39 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /usr/share/cmake-2.8/Modules/CMakeDetermineCXXCompiler.cmake:127 (CMAKE_DETERMINE_COMPILER_ID)
  common-build/cmake/sdk-project-include.cmake:1189 (project)
  CMakeLists.txt:4 (SDK_PROJECT)


CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:90 (file):
  file Internal CMake error when trying to open file:
  /home/u64rj-Fixed/sdk-2-src/CMakeFiles/2.8.12.2/CompilerIdCXX/CMakeCXXCompilerId.cpp
  for writing.
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:100 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
  /usr/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:39 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /usr/share/cmake-2.8/Modules/CMakeDetermineCXXCompiler.cmake:127 (CMAKE_DETERMINE_COMPILER_ID)
  common-build/cmake/sdk-project-include.cmake:1189 (project)
  CMakeLists.txt:4 (SDK_PROJECT)


-- The CXX compiler identification is unknown
-- Could not determine Eclipse version, assuming at least 3.6 (Helios). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.
-- Check for working C compiler: /home/u64rj-Fixed/sdk-2-src/arm-linux-gnueabihf-gcc
CMake Error: your C compiler: "/home/u64rj-Fixed/sdk-2-src/arm-linux-gnueabihf-gcc" was not found.   Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Check for working C compiler: /home/u64rj-Fixed/sdk-2-src/arm-linux-gnueabihf-gcc -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler
  "/home/u64rj-Fixed/sdk-2-src/arm-linux-gnueabihf-gcc"
  is not able to compile a simple test program.

  It fails with the following output:





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  common-build/cmake/sdk-project-include.cmake:1189 (project)
  CMakeLists.txt:4 (SDK_PROJECT)


CMake Error: your C compiler: "/home/u64rj-Fixed/sdk-2-src/arm-linux-gnueabihf-gcc" was not found.   Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: your CXX compiler: "/home/u64rj-Fixed/sdk-2-src/arm-linux-gnueabihf-g++" was not found.   Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
-- Configuring incomplete, errors occurred!
See also "/home/u64rj-Fixed/sdk-2-src/CMakeFiles/CMakeOutput.log".
See also "/home/u64rj-Fixed/sdk-2-src/CMakeFiles/CMakeError.log".
u64rj@u64rj-MS-7696:~/u64rj-Fixed/sdk-2-src$ 

ARMv7a is the architecture in the build of chip TI Sitara AM3358.

I don't know why it searches cross-compiler at the C project path: CMake Error: your C compiler: "/home/u64rj-Fixed/sdk-2-src/arm-linux-gnueabihf-gcc" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name. CMake Error: Internal CMake error, TryCompile configure of cmake failed -- Check for working C compiler: /home/u64rj-Fixed/sdk-2-src/arm-linux-gnueabihf-gcc -- broken

even though the cross-compiler of the tool chain is given by export CMAKE_C_COMPILER=/home/u64rj/ti-processor-sdk-linux-am335x-evm-01.00.00.03/linux-devkit/sysroots/i686-arago-linux/usr/bin/arm-linux-gnueabihf-gcc

Thanks,

  • You have to give the path to and name of the `gcc` compiler if you do cross-compilation with CMake. Normally you use a toolchain file for this. Did you see the [cmake-toolchains](http://www.cmake.org/cmake/help/v3.0/manual/cmake-toolchains.7.html#cross-compiling) examples in CMake's documentation? It even includes one for the Linaro toolchain. – Florian Aug 31 '15 at 12:20
  • Thanks Florian. You are right about cmake cross-toolchains setting. After done that, it generates Makefile. Now the new problem is that there are errors when I try to build them in Eclipse: – Robert William Aug 31 '15 at 15:30
  • The error message says `cmake` doesn't have write access at `/home/u64rj-Fixed/sdk-2-src`. You need to have write access in the directory you are executing `cmake` because the current directory is taken as CMake's binary output directory. So it's normally recommended to do an "out-of-source build" when using CMake (see e.g. [here](http://stackoverflow.com/questions/4506193/what-are-the-dusty-corners-a-newcomer-to-cmake-will-want-to-know) or [here](http://stackoverflow.com/questions/11143062/getting-cmake-to-build-out-of-source-without-wrapping-scripts)). – Florian Sep 01 '15 at 19:21

0 Answers0