Reputation: 645
I want to cross compile for the raspberrypi2 using cmake and the precompiled linaro toolchain which I downloaded from here: git clone https://github.com/raspberrypi/tools
When I try to do cmake on my project, I get the following error:
/myhome/libs/raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-
gnueabihf-raspbian-x64//bin/arm-linux-gnueabihf-gcc
--sysroot=/myhome/libs/raspberry/tools/
arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/libc/
CMakeFiles/cmTC_9fb02.dir/testCCompiler.c.o -o cmTC_9fb02 -rdynamic
/myhome/libs/raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-
gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../..
/../../arm-linux-gnueabihf/bin/ld: cannot find crt1.o:
No such file or directory
This file is present in the following directory:
/myhome/libs/raspberry/tools/arm-bcm2708/gcc-linaro-arm-
linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/libc/
usr/lib/arm-linux-gnueabihf
My cmake toolchain file looks as follows
set(CMAKE_SYSROOT "/myhome/libs/raspberry/sysroot/")
set(tools "/myhome/libs/raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/")
set(CMAKE_C_COMPILER "${tools}/bin/arm-linux-gnueabihf-gcc")
set(CMAKE_CXX_COMPILER "${tools}/bin/arm-linux-gnueabihf-g++")
set(CMAKE_EXPORT_COMPILE_COMMANDS=ON)
set(CMAKE_FIND_ROOT_PATH "${CMAKE_SYSROOT}")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
The sysroot directory is where I mounted the raspberry image. I am a bit confused about whether this should be the root of the raspberry image or a path to the linaro tool-chain.
Thanks for your help
Upvotes: 0
Views: 1224
Reputation: 645
Ok, the problem was that
set(CMAKE_SYSROOT "/myhome/libs/raspberry/sysroot/")
was an empty directory, as I mounted the jessie image to this directory but after a reboot the mount was not in this directory anymore.
Upvotes: 0