I'm trying to cross compile for arm-linux-gnueabihf on Ubuntu 16.04 x86_64 box. I use Cmake with toolchain.cmake file where perhaps all important is declared like :
set(CMAKE_C_COMPILER "/usr/bin/arm-linux-gnueabihf-gcc")
set(CMAKE_CXX_COMPILER "/usr/bin/arm-linux-gnueabihf-g++")
set(CMAKE_FIND_ROOT_PATH "/usr/arm-linux-gnueabihf")
It seems it generates all I need. But the make
fails when linking executable target. Snooping around there I found that in the link.txt
in <target>.dir
I have g++ command.
I expected to have there compiler from cross toolchain like arm-linux-gnueabihf-g++
.
Looking into other link.txt
in other <target>
which is not executable but static library there is command from cross toolchain like /usr/bin/arm-linux-gnueabihf-ar
.
Why do I have just g++ in link.txt
at executable target instead of arm-linux-gnueabihf-g++?
Please help, or I'll get mad soon..
adding my toolchain.cmake file:
SET(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR ARMV7)
set(CMAKE_C_COMPILER "/usr/bin/arm-linux-gnueabihf-gcc")
set(CMAKE_CXX_COMPILER "/usr/bin/arm-linux-gnueabihf-g++")
set(CMAKE_C_COMPILER_TARGET "/usr/bin/arm-linux-gnueabihf-gcc")
set(CMAKE_CXX_COMPILER_TARGET "/usr/bin/arm-linux-gnueabihf-g++")
SET(CMAKE_LINKER "/usr/bin/arm-linux-gnueabihf-g++")
# path exists, but not needed to actually compile this
set(CMAKE_FIND_ROOT_PATH "/usr/arm-linux-gnueabihf")
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)
SET(OpenBLAS_DIR /root/OpenBLAS/buildArm/lib/cmake/openblas)