Skip to main content
8 votes
Accepted

Cross compile for Raspberry Pi Zero from Ubuntu?

I think the issue is down to the differences in the processors. The Rasberry Pi 3B+ has a ARM Cortex-A53 and the Pi Zero has a ARM1176JZF-S processor. Both are ARM CPUs, but the 3B+'s CPU is a much ...
Fred's user avatar
  • 4,562
7 votes
Accepted

Crosscompiling: exact archictecture for all models

I believe I figured it out after quite some fiddling. What is the most specific parameter I can use to be compatible with all models? Raspbian FAQ's contain the final answer: -march=armv6 -mfpu=vfp ...
Pietro Saccardi's user avatar
5 votes
Accepted

Armbian binary compatibility with Raspbian

In short, Yes, they will work. Both repositories use the same upstream code to build their packages. That is, armhf binaries from armbian will run on an armhf raspbian. Your problem won't binary ...
crasic's user avatar
  • 3,003
5 votes
Accepted

Cross compiling for RPi - error while loading shared libraries

Shared or dynamic libraries are needed at run time. So you need the library not only on the build system but in on the target system, in this case on the PI. This is different from static libraries. ...
RalfFriedl's user avatar
  • 2,188
5 votes
Accepted

Where to get Bluetooth/Bluetooth.h for Raspberry Pi?

You can use Debian's (which is the distro Raspberry Pi OS is based on) search engine to locate any file: Once you find the package containing the necessary files, you can install the same package on ...
Dmitry Grigoryev's user avatar
4 votes

