The primary target of the Ubuntu arm-linux-gnueabi cross compiler is to compile for a different architecture of the same Ubuntu release leveraging the Debian/Ubuntu multiarch capabilities. Example: You compile on Ubuntu 16.04 amd64 for Ubuntu 16.04 armel.

If you would like to do a similar thing for Raspbian I suggest the following approach:

  • On your Ubuntu host install Debian Jessie amd64 within a chroot or a LXC container.
  • Enable the foreign architecture armhf.
  • Install the cross compiler from the emdebian tools repository.
  • Tweak the cross compiler (it would generate code for ARMv7-A by default) by writing a custom gcc specs file.
  • Install armhf libraries (libstdc++ etc.) from the Raspbian repository.
  • Build your source code.

Since this is a lot of work I have automated the above setup. You can read about it here: http://www.get-edi.io/Cross-Compiling-for-Raspbian/

Answer from Matthias Lüscher on Stack Exchange
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › using the raspberry pi › beginners
SOLVED: What is arm-linux-gnueabihf? - Raspberry Pi Forums
I've been looking through my Pi using ncdu trying to free up space, when I noticed something in /usr/lib/ called arm-linux-gnueabihf. I've been looking around and I can't seem to figure out what it is. Is it safe to delete? It takes up 700 MiB so I want to delete it. Thanks · Last edited by IceBotYT on Sun Nov 21, 2021 1:47 am, edited 1 time in total. ... Ah, after some more digging I found this page https://packages.debian.org/stretch/gcc ...
Top answer
1 of 4
6

The primary target of the Ubuntu arm-linux-gnueabi cross compiler is to compile for a different architecture of the same Ubuntu release leveraging the Debian/Ubuntu multiarch capabilities. Example: You compile on Ubuntu 16.04 amd64 for Ubuntu 16.04 armel.

If you would like to do a similar thing for Raspbian I suggest the following approach:

  • On your Ubuntu host install Debian Jessie amd64 within a chroot or a LXC container.
  • Enable the foreign architecture armhf.
  • Install the cross compiler from the emdebian tools repository.
  • Tweak the cross compiler (it would generate code for ARMv7-A by default) by writing a custom gcc specs file.
  • Install armhf libraries (libstdc++ etc.) from the Raspbian repository.
  • Build your source code.

Since this is a lot of work I have automated the above setup. You can read about it here: http://www.get-edi.io/Cross-Compiling-for-Raspbian/

2 of 4
5

I cannot reproduce the problem anymore

As of https://github.com/raspberrypi/tools/tree/5caa7046982f0539cf5380f94da04b31129ed521 it just works no matter which directory I'm on, just adding to PATH is enough:

git clone https://github.com/raspberrypi/tools
export PATH="$(pwd)/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:${PATH}"
printf '#include <stdio.h>\nint main() { puts("hello world"); }\n' > hello_world.c
printf '#include <iostream>\nint main() { std::cout << "hello world" << std::endl; }\n' > hello_world.cpp
arm-linux-gnueabihf-gcc -std=c99 -o hello_world_c hello_world.c
arm-linux-gnueabihf-g++ -std=c++11 -o hello_world_cpp hello_world.cpp

Tested in Ubuntu 17.10.

The official documentation also documents that this should work: https://www.raspberrypi.org/documentation/linux/kernel/building.md (GitHub)

Related: https://stackoverflow.com/questions/19162072/how-to-install-the-raspberry-pi-cross-compiler-on-my-linux-host-machine

Discussions

