Hi, I wonder if I'm the only one who wants to cross compile pilight to speed things up ;-)
Anyway, this is what I've got so far:
My "arm-toolchain.cmake" looks like this:
Compiling works until it gets to pilight-daemon:
Any suggestions?
Anyway, this is what I've got so far:
- installed cross compilers (aptitude install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf)
- created toolchain root (mkdir /opt/arm-toolchain ; sudo chown bla /opt/arm-toolchain)
- downloaded libpcap and libunwind and cross-compiled those (CC=arm-linux-gnueabihf-gcc ./configure --prefix=/opt/arm-toolchain --host=arm-linux)
- after "make install" both libs where installed to /opt/arm-toolchain
- downloaded pilight stable sources (git clone --depth 5 -b master https://github.com/pilight/pilight.git)
- created a arm-toolchain.cmake file (contents below)
- tried to compile pilight (cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/arm-toolchain.cmake ; make)
My "arm-toolchain.cmake" looks like this:
Code:
# this one is important
SET(CMAKE_SYSTEM_NAME Linux)
# this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
# specify the cross compiler
SET(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /opt/arm-toolchain)
SET(CROSS_COMPILE_LIBS /opt/arm-toolchain/lib)
include_directories(SYSTEM /opt/arm-toolchain/include)
# https://tls.mbed.org/kb/development/arm-thumb-error-r7-cannot-be-used-in-asm-here
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer")
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Compiling works until it gets to pilight-daemon:
Code:
[ 96%] Building C object CMakeFiles/pilight-daemon.dir/daemon.c.o
/var/tmp/pilight/daemon.c: In function ‘start_pilight’:
/var/tmp/pilight/daemon.c:2168:3: warning: format not a string literal and no format arguments [-Wformat-security]
printf(help);
^
libpilight.a(gc.c.o): In Funktion `gc_handler':
/var/tmp/pilight/libs/pilight/core/gc.c:71: undefined reference to `_ULarm_init_local'
/var/tmp/pilight/libs/pilight/core/gc.c:75: undefined reference to `_ULarm_get_proc_name'
/var/tmp/pilight/libs/pilight/core/gc.c:76: undefined reference to `_ULarm_get_reg'
/var/tmp/pilight/libs/pilight/core/gc.c:77: undefined reference to `_ULarm_get_reg'
/var/tmp/pilight/libs/pilight/core/gc.c:73: undefined reference to `_ULarm_step'
collect2: error: ld returned 1 exit status
Any suggestions?