How to compile on other systems for Pine
#1
I'm somewhat familiar with the basic cmake/make/make install recipe for compiling code. The issue is that this usually results in code compiled for the architecture of the host machine (which for me is an Intel Core i7 / x86_64). Compiling code on this machine is lightspeed faster than compiling directly on the Pine.

Are there (I'm sure there are) flags/switches/make-file changes I can make/use when compiling on my desktop so that the resulting binaries will work on the Pine?

I tried this just now "cmake . -DCFLAGS='-maarch64' -DCXXFLAGS='maarch64'" but I didn't see any messages about the architecture changing. I'm waiting for the compile to finish.

Thanks!
  Reply
#2
Usually you set CROSS_COMPILE=/path/to/toolchain/<prefix> make xyz

Code:
CROSS_COMPILE=/opt/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- ARCH=arm64 make -j9 Image

For example to cross compile a kernel... if you use autotools and ./configure script there are also more options you can set like --target= or --toolchain=, but that depends on the source
Come have a chat in the Pine A64 IRC channel >>
  Reply
#3
Running into blocker after installing aarch-* tools onto my Ubuntu desktop:

Code:
[email protected]:~$ sudo apt-get install gcc-4.8-aarch64-linux-gnu-base
...
[email protected]:~/percona-xtradb-cluster$ cmake . ... \
  -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc-4.8 -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-cpp-4.8
...
(cmake fails)
...
  The C++ compiler "/usr/bin/aarch64-linux-gnu-cpp-4.8" is not able to compile a simple test program
...
[email protected]:~/percona-xtradb-cluster$ aarch64-linux-gnu-cpp-4.8 -c
aarch64-linux-gnu-cpp-4.8: fatal error: ‘-c’ is not a valid option to the preprocessor
compilation terminated.
[email protected]:~/percona-xtradb-cluster$ aarch64-linux-gnu-cpp-4.8 -S
aarch64-linux-gnu-cpp-4.8: fatal error: ‘-S’ is not a valid option to the preprocessor
compilation terminated.
[email protected]:~/percona-xtradb-cluster$ aarch64-linux-gnu-cpp-4.8 -E
^C
[email protected]:~/percona-xtradb-cluster$
[email protected]:~/percona-xtradb-cluster$ aarch64-linux-gnu-cpp-4.8 --help | grep assemble
 -Wa,<options>            Pass comma-separated <options> on to the assembler
 -Xassembler <arg>        Pass <arg> on to the assembler
 -E                       Preprocess only; do not compile, assemble or link
 -S                       Compile only; do not assemble or link
 -c                       Compile and assemble, but do not link
                          Permissible languages include: c c++ assembler none
  Reply
#4
Failing tests are a common problem while cross-compiling since the tests usually try to run their output on the host platform which of course fails if they are aarch64 binaries. I spent a lot of time fixing autotools based projects but I can't really help you with cmake... did you have a look at https://cmake.org/Wiki/CMake_Cross_Compiling?

https://cmake.org/Wiki/CMake_Cross_Compi...rospection deals with your problem
Come have a chat in the Pine A64 IRC channel >>
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Lakka-nightlies for Pine A64 (and H64) roel 7 331 10-23-2019, 01:46 PM
Last Post: roel
  Centos 7 for Pine A64 Luke 2 597 05-28-2019, 12:18 AM
Last Post: pineadmin
  LibreELEC(KODI) for Pine A64 (+) pineadmin 0 1,037 05-10-2019, 03:16 AM
Last Post: pineadmin
  NEMS Linux for Pine A64 (+) Luke 1 495 05-09-2019, 05:42 PM
Last Post: pineadmin
  Pine Board using linux stuck during boot sequence ktaragorn 4 250 03-30-2019, 06:48 AM
Last Post: ktaragorn
  motionEyeOS (PINE A64(+)) pineadmin 4 4,211 11-09-2018, 03:25 AM
Last Post: pineadmin
  Help needed - installing Parrot OS on PINE A64+2GB Board Doryan 1 602 03-05-2018, 01:38 AM
Last Post: joe
  boot process for pine a64 awaysu 1 913 01-24-2018, 05:09 AM
Last Post: xalius
  OpenMediaVault (PINE A64(+)) pineadmin 0 2,465 11-21-2017, 03:32 AM
Last Post: pineadmin
  FalconGate (PINE A64(+)) pineadmin 2 2,733 08-15-2017, 10:36 AM
Last Post: pineadmin

Forum Jump:


Users browsing this thread: 1 Guest(s)