c++ - How to install the Raspberry Pi cross compiler on my Linux host machine? - Stack Overflow
However, I believe I should be ... arm-linux-gnueabihf. Then I realized that this does not work with Raspberry Pi since it is armv6. After some Googling, I then found the pre-built toolchain from GitHub. I downloaded the toolchain, but I don't really understand how to "install" it. I extracted the files to my home directory. The directory structure looks like this: /gcc-linearo-a... More on stackoverflow.com
🌐 stackoverflow.com
Cross compile to armv6 raspberry pi failed
My program compiles (and runs) on my raspberry pi 1 Model B without any problem without ring. But now with ring it no longer compiles. Any suggestions? The error: = note: /home/flocks/Projekte/fsh-control-server/target/arm-unknown-linux-gnueabihf/release/deps/libring-930f116e465f07d2.rlib(... More on github.com
🌐 github.com
6
January 17, 2021
archlinux - Cross Compile Error Using arm-linux-gnueabihf-gcc - Raspberry Pi Stack Exchange
I am trying to cross compile a C binary from Ubuntu Trusty Tahr x64 to Arch Linux ARM on my Raspberry Pi Zero. ... I compiled the example using make and successfully executed it in Ubuntu. Then I installed arm-linux-gnueabihf-gcc and used it to compile my example. More on raspberrypi.stackexchange.com
🌐 raspberrypi.stackexchange.com
February 2, 2016
How to compile Raspberry Pi on macOS Big Sur? Is there an OSX arm-linux-gnueabihf-gcc toolchain somewhere? - Raspberry Pi Stack Exchange
I'm looking for a pre-packaged arm-linux-gnueabihf-gcc toolchain for OSX. Can someone point me to one? More on raspberrypi.stackexchange.com
🌐 raspberrypi.stackexchange.com
May 25, 2021
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › using the raspberry pi › beginners
make: arm-linux-gnueabihf-gcc: Command not found - Raspberry Pi Forums
AFAIK arm-linux-gnueabihf-gcc is a cross compiler. It is run from a non arm computer. I think this makefile is supposed to be used on a different computer to compile something for the RPi. Depending on the distribution you run you can get it by doing apt-get install arm-linux-gnueabihf-gcc ...
🌐
GitHub
gist.github.com › sol-prog › 94b2ba84559975c76111afe6a0499814
How to build a cross compiler for Raspberry Pi · GitHub
cd .. mkdir build-gcc && cd build-gcc ../gcc-8.1.0/configure --prefix=/opt/cross-pi-gcc --target=arm-linux-gnueabihf --enable-languages=c,c++,fortran --with-arch=armv6 --with-fpu=vfp --with-float=hard --disable-multilib make -j8 all-gcc make install-gcc
Top answer
1 of 9
255

I'm gonna try to write this as a tutorial for you so it becomes easy to follow.

NOTE: This tutorial only works for older raspbian images. For the newer Raspbian based on Debian Buster see the following how-to in this thread: https://stackoverflow.com/a/58559140/869402

Pre-requirements

Before you start you need to make sure the following is installed:

apt-get install git rsync cmake libc6-i386 lib32z1 lib32stdc++6

Let's cross compile a Pie!

Start with making a folder in your home directory called raspberrypi.

Go in to this folder and pull down the ENTIRE tools folder you mentioned above:

git clone git://github.com/raspberrypi/tools.git

You wanted to use the following of the 3 ones, gcc-linaro-arm-linux-gnueabihf-raspbian, if I did not read wrong.

Go into your home directory and add:

export PATH=$PATH:$HOME/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin

to the end of the file named ~/.bashrc

Now you can either log out and log back in (i.e. restart your terminal session), or run . ~/.bashrc in your terminal to pick up the PATH addition in your current terminal session.

Now, verify that you can access the compiler arm-linux-gnueabihf-gcc -v. You should get something like this:

Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/home/tudhalyas/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../libexec/gcc/arm-linux-gnueabihf/4.7.2/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: /cbuild/slaves/oort61/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-linux/.b
 uild/src/gcc-linaro-4.7-2012.08/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-
 linux-gnu --target=arm-linux-gnueabihf --prefix=/cbuild/slaves/oort61/crosstool-ng/builds/arm-l
 inux-gnueabihf-raspbian-linux/install --with-sysroot=/cbuild/slaves/oort61/crosstool-ng/builds/
 arm-linux-gnueabihf-raspbian-linux/install/arm-linux-gnueabihf/libc --enable-languages=c,c++,fo
 rtran --disable-multilib --with-arch=armv6 --with-tune=arm1176jz-s --with-fpu=vfp --with-float=
 hard --with-pkgversion='crosstool-NG linaro-1.13.1+bzr2458 - Linaro GCC 2012.08' --with-bugurl=
 https://bugs.launchpad.net/gcc-linaro --enable-__cxa_atexit --enable-libmudflap --enable-libgom
 p --enable-libssp --with-gmp=/cbuild/slaves/oort61/crosstool-ng/builds/arm-linux-gnueabihf-rasp
 bian-linux/.build/arm-linux-gnueabihf/build/static --with-mpfr=/cbuild/slaves/oort61/crosstool-
 ng/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-mpc
 =/cbuild/slaves/oort61/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-
 gnueabihf/build/static --with-ppl=/cbuild/slaves/oort61/crosstool-ng/builds/arm-linux-gnueabihf
 -raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-cloog=/cbuild/slaves/oort61/cros
 stool-ng/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --wi
 th-libelf=/cbuild/slaves/oort61/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-linux/.build/a
 rm-linux-gnueabihf/build/static --with-host-libstdcxx='-L/cbuild/slaves/oort61/crosstool-ng/bui
 lds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static/lib -lpwl' --ena
 ble-threads=posix --disable-libstdcxx-pch --enable-linker-build-id --enable-plugin --enable-gol
 d --with-local-prefix=/cbuild/slaves/oort61/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-li
 nux/install/arm-linux-gnueabihf/libc --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.7.2 20120731 (prerelease) (crosstool-NG linaro-1.13.1+bzr2458 - Linaro GCC 2012.08
 )

But hey! I did that and the libs still don't work!

We're not done yet! So far, we've only done the basics.

In your raspberrypi folder, make a folder called rootfs.

Now you need to copy the entire /liband /usr directory to this newly created folder. I usually bring the rpi image up and copy it via rsync:

rsync -rl --delete-after --safe-links [email protected]:/{lib,usr} $HOME/raspberrypi/rootfs

where 192.168.1.PI is replaced by the IP of your Raspberry Pi.

Now, we need to write a cmake config file. Open ~/home/raspberrypi/pi.cmake in your favorite editor and insert the following:

SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER $ENV{HOME}/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER $ENV{HOME}/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++)
SET(CMAKE_FIND_ROOT_PATH $ENV{HOME}/raspberrypi/rootfs)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

