[CMake] cross compiling - CMAKE_FIND_ROOT_PATH_MODE_LIBRARY and link.txt

Jack Smith smith.jack.sidman at gmail.com
Thu Nov 14 10:20:47 EST 2013


Hello,

I'm confused by an issue that I am having with a project I have recently
joined.

We are cross compiling for ARM on linux.

I have the cross compiler toolchain installed at /CC_TOOLCHAIN

I set CMAKE_SYSROOT_PATH appropriately, then do this in my toolchain file:

set(CMAKE_FIND_ROOT_PATH "${CMAKE_SYSROOT_PATH}/usr/lib")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

upon launching cmake with this command:
cmake --debug-trycompile --debug-output
-DCMAKE_TOOLCHAIN_FILE=CC_TOOLCHAIN/toolchain.cmake ../src

I encounter this error

/CC_TOOLCHAIN/arm-gcc
  -D_POSIX_C_SOURCE=199506 -D_POSIX_VERSION=199506 -DGPT_VERSION="" -o
  CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -c
  /home/Me/build/CMakeTmp/testCCompiler.c
  Linking C executable cmTryCompileExec
  cmake -E cmake_link_script CMakeFiles/cmTryCompileExec.dir/link.txt
--verbose=1

 /CC_TOOLCHAIN/arm-gcc
  CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -o cmTryCompileExec
  -rdynamic

  /CC_TOOLCHAIN/ld:
  cannot find crt1.o: No such file or directory


Curious as to the contents of the cmake_link_script at
CMakeFiles/cmTryCompileExec.dir/link.txt

$cat link.txt

/CC_TOOLCHAIN/arm-gcc CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o  -o
cmTryCompileExec -rdynamic


So, I guess my question is, where is the "-L" to specify link directories,
or how do I know / specify where the linker thinks it is allowed to look
for libraries ?

Thanks.
Jack
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20131114/bc778b9d/attachment.htm>


More information about the CMake mailing list