Cross compiling toolchains in Docker images

dockcross

Cross compiling toolchains in Docker images.

image Shellcheck CI

GitHub GitHub commit activity

Features

  • Pre-built and configured toolchains for cross compiling.
  • Most images also contain an emulator for the target system.
  • Clean separation of build tools, source code, and build artifacts.
  • Commands in the container are run as the calling user, so that any created files have the expected ownership, (i.e. not root).
  • Make variables CC, CXX, LD, AS etc) are set to point to the appropriate tools in the container.
  • Recent CMake and ninja are precompiled.
  • Conan.io can be used as a package manager.
  • Toolchain files configured for CMake.
  • Current directory is mounted as the container's workdir, /work.
  • Works with the Docker for Mac and Docker for Windows.
  • Support using alternative container executor by setting OCI_EXE environment variable. By default, it searches for docker and podman executable.
  • crosstool-ng and buildroot configuration files.

Examples

  1. dockcross make: Build the Makefile in the current directory.
  2. dockcross cmake -Bbuild -H. -GNinja: Run CMake with a build directory ./build for a CMakeLists.txt file in the current directory and generate ninja build configuration files.
  3. dockcross ninja -Cbuild: Run ninja in the ./build directory.
  4. dockcross bash -c '$CC test/C/hello.c -o hello': Build the hello.c file with the compiler identified with the CC environmental variable in the build environment.
  5. dockcross bash: Run an interactive shell in the build environment.

Note that commands are executed verbatim. If any shell processing for environment variable expansion or redirection is required, please use

" ">
bash -c ""

Installation

This image does not need to be run manually. Instead, there is a helper script to execute build commands on source code existing on the local host filesystem. This script is bundled with the image.

To install the helper script, run one of the images with no arguments, and redirect the output to a file:

docker run --rm CROSS_COMPILER_IMAGE_NAME > ./dockcross
chmod +x ./dockcross
mv ./dockcross ~/bin/

Where CROSS_COMPILER_IMAGE_NAME is the name of the cross-compiler toolchain Docker instance, e.g: dockcross/linux-armv7.

Only 64-bit x86_64 images are provided, a 64-bit x86_64 host system is required.

Usage

For the impatient, here's how to compile a hello world for armv7:

git clone https://github.com/dockcross/dockcross.git
cd dockcross
docker run --rm dockcross/linux-armv7 > ./dockcross-linux-armv7
chmod +x ./dockcross-linux-armv7
./dockcross-linux-armv7 bash -c '$CC test/C/hello.c -o hello_arm'

Note how invoking any toolchain command (make, gcc, etc.) is just a matter of prepending the dockcross script on the commandline:

./dockcross-linux-armv7 [command] [args...]

The dockcross script will execute the given command-line inside the container, along with all arguments passed after the command. Commands that evaluate environmental variables in the image, like $CC or $CXX above, should be executed in [bash -c]. The present working directory is mounted within the image, which can be used to make source code available in the Docker container.

Summary cross compilers

Image name Target arch Compiler Target OS
dockcross/base - - -
dockcross/android-arm ARMv7 Clang Android
dockcross/android-arm64 ARMv8 Clang Android
dockcross/android-x86 x86 Clang Android
dockcross/android-x86_64 x86_64 Clang Android
dockcross/linux-arm64 ARMv8 GCC Linux
dockcross/linux-arm64-lts ARMv8 GCC 8.5.0 + Glibc 2.27 Linux
dockcross/linux-arm64-full ARMv8 GCC + libs Linux
dockcross/linux-arm64-musl ARMv8 GCC + musl Linux
dockcross/linux-armv5 ARMv5 GCC Linux
dockcross/linux-armv5-musl ARMv5 GCC + musl Linux
dockcross/linux-armv6 ARMv6 GCC Linux
dockcross/linux-armv6-lts ARMv6 GCC 8.5.0 + Glibc 2.28 Linux
dockcross/linux-armv6-musl ARMv6 GCC + musl Linux
dockcross/linux-armv7 ARMv7 GCC Linux
dockcross/linux-armv7-lts ARMv7 GCC 8.5.0 + Glibc 2.28 Linux
dockcross/linux-armv7a ARMv7a GCC Linux
dockcross/linux-armv7l-musl ARMv7l GCC + musl Linux
dockcross/linux-mips mips GCC Linux
dockcross/linux-s390x s390x GCC Linux
dockcross/linux-ppc64le ppc64le GCC Linux
dockcross/linux-riscv32 riscv32 GCC Linux
dockcross/linux-riscv64 riscv64 GCC Linux
dockcross/linux-m68k-uclibc m68k GCC + uclibc Linux
dockcross/linux-xtensa-uclibc xtensa GCC + uclibc Linux
dockcross/manylinux2014-x86 x86 GCC Linux
dockcross/manylinux2014-x64 x86_64 GCC Linux
dockcross/linux-x86 x86 GCC Linux
dockcross/linux-x64 x86_64 GCC Linux
dockcross/linux-x86_64-full x86_64 GCC + libs Linux
dockcross/linux-x64-clang x86_64 Clang Linux
dockcross/linux-x64-tinycc x86_64 tinycc + GCC Linux
dockcross/web-wasm Wasm LLVM Web (JS)
dockcross/web-wasi Wasm LLVM Web (Universal)
dockcross/windows-shared-x86 x86 GCC Windows
dockcross/windows-shared-x64 x86_64 GCC Windows
dockcross/windows-shared-x64-posix x86_64 GCC Windows
dockcross/windows-static-x86 x86 GCC Windows
dockcross/windows-static-x64 x86_64 GCC Windows
dockcross/windows-static-x64-posix x86_64 GCC Windows
dockcross/windows-armv7 ARMv7 Clang Windows
dockcross/windows-arm64 ARMv8 Clang Windows

