• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cross compile pilight
#1
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:
  • 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?
 
Reply
#2
You are missing a cross-compiled libunwind.
 
Reply
#3
No, that was a typo in my post - I wrote "libunwrap" but I meant "libunwind" ;-)
So the cross-compiled libunwind exists in the toolchains lib path. Otherwise cmake would complain about missing libs anyway.
 
Reply
#4
You need to make sure it gets linked. The functions are definitely libunwind functions.
 
Reply
#5
cmake didn't include it in the makefiles because of this line in "CMakeLists.txt":
[227] if(NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "^mips")
after commenting it out it worked.
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  pilight start/stop loop Rschnauzer 1 222 10-27-2022, 10:28 PM
Last Post: Rschnauzer
  pilight on raspbian bullseye ChristianK 3 1,545 07-29-2022, 10:18 PM
Last Post: Henkehh
  pilight-raw changes output format from 7 to 8 Rschnauzer 2 1,609 05-04-2022, 01:32 PM
Last Post: youradultworld
Question pilight stopped working sl4m01 5 2,447 09-16-2021, 01:34 PM
Last Post: orlo11
  how to compile pilight with custom protocol code? am i missing something? stanwebber 2 982 07-05-2021, 03:49 AM
Last Post: stanwebber
  Staging does not compile with new backtrace? akloeckner 1 824 05-16-2021, 07:48 AM
Last Post: akloeckner
  hardware info lost after pilight restart Rschnauzer 3 1,227 03-17-2021, 11:44 AM
Last Post: Rschnauzer
Question pilight nightly webgui offline after some hours fleisch 4 1,696 10-26-2020, 05:19 PM
Last Post: fleisch
  rpi3 Buster Compile Error Nikau 9 4,364 03-26-2020, 08:47 AM
Last Post: tvdgeer
  pilight bugs Ascenion 1 1,220 03-23-2020, 06:29 PM
Last Post: curlymo

Forum Jump:


Browsing: 1 Guest(s)