libstdc++ Error: `GLIBCXX_3.4.22' not found

It appears you used a g++ 6 cross-compiler (default install on Debian 9?) then attempted to run the resulting binary on Raspbian 8 Jessie. You can see gcc's symbol versioning guide here where g++ 4.9 ...
jdonald's user avatar
  • 2,914
4 votes

Cross compiling from Fedora 27

Try installing: sudo dnf install binutils-arm-linux-gnu gcc-arm-linux-gnu glibc-arm-linux-gnu binutils-arm-linux-gnu contains the GNU binutils for the arm-linux-gnu target. gcc-arm-linux-gnu ...
Paul's user avatar
  • 47
4 votes
Accepted

Is there a way to cross-compile for armv6 using gcc-7?

Using the compiler toolchain from https://sourceforge.net/projects/raspberry-pi-cross-compilers/ For pizero the cross-compiler is available from the link cross-gcc-9.1.0-pi_0-1.tar.gz This compiler ...
mpromonet's user avatar
  • 1,124
4 votes

Is there a way to cross-compile for armv6 using gcc-7?

I ran into a similar issue trying to cross-compile code for the Raspberry PI Zero (armv6) using a newer GCC 8. Current toolchains are often not built with the --with-arch=armv6 flag. This results in ...
Stefan Profanter's user avatar
4 votes
Accepted

Upgrading libc (libc6) raspberry pi os (rasbian buster)

The Pi can still boot because the kernel does not use userspace libraries, so it's unaffected. However, almost every userspace Linux program uses glibc, so when you replace that library, you will ...
Dmitry Grigoryev's user avatar
4 votes

Where to get Bluetooth/Bluetooth.h for Raspberry Pi?

Not a stupid question at all. I couldn't immediately find a good explanation of how to install packages from source. However, some trial-and-error yielded this solution: $ apt-cache search bluez ...
Seamus's user avatar
  • 22.3k
4 votes

Raspberry Pi 4 Target Architecture Cross Linux From Scratch

I had to go with the following in the end: Name Description Value CLFS_HOST Host architecture triplet x86_64-cross-linux-gnu CLFS_TARGET Target architecture triplet aarch64-linux-musl CLFS_ARCH ...
junglie85's user avatar
  • 181
4 votes
Accepted

Cannot find filesystem

The raspberrypi/tools toolchain you seem to be using contains an ancient version of GCC (4.9.3). If you want to use the <filesystem> header, you need GCC 8 or later. You can use Crosstool-NG to ...
tttapa's user avatar
  • 986
3 votes

fatal error: bcm_host.h: No such file or directory compilation terminated

As mentioned elsewhere on Stack Overflow here: Failed to cross compile Qt 5.6 on RPi 2 (fatal error: bcm_host.h: No such file or directory) and here: https://www.raspberrypi.org/forums/viewtopic.php?f=...
yogsodoth's user avatar
  • 121
3 votes

What's causing these crashes after cross-compiling?

I was getting a pure virtual method called exception when cross-compiling. @JeremyBarnes's answer did not quite work for me. Instead I used: -U__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 -...
user1202136's user avatar
3 votes

What's causing these crashes after cross-compiling?

The easiest way to a binary compatible cross-compilation is to install the toolchain used by Raspbian developers. It can be found here. It's essential to use this toolchain if you want to build the ...
Dmitry Grigoryev's user avatar
3 votes

How can I cross-compile to the Raspberry Pi using Clang/LLVM?

Just completed my article, Cross compilation for Raspberry from Sierra, about exactly this thing. Under Mac OS Sierra though. But for clang it matters a little. In this article I have shared ...
Stepan Dyatkovskiy's user avatar
3 votes

How do I see which ARM CPU version I have?

as STEJ's answer suggested, run uname -m. If you have arm64 then it's 64bit and if you have armv7l, then it's 32bit For more information: https://www.raspberrypi.org/forums/viewtopic.php?t=251721
Aharon Ohayon's user avatar
3 votes

Is there a way to cross-compile for armv6 using gcc-7?

The problem is that command line architecture flags change the behavior of the compiler, but they don't change the precompiled runtime support code that is linked in to every executable. So when you ...
Peter Green's user avatar
  • 6,486
3 votes

“apt-get: command not found” issue on raspberry pi os built using Buildroot

The apt command is the Debian solution to download packages from a repository, including their dependencies. If you want to use apt, you have to create a system that is based on these packages. If ...
RalfFriedl's user avatar
  • 2,188
3 votes

How can I run a cross-compile binary on my RPi?

I haven't completely understood what you have done, but in respect to your own answer it is in general possible to run 32 bit programs on a RasPi running a 32 bit or a 64 bit kernel. You cannot run a ...
Ingo's user avatar
  • 42.2k
3 votes
Accepted

How to install pi libraries to cross compile for pi-zero in wsl2

You need two folders: a sysroot and a staging area. The sysroot contains all necessary libraries you need for the cross-compilation of your project. The staging area is where you install your project, ...
tttapa's user avatar
  • 986
3 votes
Accepted

Building kernel for raspberry pi 4 b on a host machine(ubuntu 18.04)

I don't use Ubuntu but as far as I know, resent versions use systemd. goldilocks noted in a comment: Most of the boot time is the userland OS. The kernel only does what it needs to do, which is ...
Ingo's user avatar
  • 42.2k
3 votes
Accepted

Unable to run compiler from raspberry-pi-tools, cannot execute binary file: Exec format error

The raspberrypi/tools repository contains a cross-compiler. The compiler runs on an x86 computer and generates ARM binaries that can be executed on the Raspberry Pi. The cross-compiler itself is an ...
tttapa's user avatar
  • 986
2 votes

How to install cross-compiled OpenCV's libraries on Raspberry Pi

You need to change CMAKE_INSTALL_PREFIX in the cmake build command which points to /usr/local to RPi_rootfs/usr/local where RPi_rootfs is the root file system path which is present in your SD Card. ...
krishna chaitanya's user avatar
2 votes

wiringPi and crosstool-ng

You might want to look at my project Nard SDK where I do what you require, crosstool-ng builds wiringPi. You could compare my file nard/apps/wiringpi-lib/Makefile with your Makefile.
Ronny Nilsson's user avatar
2 votes

What's causing these crashes after cross-compiling?

FWIW, this can be fixed by adding -D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 -D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 -D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 to the compiler flags. Why? In /usr/include/c++/4.{8,...
Jeremy Barnes's user avatar
2 votes
Accepted

Library to allow use of Pi camera in projects?

The usual way to use the camera from C/C++ is to use libmmal (this is the library used by raspistill and raspivid). The source is part of the userland repository, specifically look under interface/...
Dave Jones's user avatar
  • 3,978
2 votes
Accepted

How to cross-compile Python 3.6 for the Raspberry Pi

The instructions posted in this github wiki did it for me: CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ AR=arm-linux-gnueabihf-ar \ RANLIB=arm-linux-gnueabihf-ranlib \ ./configure --...
arielnmz's user avatar
  • 221
2 votes

Which toolchain for Raspberry Pi 3 and Qt5

I'm going through the same thing. You need to use the 4.9.2 compiler: Look under arm-bcm2708 for the arm-rpi-4.9.3-linux-gnueabihf folder. I still haven't been able to cross-compile QT for Pi3, but ...
dayres's user avatar
  • 21

Only top scored, non community-wiki answers of a minimum length are eligible