The list of docker images that are no longer maintained.

Image name Target arch Compiler Target OS
dockcross/manylinux1-x86 x86 GCC manylinux
dockcross/manylinux1-x64 x86_64 GCC manylinux
dockcross/manylinux2010-x86 x86 GCC manylinux
dockcross/manylinux2010-x64 x86_64 GCC manylinux
dockcross/linux-mipsel mipsel GCC 4.9 Debian 8

Cross compilers

dockcross/base

Docker Image Size (tag) Docker Pulls Docker Stars

Base image for other toolchain images. From Debian Jessie with GCC, make, autotools, CMake, Ninja, Git, and Python.

dockcross/android-arm

Docker Image Size (tag) Docker Pulls

The Android NDK standalone toolchain for the arm architecture.

dockcross/android-arm64

Docker Image Size (tag) Docker Pulls

The Android NDK standalone toolchain for the arm64 architecture.

dockcross/android-x86

Docker Image Size (tag) Docker Pulls

The Android NDK standalone toolchain for the x86 architecture.

dockcross/android-x86_64

Docker Image Size (tag) Docker Pulls

The Android NDK standalone toolchain for the x86_64 architecture.

dockcross/linux-arm64

Docker Image Size (tag) Docker Pulls

Cross compiler for the 64-bit ARM platform on Linux, also known as AArch64.

dockcross/linux-arm64-lts

Docker Image Size (tag) Docker Pulls

Cross compiler for the 64-bit ARM platform on Linux, also known as AArch64, with Long-term support (For Ubuntu 18.04 or Debian Buster). With GCC 8.5.0 and GLibc 2.27.

dockcross/linux-arm64-full

Docker Image Size (tag) Docker Pulls

Cross compiler for the 64-bit ARM platform on Linux, with cross-libs: SDL2, OpenSSL, Boost, OpenCV and Qt5 (minimal).

dockcross/linux-arm64-musl

Docker Image Size (tag) Docker Pulls

Cross compiler for the 64-bit ARM platform on Linux (also known as AArch64), using musl as base "libc".

dockcross/linux-armv5

Docker Image Size (tag) Docker Pulls

Linux armv5 cross compiler toolchain for legacy devices like the Parrot AR Drone.

dockcross/linux-armv5-musl

Docker Image Size (tag) Docker Pulls

Linux armv5 cross compiler toolchain using musl as base "libc".

dockcross/linux-armv6

Docker Image Size (tag) Docker Pulls

Linux ARMv6 cross compiler toolchain for the Raspberry Pi

dockcross/linux-armv6-lts

Docker Image Size (tag) Docker Pulls

Linux ARMv6 cross compiler toolchain for the Raspberry Pi (Debian buster...)

dockcross/linux-armv6-musl

Docker Image Size (tag) Docker Pulls

Linux ARMv6 cross compiler toolchain for the Raspberry Pi, etc, using musl as base "libc".

dockcross/linux-armv7

Docker Image Size (tag) Docker Pulls

Generic Linux armv7 cross compiler toolchain.

dockcross/linux-armv7-lts

Docker Image Size (tag) Docker Pulls

Linux ARMv7 cross compiler toolchain for the Raspberry Pi (Debian buster...)

dockcross/linux-armv7a

Docker Image Size (tag) Docker Pulls

Toolchain configured for ARMv7-A used in Beaglebone Black single board PC with TI SoC AM3358 on board, Cortex-A8.

dockcross/linux-armv7l-musl

Docker Image Size (tag) Docker Pulls

Toolchain configured for ARMv7-L, using musl as base "libc".

dockcross/linux-mips

Docker Image Size (tag) Docker Pulls

Linux mips cross compiler toolchain for big endian 32-bit hard float MIPS GNU systems.

dockcross/linux-s390x

Docker Image Size (tag) Docker Pulls

Linux s390x cross compiler toolchain for S390X GNU systems.

dockcross/linux-riscv64

Docker Image Size (tag) Docker Pulls

Linux risc-v 64bit cross compiler toolchain for risc-v 64bit GNU systems.

dockcross/linux-riscv32

Docker Image Size (tag) Docker Pulls

Linux risc-v 32bit cross compiler toolchain for risc-v 32bit GNU systems.