Now you should be able to compile your cmake programs simply by adding this extra flag: -D CMAKE_TOOLCHAIN_FILE=$HOME/raspberrypi/pi.cmake.

Using a cmake hello world example:

git clone https://github.com/jameskbride/cmake-hello-world.git 
cd cmake-hello-world
mkdir build
cd build
cmake -D CMAKE_TOOLCHAIN_FILE=$HOME/raspberrypi/pi.cmake ../
make
scp CMakeHelloWorld [email protected]:/home/pi/
ssh [email protected] ./CMakeHelloWorld
2 of 9
34

Building for newer Raspbian Debian Buster images and ARMv6

The answer by @Stenyg only works for older Raspbian images. The recently released Raspbian based on Debian Buster requires an updated toolchain:

In Debian Buster the gcc compiler and glibc was updated to version 8.3. The toolchain in git://github.com/raspberrypi/tools.git is still based on the older gcc 6 version. This means that using git://github.com/raspberrypi/tools.git will lead to many compile errors.

This tutorial is based on @Stenyg answer. In addition to many other solutions in the internet, this tutorial also supports older Rasperry Pi (A, B, B+, Zero) based on the ARMv6 CPU. See also: GCC 8 Cross Compiler outputs ARMv7 executable instead of ARMv6

Set up the toolchain

