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!
#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 IRC channel >>
#3
Running into blocker after installing aarch-* tools onto my Ubuntu desktop:

Code:
drmac@drmac-ubuntu:~$ sudo apt-get install gcc-4.8-aarch64-linux-gnu-base
...
drmac@drmac-ubuntu:~/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
...
drmac@drmac-ubuntu:~/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.
drmac@drmac-ubuntu:~/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.
drmac@drmac-ubuntu:~/percona-xtradb-cluster$ aarch64-linux-gnu-cpp-4.8 -E
^C
drmac@drmac-ubuntu:~/percona-xtradb-cluster$
drmac@drmac-ubuntu:~/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
#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 IRC channel >>


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pine A64+ mainline mipi-dsi Learnincurve 3 6,428 01-12-2021, 07:36 AM
Last Post: Learnincurve
  DietPi OS for PINE A64 MichaIng 0 9,037 12-15-2020, 06:11 AM
Last Post: MichaIng
  Fedora 32/CentOS 8 Pine A64+ Images wideawake 2 5,350 10-02-2020, 11:38 AM
Last Post: mathiraj
  LibreELEC(KODI) for Pine A64 (+) pineadmin 6 15,394 05-02-2020, 10:29 AM
Last Post: aaronmarsh632
  Lakka-nightlies for Pine A64 (and H64) roel 11 18,829 04-23-2020, 12:55 AM
Last Post: roel
  Read DHT22 on Pine A64 ayufan 3 6,436 01-19-2020, 02:51 PM
Last Post: {-DesT-}
  Centos 7 for Pine A64 Luke 2 5,945 05-28-2019, 12:18 AM
Last Post: pineadmin
  NEMS Linux for Pine A64 (+) Luke 1 5,019 05-09-2019, 05:42 PM
Last Post: pineadmin
  Pine Board using linux stuck during boot sequence ktaragorn 4 8,041 03-30-2019, 06:48 AM
Last Post: ktaragorn
  motionEyeOS (PINE A64(+)) pineadmin 4 11,743 11-09-2018, 03:25 AM
Last Post: pineadmin

Forum Jump:


Users browsing this thread: 1 Guest(s)