dockcross/linux-m68k-uclibc

Docker Image Size (tag) Docker Pulls

Linux m68k cross compiler toolchain for m68k GNU systems (http://www.mac.linux-m68k.org/ and http://www.linux-m68k.org/).

dockcross/linux-ppc64le

Docker Image Size (tag) Docker Pulls

Linux PowerPC 64 little endian cross compiler toolchain for the POWER8, etc. Important: Due to Issue #430, automatic build of newer images has been disabled.

dockcross/linux-x64

Docker Image Size (tag) Docker Pulls

Linux x86_64/amd64 compiler. Since the Docker image is natively x86_64, this is not actually a cross compiler.

dockcross/linux-x86_64-full

Docker Image Size (tag) Docker Pulls

Linux x86_64/amd64 compiler with libs: SDL2, OpenSSL, Boost, OpenCV and Qt5 (minimal).

dockcross/linux-x64-clang

Docker Image Size (tag) Docker Pulls

Linux clang x86_64/amd64 compiler. Since the Docker image is natively x86_64, this is not actually a cross compiler.

dockcross/linux-x86

Docker Image Size (tag) Docker Pulls

Linux i686 cross compiler.

dockcross/linux-x64-tinycc

Docker Image Size (tag) Docker Pulls

Linux tcc compiler for C compiler, and GCC for C++ compiler, for linux x86_64/amd64 arch.

dockcross/manylinux2014-x64

Docker Image Size (tag) Docker Pulls

Docker manylinux2014 image for building Linux x86_64 / amd64 Python wheel packages. It includes Python 3.5, 3.6, 3.7, 3.8, and 3.9. Also has support for the dockcross script, and it has installations of CMake, Ninja, and scikit-build. For CMake, it sets MANYLINUX2014 to "TRUE" in the toolchain.

dockcross/manylinux2014-x86

Docker Image Size (tag) Docker Pulls

Docker manylinux2014 image for building Linux i686 Python wheel packages. It includes Python 3.5, 3.6, 3.7, 3.8, and 3.9. Also has support for the dockcross script, and it has installations of CMake, Ninja, and scikit-build. For CMake, it sets MANYLINUX2014 to "TRUE" in the toolchain.

dockcross/manylinux2014-aarch64

Docker Image Size (tag) Docker Pulls

Docker manylinux2014 image for building Linux aarch64 / arm64 Python wheel packages. It includes Python 3.5, 3.6, 3.7, 3.8, and 3.9. Also has support for the dockcross script, and it has installations of CMake, Ninja, and scikit-build. For CMake, it sets MANYLINUX2014 to "TRUE" in the toolchain.

dockcross/web-wasm

Docker Image Size (tag) Docker Pulls

The Emscripten WebAssembly/JavaScript cross compiler.

dockcross/web-wasi

Docker Image Size (tag) Docker Pulls

The WebAssembly System Interface (WASI) SDK LLVM/Clang/WASI Sysroot cross compiler.

dockcross/windows-static-x64

Docker Image Size (tag) Docker Pulls

64-bit Windows cross-compiler based on MXE/MinGW-w64 with win32 threads and static linking.

dockcross/windows-static-x64-posix

Docker Image Size (tag) Docker Pulls

64-bit Windows cross-compiler based on MXE/MinGW-w64 with posix threads and static linking.

dockcross/windows-static-x86

Docker Image Size (tag) Docker Pulls

32-bit Windows cross-compiler based on MXE/MinGW-w64 with win32 threads and static linking.

dockcross/windows-shared-x64

Docker Image Size (tag) Docker Pulls

64-bit Windows cross-compiler based on MXE/MinGW-w64 with win32 threads and dynamic linking.

dockcross/windows-shared-x64-posix

Docker Image Size (tag) Docker Pulls

64-bit Windows cross-compiler based on MXE/MinGW-w64 with posix threads and dynamic linking.

dockcross/windows-shared-x86

Docker Image Size (tag) Docker Pulls

32-bit Windows cross-compiler based on MXE/MinGW-w64 with win32 threads and dynamic linking.

dockcross/windows-armv7

Docker Image Size (tag) Docker Pulls

ARMv7 32-bit Windows cross-compiler based on LLVM/MinGW-w64

dockcross/windows-arm64

Docker Image Size (tag) Docker Pulls

ARMv8 64-bit Windows cross-compiler based on llvm-mingw

Articles

Built-in update commands

A special update command can be executed that will update the source cross-compiler Docker image or the dockcross script itself.

  • dockcross [--] command [args...]: Forces a command to run inside the container (in case of a name clash with a built-in command), use -- before the command.
  • dockcross update-image: Fetch the latest version of the docker image.
  • dockcross update-script: Update the installed dockcross script with the one bundled in the image.
  • dockcross update: Update both the docker image, and the dockcross script.

Download all images

To easily download all images, the convenience target display_images could be used:

curl https://raw.githubusercontent.com/dockcross/dockcross/master/Makefile -o dockcross-Makefile
for image in $(make -f dockcross-Makefile display_images); do
  echo "Pulling dockcross/$image"
  docker pull dockcross/$image
done

Install all dockcross scripts

To automatically install in ~/bin the dockcross scripts for each images already downloaded, the convenience target display_images could be used:

~/bin/dockcross-$image && \ chmod u+x ~/bin/dockcross-$image done ">
curl https://raw.githubusercontent.com/dockcross/dockcross/master/Makefile -o dockcross-Makefile
for image in $(make -f dockcross-Makefile display_images); do
  if [[ $(docker images -q dockcross/$image) == "" ]]; then
    echo "~/bin/dockcross-$image skipping: image not found locally"
    continue
  fi
  echo "~/bin/dockcross-$image ok"
  docker run dockcross/$image > ~/bin/dockcross-$image && \
  chmod u+x  ~/bin/dockcross-$image
done

Dockcross configuration

The following environmental variables and command-line options are used. In all cases, the command-line option overrides the environment variable.

DOCKCROSS_CONFIG / --config|-c

This file is sourced, if it exists, before executing the rest of the dockcross script.

Default: ~/.dockcross

DOCKCROSS_IMAGE / --image|-i

The Docker cross-compiler image to run.

Default: Image with which the script was created.

DOCKCROSS_ARGS / --args|-a

Extra arguments to pass to the docker run command. Quote the entire set of args if they contain spaces.

Per-project dockcross configuration

If a shell script named .dockcross is found in the current directory where the dockcross script is started, it is executed before the dockcross script command argument. The shell script is expected to have a shebang like #!/usr/bin/env bash.

For example, commands like git config --global advice.detachedHead false can be added to this script.

How to extend Dockcross images

In order to extend Dockcross images with your own commands, one must:

  1. Use FROM dockcross/ .
  2. Set DEFAULT_DOCKCROSS_IMAGE to a name of the tag you're planning to use for the image. This tag must then be used during the build phase, unless you mean to pass the resulting helper script the DOCKCROSS_IMAGE argument.

An example Dockerfile would be:

FROM dockcross/linux-armv7

ENV DEFAULT_DOCKCROSS_IMAGE my_cool_image
RUN apt-get install nano

And then in the shell:

docker build -t my_cool_image .                   ## Builds the dockcross image.
docker run my_cool_image > linux-armv7                ## Creates a helper script named linux-armv7.
chmod +x linux-armv7                          ## Gives the script execution permission.
./linux-armv7 bash                            ## Runs the helper script with the argument "bash", which starts an interactive container using your extended image.

What is the difference between dockcross and dockbuild ?

The key difference is that dockbuild images do NOT provide a toolchain file but they use the same method to conveniently isolate the build environment as dockcross.

dockbuild is used to build binaries for Linux x86_64/amd64 that will work across most Linux distributions. dockbuild performs a native Linux build where the host build system is a Linux x86_64 / amd64 Docker image (so that it can be used for building binaries on any system which can run Docker images) and the target runtime system is Linux x86_x64/ amd64.

dockcross is used to build binaries for many different platforms. dockcross performs a cross compilation where the host build system is a Linux x86_64 / amd64 Docker image (so that it can be used for building binaries on any system which can run Docker images) and the target runtime system varies.

---

Credits:

Comments
  • Revisit ARM64 move to crosstool-ng

    Revisit ARM64 move to crosstool-ng

    Hi all,

    there was some back and forth recently with arm64. It was moved to crosstool-ng, which broke some backwards compatibility and the fortran compiler was lost. Some of this has been fixed already. However, there was a state of confusion in which some path changes were made that had no real effect.

    Today I took some time and compared the arm64 container to the other two crosstool-ng containers, mips and s390x, and could see that the configuration of arm64 differs significantly from the other two, which are well aligned.

    What I'd like to do in this pull request is revisit the arm64 move to crosstool-ng, and align it well to the other two targets, and only afterwards fix the open issue that the crosscompiler binaries are not in $PATH. In the current state of the PR, arm64, mips and s390x only differ in the target triples, which is the desired state imo.

    @nadav-eyesight, would you be so kind and review this pull request. In your original PR, you additionally introduced some arm64 dev libraries, manually installed qemu from source and added new debian repos. I think the first one was needed because of some opengl bindings. For the other two, I unfortunately couldn't find an explanation. Could you kindly review this PR and check which of these are still needed for your use case, so I can pull respective changes in.

    @marcoabreu, your fortran support should be onboard by default. If you've got some free time, kindly review it.

    @thewtex, after feedback from @nadav-eyesight and @marcoabreu was received, I would go on and add a patch or new PR that finally adds the binaries of all the crosstool-ng containers to $PATH.

    BR, Andre

  • Problems when compile CEF using armv7

    Problems when compile CEF using armv7

    Hi,

    I have tried compile my project into armv7 to run in my raspberry pi 3 that is armv7.

    My project: https://github.com/paulo-coutinho/cef-sample

    Im using this commands:

    git clone https://github.com/paulo-coutinho/cef-sample.git
    cd cef-sample
    docker run --rm dockcross/linux-armv7 > ./dockcross
    chmod +x dockcross
    ./dockcross cmake -Bbuild -H. -GNinja -DCMAKE_BUILD_TYPE=Release -DCEF_PLATFORM=linuxarm
    ./dockcross cmake --build build --target MyApp --config Release -v
    

    But im getting this error:

    FAILED: libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_atomicops_x86_gcc.cc.o 
    /usr/xcc/armv7-unknown-linux-gnueabi/bin/armv7-unknown-linux-gnueabi-g++ --sysroot=/usr/xcc/armv7-unknown-linux-gnueabi/armv7-unknown-linux-gnueabi/sysroot  -DCEF_USE_SANDBOX -DNDEBUG -DWRAPPING_CEF_SHARED -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -I../temp/cef/cef_binary_91.1.20+g5800665+chromium-91.0.4472.101_linuxarm -I /usr/xcc/armv7-unknown-linux-gnueabi/include/ -O3 -DNDEBUG   -fno-strict-aliasing -fPIC -fstack-protector -funwind-tables -fvisibility=hidden --param=ssp-buffer-size=4 -pipe -pthread -Wall -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-error=comment -Wno-comment -Wno-deprecated-declarations -msse2 -mfpmath=sse -mmmx -m32 -fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -std=gnu++11 -Wsign-compare -Wno-undefined-var-template -Wno-literal-suffix -Wno-narrowing -Wno-attributes -O2 -fdata-sections -ffunction-sections -fno-ident -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MT libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_atomicops_x86_gcc.cc.o -MF libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_atomicops_x86_gcc.cc.o.d -o libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/base/cef_atomicops_x86_gcc.cc.o -c ../temp/cef/cef_binary_91.1.20+g5800665+chromium-91.0.4472.101_linuxarm/libcef_dll/base/cef_atomicops_x86_gcc.cc
    armv7-unknown-linux-gnueabi-g++: error: unrecognized command line option '-msse2'
    armv7-unknown-linux-gnueabi-g++: error: unrecognized command line option '-mfpmath=sse'
    armv7-unknown-linux-gnueabi-g++: error: unrecognized command line option '-mmmx'
    armv7-unknown-linux-gnueabi-g++: error: unrecognized command line option '-m32'
    ninja: build stopped: subcommand failed.
    

    Can you help?

    You project will help a lot port the samples to arm[32,64].

    Thanks.

  • Add support for manylinux2014-aarch64

    Add support for manylinux2014-aarch64

    Resolves #367.

    Add support for manylinux2014-aarch64:

    • Added Dockerfile, Toolchain, and crosstool config (Referred linux-arm64 wherever requried).
    • Using FROM dockcross/manylinux2014-x64 image.
    • Updated Makefile.
    • To build manylinux2014-aarch64 locally just use 'make manylinux2014-aarch64'.
    • Run test is successful. Used 'make manylinux2014-aarch64.test.
    • Also added manylinux2014-aarch64 in circleCI config file referring manylinux2014-x64.
  • Linux arm64

    Linux arm64

    Howdy. I've spent the past three weeks compiling my project, which uses OpenCV, to Linux-arm64.

    It hasn't been easy. My current solution uses hacks- manually soft linking header files from /usr/include to my cross compiler's sysroot's /include path (in my case, /opt/x-tools/aarch64-unknown-linux-gnueabi/include/.

    I don't know why that is required, either I'm missing something or something's wrong with pkg-config.

    This branch is my attempt to add my solution to dockcross, I doubt it's perfect in its current shape, but I'm starting the pull request so you can review it right now.

  • Update armv6 to a newer libc >= 2.16

    Update armv6 to a newer libc >= 2.16

    I got stuck in compiling my programm for Pi2 using ARMv6 because it links against a dependency the requires a newer glibc: /usr/lib/libSDL2.so: undefined reference to [email protected]_2.15' /usr/lib/libSDL2.so: undefined reference to[email protected]_2.16' The toolchain provides only glibc 2.13 .

    Help would be very much appreciated. Thx Steve

  • Add Support For ARM-Cortex A7, Cortex A53 bare metal cross compilers

    Add Support For ARM-Cortex A7, Cortex A53 bare metal cross compilers

    Remarks: #124

    (1) Linking c++ executable triggers this error:

    Solved
    

    (2) Add support for "Architecture options usage"

    Rely on User
    

    (3) Provide mechanism to switch spec (rdimon.specs , nano.specs, ...)

    No Idea, but i have aarch64 in /opt/linaro directory, only need to change `cross_path` and `cross_triple` for the outpur script. Maybe you can help me out.
    

    (4) Look into seg fault when trying to use qemu-arm:

     "--emulator "/usr/bin/qemu-arm" in Makefile
    
  • linux-armv6 Compiler not usable on Windows Host

    linux-armv6 Compiler not usable on Windows Host

    I am trying to run armv6 cross compiler on docker for windows.

    [email protected] MINGW64 /c/workspace/test-pi-cross $ docker run --rm dockcross/linux-armv6 > ./dockcross

    [email protected] MINGW64 /c/workspace/test-pi-cross $ ./dockcross bash [root:/work] # ls CMakeLists.txt HelloWorld.cpp build-lin-x64 dockcross helloworld.c [root:/work] # echo "int main(){return 0;}" > test.c [root:/work] # cat test.c int main(){return 0;} [root:/work] # $CC test.c cc1: fatal error: test.c: Value too large for defined data type compilation terminated. [root:/work] 1 # cp test.c /tmp/ [root:/work] # $CC /tmp/test.c [root:/work] # exit exit

    I think this bug is related to https://github.com/docker/for-win/issues/15, ie, the cross compiler executable itself is not build with large file offset support. Same problem does not occur with linux-x64 cross compiler image.

  • Add example where we build against a dependency

    Add example where we build against a dependency

    Since it may not be common knowledge, we should add an explicit, small, self-contained example of building against a dependency.

    Two strategies can be demonstrated -- if it is a CMake project, we can show how to build against the dependency build tree by passing <depname>_DIR. We can also show how to install into a common local install prefix directory, then use it with CMake.

    We should use a relatively small, simple dependency for the example.

    Suggested-by: @fbudin69500

  • CYGWIN: introduce cygwin host system awareness.

    CYGWIN: introduce cygwin host system awareness.

    implements the use of this solution using (recent) docker-desktop (implemented in wsl2), on windows host, from within cygwin environment. (docker command line requires windows path, the conversion between cygwin path and windows path can be obtained via the cygwin specific cygpath instruction).

  • SSH Support for Git Clone / Checkout

    SSH Support for Git Clone / Checkout

    Added SSH support to enable Git checkouts that use SSH instead of HTTP(S).

    The SSH directory is assumed to be in $HOME/.ssh; however:

    export SSH_DIR=/my/custom/dir

    will override the setting and allow for configurable settings.

    $SSH_DIR is then mounted as host-volume in the Docker container and placed in /home/<user>/.ssh

  • linux-arm64 vs manylinux2014-aarch64

    linux-arm64 vs manylinux2014-aarch64

    I am interested in building manylinux2014-aarch binaries with dockcross. There exists a pypa/manylinux2014-aarch64 image, but that docker image needs to be run on an aarch64 machine (which is exactly what we don't want in dockcross).

    So I've been looking at the dockcross/linux-arm64 image. Let's first take a step back. The manylinux2014 PEP says:

    The wheel's binary executables or shared objects may not link against externally-provided libraries except those in the following list:
    
    libgcc_s.so.1*
    libstdc++.so.6*
    libm.so.6*
    libdl.so.2*
    librt.so.1*
    libc.so.6*
    libnsl.so.1*
    libutil.so.1
    libpthread.so.0*
    libresolv.so.2
    libX11.so.6
    libXext.so.6
    libXrender.so.1
    libICE.so.6
    libSM.so.6
    libGL.so.1
    libgobject-2.0.so.0
    libgthread-2.0.so.0
    libglib-2.0.so.0
    

    I tried to build a binary with dockcross/linux-arm64, and in my case it is linked against (according to readelf --dynamic):

    libpthread.so.0
    libnsl.so.1
    libdl.so.2
    librt.so.1
    libstdc++.so.6
    libm.so.6
    libgcc_s.so.1
    libc.so.6
    

    Which are all part of the PEP599 definition above (I marked them with a star (*) up there).

    However, PEP599 says:

    If the wheel contains binary executables or shared objects linked against any allowed libraries that also export versioned symbols, they may only depend on the following maximum versions:
    
    GLIBC_2.17
    CXXABI_1.3.7, CXXABI_TM_1 is also allowed
    GLIBCXX_3.4.19
    GCC_4.8.0
    

    And in my case, objdump -T shows me one symbol using GLIBCXX_3.4.19, and one using CXXABI_1.3.8.

    So in this specific case, I am not far from being manylinux2010-aarch64-compliant, except for those few symbols. I believe that it is a coincidence, and dockcross/linux-arm64 cannot give me any guarantee.

    Then I naively thought that I could just take the Dockerfile of pypa/manylinux2014-aarch64 and adapt it for dockcross, but that's not working: manylinux2014 works by using a CentOS 7 base image. But when cross-compiling, what imports is the toolchain, not the base image. Right?

    So how should I proceed if I wanted to create a dockcross/manylinux2014-aarch64 image, i.e. an image that would cross-compile instead of the pypa/manylinux2014-aarch64 that must run on an aarch64 machine? Any idea?

  • armv7-lts: gnu/stubs-hard.h: No such file or directory

    armv7-lts: gnu/stubs-hard.h: No such file or directory

    I'm trying to use dockcross/linux-armv7-lts but i get the following error:

    In file included from /usr/xcc/armv7-unknown-linux-gnueabi/armv7-unknown-linux-gnueabi/sysroot/usr/include/features.h:452,
                     from /usr/xcc/armv7-unknown-linux-gnueabi/armv7-unknown-linux-gnueabi/sysroot/usr/include/bits/libc-header-start.h:33,
                     from /usr/xcc/armv7-unknown-linux-gnueabi/armv7-unknown-linux-gnueabi/sysroot/usr/include/stdio.h:27,
                     from target/sqlite-3.39.2-Linux-armv7/sqlite3.c:14044:
    /usr/xcc/armv7-unknown-linux-gnueabi/armv7-unknown-linux-gnueabi/sysroot/usr/include/gnu/stubs.h:10:11: fatal error: gnu/stubs-hard.h: No such file or directory
     # include <gnu/stubs-hard.h>
               ^~~~~~~~~~~~~~~~~~
    compilation terminated.
    

    I checked in the docker image, the file /usr/xcc/armv7-unknown-linux-gnueabi/armv7-unknown-linux-gnueabi/sysroot/usr/include/gnu/stubs-hard.h is not there:

    [root:/usr … ux-gnueabi/armv7-unknown-linux-gnueabi/sysroot/usr/include/gnu] # ls -al
    total 28
    dr-xr-xr-x  2 root root 4096 Jul  7 04:17 .
    dr-xr-xr-x 33 root root 4096 Jul  7 04:37 ..
    -r--r--r--  1 root root 1653 Jul  7 04:17 lib-names-soft.h
    -r--r--r--  1 root root  374 Jul  7 04:17 lib-names.h
    -r--r--r--  1 root root 1263 Jul  7 04:17 libc-version.h
    -r--r--r--  1 root root  742 Jul  7 04:17 stubs-soft.h
    -r--r--r--  1 root root  295 Jul  7 04:17 stubs.h
    

    Not sure if that's expected or something missing?

  • Improve ci testing

    Improve ci testing

    This pull request improve the build-system to ensure the image are pulled only when needed.

    • Update test targets and scripts to ensure "docker run" always uses the local image
    • Add targets for saving/loading locally cached images
    • Add /fast targets to avoid rebuilding existing dependency byproducts

    It also cherry pick the change originally associated with https://github.com/dockcross/dockcross/pull/715

  • dockcross-script: use tagged version

    dockcross-script: use tagged version

    Use the tagged version of image in the dockcross bash script.

    Previously the latest version was always used. This is problematic because 1) a different version of the image can used than the one that was used to generate the script, and 2) if the script is moved to a different system without the latest version or the latest image is removed, the script will fail to run.

    Pass the missing VERSION ARG and fix up a few images that had missing or incorrect label metadata.

  • dockcross/web-wasm not support Apple M1 build

    dockcross/web-wasm not support Apple M1 build

    When i run docker run dockcross/web-wasm on my M1 mac, I got this error.

    WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
    Setting environment variables
    
    image
  • How to include dependencies via pkg_search_module?

    How to include dependencies via pkg_search_module?

    Trying to compile a Conan/CMake library with some unit tests with this CMakeLists.txt: https://github.com/izzyreal/akaifat/blob/main/src/CMakeLists.txt

    It does pkg_search_module(udisks2 REQUIRED udisks2) which allows the units tests to link against udisks2 by doing:

        target_link_libraries(akaifat-tests Threads::Threads ${udisks2_LIBRARIES} akaifat)
    

    This works fine in non-cross-compile scenarios. But when I run the below inside a dockcross container:

    conan install .. -s arch=armv8 --build missing
    conan build ..
    

    the linker struggles:

    [100%] Linking CXX executable akaifat-tests
    /usr/xcc/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/11.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: cannot find -ludisks2
    /usr/xcc/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/11.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: cannot find -lgio-2.0
    /usr/xcc/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/11.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: cannot find -lgobject-2.0
    /usr/xcc/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/11.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: cannot find -lglib-2.0
    

    I've installed udisks2 and some related libs by doing

    sudo apt install udisks2:arm64 libudisks2-0:arm64 libudisks2-dev:arm64 libglib2.0-dev:arm64
    

    and verified they are present in /usr/lib/aarch64-linux-gnu

    What am I missing?

    Reproduction steps Assuming a dockcross executable is in your $PATH:

    git clone https://github.com/izzyreal/akaifat
    cd akaifat && mkdir build
    dockcross bash -c 'sudo dpkg --add-architecture arm64 && sudo apt update && sudo apt install udisks2:arm64 libudisks2-0:arm64 libudisks2-dev:arm64 libglib2.0-dev:arm64 && conan remote add jfrog-izmar https://izmar.jfrog.io/artifactory/api/conan/dev && cd build && conan install .. -s arch=armv8 --build missing && conan profile update settings.compiler.libcxx=libstdc++11 default && conan build ..'
    
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

