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:
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
  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
  LibreELEC(KODI) for Pine A64 (+) pineadmin 6 2,932 05-02-2020, 10:29 AM
Last Post: aaronmarsh632
  Pine A64+ mainline mipi-dsi Learnincurve 2 225 04-28-2020, 06:09 AM
Last Post: Learnincurve
  Lakka-nightlies for Pine A64 (and H64) roel 11 1,205 04-23-2020, 12:55 AM
Last Post: roel
  Read DHT22 on Pine A64 ayufan 3 1,331 01-19-2020, 02:51 PM
Last Post: {-DesT-}
  Centos 7 for Pine A64 Luke 2 951 05-28-2019, 12:18 AM
Last Post: pineadmin
  NEMS Linux for Pine A64 (+) Luke 1 811 05-09-2019, 05:42 PM
Last Post: pineadmin
  Pine Board using linux stuck during boot sequence ktaragorn 4 612 03-30-2019, 06:48 AM
Last Post: ktaragorn
  motionEyeOS (PINE A64(+)) pineadmin 4 4,737 11-09-2018, 03:25 AM
Last Post: pineadmin
  Help needed - installing Parrot OS on PINE A64+2GB Board Doryan 1 768 03-05-2018, 01:38 AM
Last Post: joe
  boot process for pine a64 awaysu 1 1,219 01-24-2018, 05:09 AM
Last Post: xalius

Forum Jump:


Users browsing this thread: 1 Guest(s)