Skip to content

Docker images for cross-compiling C++17 on RaspberryPi

License

Notifications You must be signed in to change notification settings

5p4k/rpi-build-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RPi Build Tools (unofficial)

Official repo: https://git.mittelab.org/5p4k/rpi-build-tools
Build status: pipeline status
Docker Hub: https://hub.docker.com/repository/docker/5p4k/rpi-cross

Unofficial helper scripts and Docker images to cross-compile for the Raspberry Pi (in armv6). Binaries compiled with this image can be directly copied to the Raspberry Pi.

Image usage

The image provides

  • /usr/share/rpi-sysroot/RPi.cmake
    CMake toolchain for cross-compilation.
  • /usr/share/rpi-sysroot
    Sysroot from RPi cross-compilation.
  • /usr/share/rpi-sysroot/check-armv6
    Checks that the sysroot contains only armv6 binaries.
  • /usr/bin/cc-armv6-linux-gnueabihf
    Cross-compile wrapper for the C compiler.
  • /usr/bin/cpp-armv6-linux-gnueabihf
    Cross-compile wrapper for the C++ compiler.
  • /usr/bin/arch-check
    Checks the architecture of a binary.

When running inside the generated image, it suffices to import the CMake toolchain:

$ docker run -it --rm -v /path/to/project:/mnt 5p4k/rpi-cross:buster
# mkdir build_folder
# cd build_folder
# cmake -DCMAKE_TOOLCHAIN_FILE=/usr/share/rpi-sysroot/RPi.cmake ..
# make
# exit

When compiling sources directly, the provided wrappers can be used

$ docker run -it --rm -v /path/to/project:/mnt rpi-cross:buster
# cpp-armv6-linux-gnueabihf my_source_file.cpp
ld: warning: lld uses extended branch encoding, no object with architecture supporting feature detected.
ld: warning: lld may use movt/movw, no object with architecture supporting feature detected.
# ./a.out   # Will fail because can only run on a Raspberry Pi
/lib/ld-linux-armhf.so.3: No such file or directory  
# exit

About

Docker images for cross-compiling C++17 on RaspberryPi

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published