Setup-free CMake dependency management CPM.cmake is a CMake script that adds dependency management capabilities to CMake. It's built as a thin wrapper

Aug 7, 2022
Template for reliable, cross-platform C++ project setup using cmake.

The C++ CMake Project Template cmake-init is a sophisticated copy & paste template for modern C and C++ projects. The main goals include support of al

Aug 3, 2022
Docker files and scripts to setup and run VINS-FUSION-gpu on NVIDIA jetson boards inside a docker container.

jetson_vins_fusion_docker This repository provides Docker files and scripts to easily setup and run VINS-FUSION-gpu on NVIDIA jetson boards inside a d

May 30, 2022
Toolchains for crosscompiling with CMake.

This repository contains toolchains usable for crosscompiling with CMake. They are meant to be used on ArchLinux, but they can also (with some directo

Jul 20, 2022
Guide to Cross Compiling on a Raspberry Pi

Guide to Cross Compilation for a Raspberry Pi > Start Setup XCS and RPi Setup RPi Network and SSH Setup RPi Peripherals Setup Cross-compile environmen

Apr 20, 2022
ShaderConductor is a tool designed for cross-compiling HLSL to other shading languages

ShaderConductor ShaderConductor is a tool designed for cross-compiling HLSL to other shading languages. Features Converts HLSL to readable, usable and

Aug 8, 2022
⚔️ A tool for cross compiling shaders. Convert between GLSL, HLSL, Metal Shader Language, or older versions of GLSL.
⚔️ A tool for cross compiling shaders. Convert between GLSL, HLSL, Metal Shader Language, or older versions of GLSL.

A cross compiler for shader languages. Convert between SPIR-V, GLSL / GLSL ES, HLSL, Metal Shader Language, or older versions of a given language. Cross Shader wraps glslang and SPIRV-Cross, exposing a simpler interface to transpile shaders.

Aug 2, 2022
zsh module for automatically compiling sourced files
zsh module for automatically compiling sourced files

Zinit Module Motivation The module is a binary Zsh module (think about zmodload Zsh command, it's that topic) which transparently and automatically co

Jul 8, 2022
A compiling time static reflection framework for C++

static_reflect This is a fully compiling time static reflection lightweight framework for C++. It provides a very rich compile-time reflection functio

Jul 19, 2022
Write snippets of C code in your txt files for notes and skip the hassle of compiling and running
Write snippets of C code in your txt files for notes and skip the hassle of compiling and running

Write snippets of C code in your txt files for notes and skip the hassle of compiling and running. Greatly helps organization and note-taking to make sure you do not miss anything.

Jun 13, 2022
runing qemu in Docker by BOA
runing qemu in Docker by BOA

myQemu runing qemu in Docker by BOA It currently only supports mipsel configuration, other architectures have not been added yet, please wait for subs

Jul 15, 2022
Write a Docker in C

mydocker-c 此项目旨在通过用 C 语言实现一个简单的 Docker,了解 Docker 的运行原理,包括但不限于阅读分析相关的 Linux 内核源码。 预备知识 C 语言基础。本文不会介绍基础的 C 语言语法。 Linux 系统编程基础

Apr 24, 2022
sour is a complete multiplayer Sauerbraten experience in the web delivered as a single Docker image.

sour sour is a complete multiplayer Sauerbraten experience in the web delivered as a single Docker image. Overview I have always loved playing Sauerbr

Jul 28, 2022
A docker image where you can run a judge program and a converter for multiple sequence alignment

genocon2021-docker 本リポジトリでは、ジャッジプログラム(eval.c)と Multiple Sequence Alignment (MSA) 変換プログラム(decode_cigar.py)を同梱した Docker イメージを提供しています。 また、サンプル解答プログラム(sam

Sep 20, 2021
Photon OS DPDK and Packet Generator, RT Test, TF2 docker image.

photongen Photon OS DPDK and packet generator , cyclictest , TF2 with CUDA docker image. DPKD libs The build proccess builds and installs all shared l

Feb 7, 2022
docker-nginx-with-image-filter

docker-nginx-with-image-filter 因为官方镜像默认没有启用该模块,故自己做了一个Dockerfile,并编译,docker镜像地址: docker pull smally84/nginx-with-image-filter:1.20.1 附上Dockerfile ###

Dec 11, 2021
Running Docker container on Raspberry Pi (armhf)

Running Docker container on Raspberry Pi (armhf)

Nov 15, 2021
Dockerfile/docker-compose Elasticsearch with plugins elasticsearch-analysis-vietnamese and coccoc-tokenizer

docker-es-cococ-tokenizer Dockerfile/docker-compose Elasticsearch with plugins elasticsearch-analysis-vietnamese and coccoc-tokenizer Deployment docke

Jul 11, 2022
Northstar-dedicated - Docker container for the Northstar dedicated server. Also includes general notes on running the dedi on Linux. WIP.

northstar-dedicated Docker image for the Northstar dedicated server. Not ready yet (it'll probably be another day or two). Versioning Tentative. Stabl

Aug 16, 2022
CVE-2021-4034 POC and Docker and Analysis write up
CVE-2021-4034 POC and Docker and Analysis write up

CVE-2021-4034 POC and Docker and Analysis write up

Jul 28, 2022