├── .dockerignore ├── .github └── workflows │ └── actions.yml ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── assets ├── crossbuild └── osxcross-wrapper ├── test.sh └── test ├── Makefile ├── helloworld.c └── objective-c-hello-world └── Dockerfile /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .github 3 | LICENSE 4 | *.md -------------------------------------------------------------------------------- /.github/workflows/actions.yml: -------------------------------------------------------------------------------- 1 | name: actions 2 | on: 3 | push: 4 | branches: 5 | - master 6 | pull_request: 7 | branches: 8 | - master 9 | jobs: 10 | crossbuild: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v2 14 | - name: Set variables 15 | run: | 16 | echo "DOCKER_REPO=docker.io/$GITHUB_REPOSITORY" >> $GITHUB_ENV 17 | - name: Build 18 | run: docker build -t ${{ env.DOCKER_REPO }} . 19 | - name: Test 20 | run: ./test.sh -d "${{ env.DOCKER_REPO }}" 21 | - name: Publish 22 | if: github.ref == 'refs/heads/master' 23 | run: | 24 | docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_TOKEN }} 25 | docker push ${{ env.DOCKER_REPO }} 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # dummy files 2 | *~ 3 | .#* 4 | *# 5 | .built 6 | 7 | # binaries 8 | test/helloworld 9 | a.out 10 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM buildpack-deps:stretch-curl 2 | MAINTAINER Manfred Touron (https://github.com/moul) 3 | 4 | # Install deps 5 | RUN set -x; echo "Starting image build for Debian Stretch" \ 6 | && dpkg --add-architecture arm64 \ 7 | && dpkg --add-architecture armel \ 8 | && dpkg --add-architecture armhf \ 9 | && dpkg --add-architecture i386 \ 10 | && dpkg --add-architecture mips \ 11 | && dpkg --add-architecture mipsel \ 12 | && dpkg --add-architecture powerpc \ 13 | && dpkg --add-architecture ppc64el \ 14 | && apt-get update \ 15 | && apt-get install -y -q \ 16 | autoconf \ 17 | automake \ 18 | autotools-dev \ 19 | bc \ 20 | binfmt-support \ 21 | binutils-multiarch \ 22 | binutils-multiarch-dev \ 23 | build-essential \ 24 | ccache \ 25 | clang \ 26 | crossbuild-essential-arm64 \ 27 | crossbuild-essential-armel \ 28 | crossbuild-essential-armhf \ 29 | crossbuild-essential-mipsel \ 30 | crossbuild-essential-ppc64el \ 31 | curl \ 32 | devscripts \ 33 | gdb \ 34 | git-core \ 35 | libtool \ 36 | llvm \ 37 | mercurial \ 38 | multistrap \ 39 | patch \ 40 | software-properties-common \ 41 | subversion \ 42 | wget \ 43 | xz-utils \ 44 | cmake \ 45 | qemu-user-static \ 46 | libxml2-dev \ 47 | lzma-dev \ 48 | openssl \ 49 | libssl-dev \ 50 | && apt-get clean 51 | # FIXME: install gcc-multilib 52 | # FIXME: add mips and powerpc architectures 53 | 54 | 55 | # Install Windows cross-tools 56 | RUN apt-get install -y mingw-w64 \ 57 | && apt-get clean 58 | 59 | 60 | # Install OSx cross-tools 61 | 62 | #Build arguments 63 | ARG osxcross_repo="tpoechtrager/osxcross" 64 | ARG osxcross_revision="542acc2ef6c21aeb3f109c03748b1015a71fed63" 65 | ARG darwin_sdk_version="10.10" 66 | ARG darwin_osx_version_min="10.6" 67 | ARG darwin_version="14" 68 | ARG darwin_sdk_url="https://www.dropbox.com/s/yfbesd249w10lpc/MacOSX${darwin_sdk_version}.sdk.tar.xz" 69 | 70 | # ENV available in docker image 71 | ENV OSXCROSS_REPO="${osxcross_repo}" \ 72 | OSXCROSS_REVISION="${osxcross_revision}" \ 73 | DARWIN_SDK_VERSION="${darwin_sdk_version}" \ 74 | DARWIN_VERSION="${darwin_version}" \ 75 | DARWIN_OSX_VERSION_MIN="${darwin_osx_version_min}" \ 76 | DARWIN_SDK_URL="${darwin_sdk_url}" 77 | 78 | RUN mkdir -p "/tmp/osxcross" \ 79 | && cd "/tmp/osxcross" \ 80 | && curl -sLo osxcross.tar.gz "https://codeload.github.com/${OSXCROSS_REPO}/tar.gz/${OSXCROSS_REVISION}" \ 81 | && tar --strip=1 -xzf osxcross.tar.gz \ 82 | && rm -f osxcross.tar.gz \ 83 | && curl -sLo tarballs/MacOSX${DARWIN_SDK_VERSION}.sdk.tar.xz \ 84 | "${DARWIN_SDK_URL}" \ 85 | && yes "" | SDK_VERSION="${DARWIN_SDK_VERSION}" OSX_VERSION_MIN="${DARWIN_OSX_VERSION_MIN}" ./build.sh \ 86 | && mv target /usr/osxcross \ 87 | && mv tools /usr/osxcross/ \ 88 | && ln -sf ../tools/osxcross-macports /usr/osxcross/bin/omp \ 89 | && ln -sf ../tools/osxcross-macports /usr/osxcross/bin/osxcross-macports \ 90 | && ln -sf ../tools/osxcross-macports /usr/osxcross/bin/osxcross-mp \ 91 | && sed -i -e "s%exec cmake%exec /usr/bin/cmake%" /usr/osxcross/bin/osxcross-cmake \ 92 | && rm -rf /tmp/osxcross \ 93 | && rm -rf "/usr/osxcross/SDK/MacOSX${DARWIN_SDK_VERSION}.sdk/usr/share/man" 94 | 95 | 96 | # Create symlinks for triples and set default CROSS_TRIPLE 97 | ENV LINUX_TRIPLES=arm-linux-gnueabi,arm-linux-gnueabihf,aarch64-linux-gnu,mipsel-linux-gnu,powerpc64le-linux-gnu \ 98 | DARWIN_TRIPLES=x86_64h-apple-darwin${DARWIN_VERSION},x86_64-apple-darwin${DARWIN_VERSION},i386-apple-darwin${DARWIN_VERSION} \ 99 | WINDOWS_TRIPLES=i686-w64-mingw32,x86_64-w64-mingw32 \ 100 | CROSS_TRIPLE=x86_64-linux-gnu 101 | COPY ./assets/osxcross-wrapper /usr/bin/osxcross-wrapper 102 | RUN mkdir -p /usr/x86_64-linux-gnu; \ 103 | for triple in $(echo ${LINUX_TRIPLES} | tr "," " "); do \ 104 | for bin in /usr/bin/$triple-*; do \ 105 | if [ ! -f /usr/$triple/bin/$(basename $bin | sed "s/$triple-//") ]; then \ 106 | ln -s $bin /usr/$triple/bin/$(basename $bin | sed "s/$triple-//"); \ 107 | fi; \ 108 | done; \ 109 | for bin in /usr/bin/$triple-*; do \ 110 | if [ ! -f /usr/$triple/bin/cc ]; then \ 111 | ln -s gcc /usr/$triple/bin/cc; \ 112 | fi; \ 113 | done; \ 114 | done && \ 115 | for triple in $(echo ${DARWIN_TRIPLES} | tr "," " "); do \ 116 | mkdir -p /usr/$triple/bin; \ 117 | for bin in /usr/osxcross/bin/$triple-*; do \ 118 | ln /usr/bin/osxcross-wrapper /usr/$triple/bin/$(basename $bin | sed "s/$triple-//"); \ 119 | done && \ 120 | rm -f /usr/$triple/bin/clang*; \ 121 | ln -s cc /usr/$triple/bin/gcc; \ 122 | ln -s /usr/osxcross/SDK/MacOSX${DARWIN_SDK_VERSION}.sdk/usr /usr/x86_64-linux-gnu/$triple; \ 123 | done; \ 124 | for triple in $(echo ${WINDOWS_TRIPLES} | tr "," " "); do \ 125 | mkdir -p /usr/$triple/bin; \ 126 | for bin in /etc/alternatives/$triple-* /usr/bin/$triple-*; do \ 127 | if [ ! -f /usr/$triple/bin/$(basename $bin | sed "s/$triple-//") ]; then \ 128 | ln -s $bin /usr/$triple/bin/$(basename $bin | sed "s/$triple-//"); \ 129 | fi; \ 130 | done; \ 131 | ln -s gcc /usr/$triple/bin/cc; \ 132 | ln -s /usr/$triple /usr/x86_64-linux-gnu/$triple; \ 133 | done 134 | # we need to use default clang binary to avoid a bug in osxcross that recursively call himself 135 | # with more and more parameters 136 | 137 | ENV LD_LIBRARY_PATH /usr/osxcross/lib:$LD_LIBRARY_PATH 138 | 139 | # Image metadata 140 | ENTRYPOINT ["/usr/bin/crossbuild"] 141 | CMD ["/bin/bash"] 142 | WORKDIR /workdir 143 | COPY ./assets/crossbuild /usr/bin/crossbuild 144 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Multiarch 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # crossbuild 2 | :earth_africa: multiarch cross compiling environments 3 | 4 | [![actions](https://github.com/multiarch/crossbuild/actions/workflows/actions.yml/badge.svg)](https://github.com/multiarch/crossbuild/actions/workflows/actions.yml) 5 | 6 | ![](https://raw.githubusercontent.com/multiarch/dockerfile/master/logo.jpg) 7 | 8 | This is a multiarch Docker build environment image. 9 | You can use this image to produce binaries for multiple architectures. 10 | 11 | ## Supported targets 12 | 13 | Triple | Aliases | linux | osx | windows 14 | -----------------------|-------------------------------------|-------|-----|-------- 15 | x86_64-linux-gnu | **(default)**, linux, amd64, x86_64 | X | | 16 | arm-linux-gnueabi | arm, armv5 | X | | 17 | arm-linux-gnueabihf | armhf, armv7, armv7l | X | | 18 | aarch64-linux-gnu | arm64, aarch64 | X | | 19 | mipsel-linux-gnu | mips, mipsel | X | | 20 | powerpc64le-linux-gnu | powerpc, powerpc64, powerpc64le | X | | 21 | x86_64-apple-darwin | osx, osx64, darwin, darwin64 | | X | 22 | x86_64h-apple-darwin | osx64h, darwin64h, x86_64h | | X | 23 | i386-apple-darwin | osx32, darwin32 | | X | 24 | x86_64-w64-mingw32 | windows, win64 | | | X 25 | i686-w64-mingw32 | win32 | | | X 26 | 27 | ## Using crossbuild 28 | 29 | #### x86_64 30 | 31 | ```console 32 | $ docker run --rm -v $(pwd):/workdir multiarch/crossbuild make helloworld 33 | cc helloworld.c -o helloworld 34 | $ file helloworld 35 | helloworld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=9cfb3d5b46cba98c5aa99db67398afbebb270cb9, not stripped 36 | ``` 37 | 38 | Misc: using `cc` instead of `make` 39 | 40 | ```console 41 | $ docker run --rm -v $(pwd):/workdir multiarch/crossbuild cc test/helloworld.c 42 | ``` 43 | 44 | #### arm 45 | 46 | ```console 47 | $ docker run --rm -v $(pwd):/workdir -e CROSS_TRIPLE=arm-linux-gnueabi multiarch/crossbuild make helloworld 48 | cc helloworld.c -o helloworld 49 | $ file helloworld 50 | helloworld: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=c8667acaa127072e05ddb9f67a5e48a337c80bc9, not stripped 51 | ``` 52 | 53 | #### armhf 54 | 55 | ```console 56 | $ docker run --rm -v $(pwd):/workdir -e CROSS_TRIPLE=arm-linux-gnueabihf multiarch/crossbuild make helloworld 57 | cc helloworld.c -o helloworld 58 | $ file helloworld 59 | helloworld: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=ad507da0b9aeb78e7b824692d4bae6b2e6084598, not stripped 60 | ``` 61 | 62 | #### powerpc 64-bit el 63 | 64 | ```console 65 | $ docker run --rm -v $(pwd):/workdir -e CROSS_TRIPLE=powerpc64le-linux-gnu multiarch/crossbuild make helloworld 66 | cc helloworld.c -o helloworld 67 | $ file helloworld 68 | helloworld: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=035c50a8b410361d3069f77e2ec2454c70a140e8, not st 69 | ripped 70 | ``` 71 | 72 | #### arm64 73 | 74 | ```console 75 | $ docker run --rm -v $(pwd):/workdir -e CROSS_TRIPLE=aarch64-linux-gnu multiarch/crossbuild make helloworld 76 | cc helloworld.c -o helloworld 77 | $ file helloworld 78 | helloworld: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.7.0, BuildID[sha1]=dce6100f0bc19504bc19987535f3cc04bd550d60, not stripped 79 | ``` 80 | 81 | #### mips el 82 | 83 | ```console 84 | $ docker run --rm -v $(pwd):/workdir -e CROSS_TRIPLE=mipsel-linux-gnu multiarch/crossbuild make helloworld 85 | cc helloworld.c -o helloworld 86 | $ file helloworld 87 | helloworld: ELF 32-bit LSB executable, MIPS, MIPS-II version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=d6b2f608a3c1a56b8b990be66eed0c41baaf97cd, not stripped 88 | ``` 89 | 90 | #### darwin i386 91 | 92 | ```console 93 | $ docker run -it --rm -v $(pwd):/workdir -e CROSS_TRIPLE=i386-apple-darwin multiarch/crossbuild make helloworld 94 | o32-clang helloworld.c -o helloworld 95 | $ file helloworld 96 | helloworld: Mach-O executable i386 97 | ``` 98 | 99 | #### darwin x86_64 100 | 101 | ```console 102 | $ docker run -it --rm -v $(pwd):/workdir -e CROSS_TRIPLE=x86_64-apple-darwin multiarch/crossbuild make helloworld 103 | o64-clang helloworld.c -o helloworld 104 | $ file helloworld 105 | helloworld: Mach-O 64-bit executable x86_64 106 | ``` 107 | 108 | #### windows i386 109 | 110 | ```console 111 | $ docker run -it --rm -v $(pwd):/workdir -e CROSS_TRIPLE=i686-w64-mingw32 multiarch/crossbuild make helloworld 112 | o32-clang helloworld.c -o helloworld 113 | $ file helloworld 114 | helloworld: PE32 executable (console) Intel 80386, for MS Windows 115 | ``` 116 | 117 | #### windows x86_64 118 | 119 | ```console 120 | $ docker run -it --rm -v $(pwd):/workdir -e CROSS_TRIPLE=x86_64-w64-mingw32 multiarch/crossbuild make helloworld 121 | o64-clang helloworld.c -o helloworld 122 | $ file helloworld 123 | helloworld: PE32+ executable (console) x86-64, for MS Windows 124 | ``` 125 | 126 | ## Using crossbuild in a Dockerfile 127 | 128 | ```Dockerfile 129 | FROM multiarch/crossbuild 130 | RUN git clone https://github.com/bit-spark/objective-c-hello-world 131 | ENV CROSS_TRIPLE=x86_64-apple-darwin 132 | WORKDIR /workdir/objective-c-hello-world 133 | RUN crossbuild ./compile-all.sh 134 | ``` 135 | 136 | ## Projects using **crossbuild** 137 | 138 | * [scaleway/initrd](https://github.com/scaleway/initrd) 139 | * [multiarch/build-xnbd-client-static](https://github.com/multiarch/build-xnbd-client-static/) 140 | * [tencherry10/til](https://github.com/tencherry10/til) 141 | 142 | ## Credit 143 | 144 | This project is inspired by the [cross-compiler](https://github.com/steeve/cross-compiler) by the venerable [Steeve Morin](https://github.com/steeve) 145 | 146 | ## Legal note 147 | 148 | OSX/Darwin/Apple builds: 149 | **[Please ensure you have read and understood the Xcode license 150 | terms before continuing.](https://www.apple.com/legal/sla/docs/xcode.pdf)** 151 | 152 | 153 | ## License 154 | 155 | MIT 156 | -------------------------------------------------------------------------------- /assets/crossbuild: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # alternative names mapping 4 | case "${CROSS_TRIPLE}" in 5 | x86_64-linux-gnu|linux|x86_64|amd64) 6 | CROSS_TRIPLE="x86_64-linux-gnu" ;; 7 | arm-linux-gnueabi|arm|armv5) 8 | CROSS_TRIPLE="arm-linux-gnueabi" ;; 9 | arm-linux-gnueabihf|armhf|armv7|armv7l) 10 | CROSS_TRIPLE="arm-linux-gnueabihf" ;; 11 | aarch64-linux-gnu|arm64|aarch64) 12 | CROSS_TRIPLE="aarch64-linux-gnu" ;; 13 | mipsel-linux-gnu|mips|mipsel) 14 | CROSS_TRIPLE="mipsel-linux-gnu" ;; 15 | powerpc64le-linux-gnu|powerpc|powerpc64|powerpc64le) 16 | CROSS_TRIPLE="powerpc64le-linux-gnu" ;; 17 | x86_64-apple-darwin|osx|osx64|darwin|darwin64) 18 | CROSS_TRIPLE="x86_64-apple-darwin${DARWIN_VERSION}" ;; 19 | x86_64h-apple-darwin|osx64h|darwin64h|x86_64h) 20 | CROSS_TRIPLE="x86_64h-apple-darwin${DARWIN_VERSION}" ;; 21 | i386-apple-darwin|osx32|darwin32) 22 | CROSS_TRIPLE="i386-apple-darwin${DARWIN_VERSION}" ;; 23 | *-apple-darwin) 24 | CROSS_TRIPLE="${CROSS_TRIPLE}${DARWIN_VERSION}" ;; 25 | x86_64-w64-mingw32|windows|win64) 26 | CROSS_TRIPLE="x86_64-w64-mingw32" ;; 27 | i686-w64-mingw32|win32) 28 | CROSS_TRIPLE="i686-w64-mingw32" ;; 29 | i386-linux-gnu|i386) 30 | echo "i386-linux-gnu not yet implemented." && exit 1 ;; 31 | *) 32 | echo "${CROSS_TRIPLE} not yet implemented." && exit 1 ;; 33 | esac 34 | 35 | # store original PATH and LD_LIBRARY_PATH 36 | if [ -z ${PATH_ORIGIN+x} ]; then export PATH_ORIGIN=${PATH}; fi 37 | if [ -z ${LD_LIBRARY_PATH_ORIGIN+x} ]; then export LD_LIBRARY_PATH_ORIGIN=${LD_LIBRARY_PATH}; fi 38 | 39 | # configure environment 40 | if [ -n "${CROSS_TRIPLE}" ]; then 41 | export CROSS_ROOT="/usr/${CROSS_TRIPLE}" 42 | export PATH="${CROSS_ROOT}/bin:${PATH_ORIGIN}" 43 | export LD_LIBRARY_PATH="/usr/x86_64-linux-gnu/${CROSS_TRIPLE}/lib:${LD_LIBRARY_PATH_ORIGIN}" 44 | fi 45 | 46 | # try to exec direct binary instead on relying on the $PATH 47 | binary=$1 48 | shift 49 | if [ -n "${CROSS_TRIPLE}" -a -f "${CROSS_ROOT}/bin/$binary" ]; then 50 | binary="${CROSS_ROOT}/bin/$binary" 51 | fi 52 | 53 | # finally exec 54 | exec "${binary}" "$@" 55 | exit $? 56 | -------------------------------------------------------------------------------- /assets/osxcross-wrapper: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # set -x 4 | 5 | # check if we are a symlink 6 | if [ "$(readlink -f $0)" != "$0" ]; then 7 | exec "$(readlink -f $0)" $@ 8 | exit $? 9 | fi 10 | 11 | # normal behavior -> proxy to osxcross binary 12 | triple=$(echo "$0" | cut -d/ -f3) 13 | binary=$(basename "$0") 14 | binary_path="/usr/osxcross/bin/$triple-$binary" 15 | 16 | exec "$binary_path" $@ 17 | -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -xeo pipefail 3 | 4 | # A POSIX variable 5 | OPTIND=1 # Reset in case getopts has been used previously in the shell. 6 | 7 | while getopts "d:" opt; do 8 | case "$opt" in 9 | d) DOCKER_REPO=$OPTARG 10 | ;; 11 | esac 12 | done 13 | 14 | shift $((OPTIND-1)) 15 | 16 | [ "$1" = "--" ] && shift 17 | 18 | LINUX_TRIPLES="arm-linux-gnueabihf arm-linux-gnueabi powerpc64le-linux-gnu aarch64-linux-gnu arm-linux-gnueabihf mipsel-linux-gnu" 19 | DARWIN_TRIPLES="x86_64-apple-darwin i386-apple-darwin x86_64h-apple-darwin" 20 | WINDOWS_TRIPLES="x86_64-w64-mingw32 i686-w64-mingw32" 21 | ALIAS_TRIPLES="arm armhf arm64 amd64 x86_64 mips mipsel powerpc powerpc64 powerpc64le osx darwin windows" 22 | DOCKER_TEST_ARGS="--rm -v $(pwd)/test:/test -w /test" 23 | 24 | for triple in ${DARWIN_TRIPLES} ${LINUX_TRIPLES} ${WINDOWS_TRIPLES} ${ALIAS_TRIPLES}; do 25 | docker run ${DOCKER_TEST_ARGS} -e CROSS_TRIPLE=${triple} ${DOCKER_REPO} make test; 26 | done 27 | 28 | docker run ${DOCKER_TEST_ARGS} -e CROSS_TRIPLE=i386-apple-darwin ${DOCKER_REPO} /usr/osxcross/bin/i386-apple-darwin14-cc helloworld.c -o helloworld 29 | file test/helloworld 30 | docker run ${DOCKER_TEST_ARGS} -e CROSS_TRIPLE=i386-apple-darwin ${DOCKER_REPO} /usr/i386-apple-darwin14/bin/cc helloworld.c -o helloworld 31 | file test/helloworld 32 | docker run ${DOCKER_TEST_ARGS} -e CROSS_TRIPLE=i386-apple-darwin ${DOCKER_REPO} cc helloworld.c -o helloworld 33 | file test/helloworld 34 | -------------------------------------------------------------------------------- /test/Makefile: -------------------------------------------------------------------------------- 1 | test: info clean helloworld 2 | file helloworld 3 | 4 | info: 5 | @echo "------------------------------------------------------------------------" 6 | @echo CROSS_TRIPLE: $(CROSS_TRIPLE) 7 | 8 | clean: 9 | @rm -f helloworld 10 | -------------------------------------------------------------------------------- /test/helloworld.c: -------------------------------------------------------------------------------- 1 | /* Hello World program */ 2 | 3 | #include 4 | 5 | int main(int ac, char **av) { 6 | printf("Hello World !\n"); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /test/objective-c-hello-world/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM multiarch/crossbuild:dev 2 | 3 | RUN git clone https://github.com/bit-spark/objective-c-hello-world 4 | 5 | ENV CROSS_TRIPLE=x86_64-apple-darwin 6 | 7 | WORKDIR /workdir/objective-c-hello-world 8 | 9 | RUN crossbuild sh -x ./compile-all.sh 10 | 11 | RUN file *.out 12 | --------------------------------------------------------------------------------