There is no official git repository containing an updated toolchain (See https://github.com/raspberrypi/tools/issues/102).

I created a new github repository which includes building and precompiled toolchains for ARMv6 based on GCC8 and newer:

https://github.com/Pro/raspi-toolchain

As mentioned in the project's readme, these are the steps to get the toolchain. You can also build it yourself (see the README for further details).

  1. Download the toolchain:
wget https://github.com/Pro/raspi-toolchain/releases/latest/download/raspi-toolchain.tar.gz
  1. Extract it. Note: The toolchain has to be in /opt/cross-pi-gcc since it's not location independent.
sudo tar xfz raspi-toolchain.tar.gz --strip-components=1 -C /opt
  1. You are done! The toolchain is now in /opt/cross-pi-gcc

  2. Optional, add the toolchain to your path, by adding:

export PATH=$PATH:/opt/cross-pi-gcc/bin

to the end of the file named ~/.bashrc

Now you can either log out and log back in (i.e. restart your terminal session), or run . ~/.bashrc in your terminal to pick up the PATH addition in your current terminal session.

Get the libraries from the Raspberry PI

To cross-compile for your own Raspberry Pi, which may have some custom libraries installed, you need to get these libraries onto your host.

Create a folder $HOME/raspberrypi. In your raspberrypi folder, make a folder called rootfs.

Now you need to copy the entire /liband /usr directory to this newly created folder. I usually bring the rpi image up and copy it via rsync:

rsync -vR --progress -rl --delete-after --safe-links [email protected]:/{lib,usr,opt/vc/lib} $HOME/raspberrypi/rootfs

where 192.168.1.PI is replaced by the IP of your Raspberry Pi.

Use CMake to compile your project

To tell CMake to take your own toolchain, you need to have a toolchain file which initializes the compiler settings.

Get this toolchain file from here: https://github.com/Pro/raspi-toolchain/blob/master/Toolchain-rpi.cmake

Now you should be able to compile your cmake programs simply by adding this extra flag: -D CMAKE_TOOLCHAIN_FILE=$HOME/raspberrypi/pi.cmake and setting the correct environment variables:

export RASPBIAN_ROOTFS=$HOME/raspberry/rootfs
export PATH=/opt/cross-pi-gcc/bin:$PATH
export RASPBERRY_VERSION=1
cmake -DCMAKE_TOOLCHAIN_FILE=$HOME/raspberry/Toolchain-rpi.cmake ..

An example hello world is shown here: https://github.com/Pro/raspi-toolchain/blob/master/build_hello_world.sh

🌐
GitHub
github.com › raspberrypi › tools › tree › master › arm-bcm2708 › gcc-linaro-arm-linux-gnueabihf-raspbian-x64
tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64 at master · raspberrypi/tools
raspberrypi / tools Public · Notifications · You must be signed in to change notification settings · Fork 865 · Star 1.9k · master · / / History · master · / /Top · Name · Name · Last commit message · Last commit date · .. arm-linux-gnueabihf · arm-linux-gnueabihf · bin · bin · lib/gcc/arm-linux-gnueabihf/4.8.3 ·
Author   raspberrypi
Find elsewhere
🌐
Solarian Programmer
solarianprogrammer.com › 2018 › 05 › 06 › building-gcc-cross-compiler-raspberry-pi
Building GCC as a cross compiler for Raspberry Pi | Solarian Programmer
1 cd ~/gcc_all 2 mkdir build-gcc10 ... --with-fpu=vfp --with-float=hard --disable-multilib 4 make -j8 5 make install · At this point, you can use GCC 10.1 to cross compile any C, C++ or Fortran code for your Raspberry Pi....
🌐
GitHub
github.com › briansmith › ring › issues › 1171
Cross compile to armv6 raspberry pi failed · Issue #1171 · briansmith/ring
January 17, 2021 - With: CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=$MAGIC_RPI_GCC TARGET_CC=$MAGIC_RPI_GCC cargo build --target=arm-unknown-linux-gnueabihf --release
Author   Flocksserver
🌐
Stack Overflow
stackoverflow.com › questions › 75741578 › usr-bin-arm-linux-gnueabihf-gcc-error-while-installing-cryptography-python-pa
raspberry pi - '/usr/bin/arm-linux-gnueabihf-gcc' Error while installing cryptography python package - Stack Overflow
1 native build qt5.7.1 on raspberry pi get errors: /usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to `QV8Engine::toVariant · 7 CFFI fails in Python (Linux) virtual environment -- attempting to install cryptography package in venv · 2 fatal error: 'openssl/e_os2.h' file not found in pypy ... 1 '/usr/bin/gcc' failed with exit code 1 while installing cryptography package python on Python:3.7-alpine
🌐
Stack Overflow
stackoverflow.com › questions › 72192256 › gcc-cross-compiling-for-raspberry-pi-lib-arm-linux-gnueabihf-libc-so-6-version
gcc cross compiling for raspberry pi /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.34' not found - Stack Overflow
On Ubuntu 22.04 LTS, I'm cross-compiling for raspberry pi. When I run any built executable on the pi, I get this linking error: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.34' not found I ...
Top answer
1 of 1
1

Hi Jorj,

I'm having trouble to install MuPDF. Below is the error I have when I run make prefix=/usr/local install:

pi@pi:/gcc_all/mupdf $ make prefix=/usr/local install
CC build/debug/pdf/pdf-pkcs7.o
source/pdf/pdf-pkcs7.c: In function ‘bsegs_read’:
source/pdf/pdf-pkcs7.c:30:39: error: dereferencing pointer to incomplete type ‘BIO’ {aka ‘struct bio_st’}
BIO_SEGS_CTX *ctx = (BIO_SEGS_CTX *)b->ptr;
^~
source/pdf/pdf-pkcs7.c: At top level:
source/pdf/pdf-pkcs7.c:107:1: error: variable ‘methods_bsegs’ has initializer but incomplete type
static BIO_METHOD methods_bsegs =
^~~~~~
source/pdf/pdf-pkcs7.c:109:2: warning: excess elements in struct initializer
0,"segment reader",
^
source/pdf/pdf-pkcs7.c:109:2: note: (near initialization for ‘methods_bsegs’)
source/pdf/pdf-pkcs7.c:109:4: warning: excess elements in struct initializer
0,"segment reader",
^~~~~~~~~~~~~~~~
source/pdf/pdf-pkcs7.c:109:4: note: (near initialization for ‘methods_bsegs’)
source/pdf/pdf-pkcs7.c:110:2: warning: excess elements in struct initializer
NULL,
^~~~
source/pdf/pdf-pkcs7.c:110:2: note: (near initialization for ‘methods_bsegs’)
source/pdf/pdf-pkcs7.c:111:2: warning: excess elements in struct initializer
bsegs_read,
^~~~~~~~~~
source/pdf/pdf-pkcs7.c:111:2: note: (near initialization for ‘methods_bsegs’)
source/pdf/pdf-pkcs7.c:112:2: warning: excess elements in struct initializer
NULL,
^~~~
source/pdf/pdf-pkcs7.c:112:2: note: (near initialization for ‘methods_bsegs’)
source/pdf/pdf-pkcs7.c:113:2: warning: excess elements in struct initializer
NULL,
^~~~
source/pdf/pdf-pkcs7.c:113:2: note: (near initialization for ‘methods_bsegs’)
source/pdf/pdf-pkcs7.c:114:2: warning: excess elements in struct initializer
bsegs_ctrl,
^~~~~~~~~~
source/pdf/pdf-pkcs7.c:114:2: note: (near initialization for ‘methods_bsegs’)
source/pdf/pdf-pkcs7.c:115:2: warning: excess elements in struct initializer
bsegs_new,
^~~~~~~~~
source/pdf/pdf-pkcs7.c:115:2: note: (near initialization for ‘methods_bsegs’)
source/pdf/pdf-pkcs7.c:116:2: warning: excess elements in struct initializer
bsegs_free,
^~~~~~~~~~
source/pdf/pdf-pkcs7.c:116:2: note: (near initialization for ‘methods_bsegs’)
source/pdf/pdf-pkcs7.c:117:2: warning: excess elements in struct initializer
bsegs_callback_ctrl,
^~~~~~~~~~~~~~~~~~~
source/pdf/pdf-pkcs7.c:117:2: note: (near initialization for ‘methods_bsegs’)
source/pdf/pdf-pkcs7.c:135:17: error: field ‘x509_ctx’ has incomplete type
X509_STORE_CTX x509_ctx;
^~~~~~~~
source/pdf/pdf-pkcs7.c: In function ‘verify_callback’:
source/pdf/pdf-pkcs7.c:159:13: error: dereferencing pointer to incomplete type ‘X509_STORE_CTX’ {aka ‘struct x509_store_ctx_st’}
switch (ctx->error)
^~
source/pdf/pdf-pkcs7.c: In function ‘pk7_verify’:
source/pdf/pdf-pkcs7.c:208:40: error: dereferencing pointer to incomplete type ‘X509_STORE’ {aka ‘struct x509_store_st’}
X509_VERIFY_PARAM_set_flags(cert_store->param, X509_V_FLAG_CB_ISSUER_CHECK);
^~
source/pdf/pdf-pkcs7.c: At top level:
source/pdf/pdf-pkcs7.c:107:19: error: storage size of ‘methods_bsegs’ isn’t known
static BIO_METHOD methods_bsegs =
^~~~~~~~~~~~~
source/pdf/pdf-pkcs7.c: In function ‘bsegs_ctrl’:
source/pdf/pdf-pkcs7.c:66:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
source/pdf/pdf-pkcs7.c: In function ‘bsegs_callback_ctrl’:
source/pdf/pdf-pkcs7.c:105:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make: [Makefile:136: build/debug/pdf/pdf-pkcs7.o] Error 1

Would installing 64bits Raspian solve these issues?

🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › programming › c/c++
Difference between arm-linux-gnueabi and bcm2708? - Raspberry Pi Forums
So binaries for running on debian armel need to use the softfloat abi (-mfloat-abi=soft or -mfloat-abi=softfp) Finally make sure any static libaries you are building against (such as libgcc which is included in practically every gcc-built binary) are suitable for the Pi, ubuntu's libaries (whether armel or armhf) are built for armv7 and as such are NOT suitable for use on the Pi. ... I've also been trying to cross compile arm-linux-gnueabihf from Ubuntu and hit the same Thumb-1 issue. If I use -marm it does compile, but when I copy the binary over to the Raspberry Pi (running Raspbian) and execute I get a segmentation fault every time.
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › software › raspberry pi os
where to get raspian gcc toolchain - Raspberry Pi Forums
COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/6/lto-wrapper Target: arm-linux-gnueabihf Configured with: ../src/configure -v --with-pkgversion='Raspbian 6.3.0-18+rpi1+deb9u1' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --pr ogram-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debu g --enabl
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › programming › c/c++
gcc toolchain remedial education - Raspberry Pi Forums
On my Debian Intel laptop for cross compiling I set in Settings -> Compiler select "GNU GCC compiler for ARM" Then on the Toolchain executables tab set compiler's Installation directory: /pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64 And set: # C compiler : arm-linux-gnueabihf-gcc # C++ compiler : arm-linux-gnueabihf-g++ # Linker for dynamic libs : arm-linux-gnueabihf-g++ # Linker for static libs : arm-linux-gnueabihf-ar Make a hello world project. Build. I can sftp the output executable to the Raspberry Pi and it will run.
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › programming › c/c++
arm-linux-gnueabihf cross compiler and Pi Zero / pre model 2 Pi - Raspberry Pi Forums
-mfpu=vfp -march=armv6zk -mtune=arm1176jzf-s In Debian, armhf refers to ARMv7, not ARMv6. The arm-linux-gnueabihf cross-compilers in the Debian repos compile for ARMv7, they do not support ARMv6. You'll need a version of GCC that was configured for ARMv6 specifically.
🌐
GitHub
gist.github.com › lategoodbye › c7317a42bf7f9c07f5a91baed8c68f75
Raspberry Pi: How to cross-compile and use Mainline Kernel · GitHub
This may be obtained from https://snapshots.linaro.org/gnu-toolchain/. The directory arm-linux-gnueabihf contains the necessary compiler for ARM 32-bit and the directory aarch64-linux-gnu for ARM 64-bit.