Git Product home page Git Product logo

crossbuild's Introduction

crossbuild

🌍 multiarch cross compiling environments

actions

This is a multiarch Docker build environment image. You can use this image to produce binaries for multiple architectures.

Supported targets

Triple Aliases linux osx windows
x86_64-linux-gnu (default), linux, amd64, x86_64 X
arm-linux-gnueabi arm, armv5 X
arm-linux-gnueabihf armhf, armv7, armv7l X
aarch64-linux-gnu arm64, aarch64 X
mipsel-linux-gnu mips, mipsel X
powerpc64le-linux-gnu powerpc, powerpc64, powerpc64le X
x86_64-apple-darwin osx, osx64, darwin, darwin64 X
x86_64h-apple-darwin osx64h, darwin64h, x86_64h X
i386-apple-darwin osx32, darwin32 X
x86_64-w64-mingw32 windows, win64 X
i686-w64-mingw32 win32 X

Using crossbuild

x86_64

$ docker run --rm -v $(pwd):/workdir multiarch/crossbuild make helloworld
cc helloworld.c -o helloworld
$ file helloworld
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

Misc: using cc instead of make

$ docker run --rm -v $(pwd):/workdir multiarch/crossbuild cc test/helloworld.c

arm

$ docker run --rm -v $(pwd):/workdir -e CROSS_TRIPLE=arm-linux-gnueabi multiarch/crossbuild make helloworld
cc     helloworld.c   -o helloworld
$ file helloworld
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

armhf

$ docker run --rm -v $(pwd):/workdir -e CROSS_TRIPLE=arm-linux-gnueabihf multiarch/crossbuild make helloworld
cc     helloworld.c   -o helloworld
$ file helloworld
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

powerpc 64-bit el

$ docker run --rm -v $(pwd):/workdir -e CROSS_TRIPLE=powerpc64le-linux-gnu multiarch/crossbuild make helloworld
cc     helloworld.c   -o helloworld
$ file helloworld
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
ripped

arm64

$ docker run --rm -v $(pwd):/workdir -e CROSS_TRIPLE=aarch64-linux-gnu multiarch/crossbuild make helloworld
cc     helloworld.c   -o helloworld
$ file helloworld
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

mips el

$ docker run --rm -v $(pwd):/workdir -e CROSS_TRIPLE=mipsel-linux-gnu multiarch/crossbuild make helloworld
cc     helloworld.c   -o helloworld
$ file helloworld
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

darwin i386

$ docker run -it --rm -v $(pwd):/workdir -e CROSS_TRIPLE=i386-apple-darwin  multiarch/crossbuild make helloworld
o32-clang     helloworld.c   -o helloworld
$ file helloworld
helloworld: Mach-O executable i386

darwin x86_64

$ docker run -it --rm -v $(pwd):/workdir -e CROSS_TRIPLE=x86_64-apple-darwin  multiarch/crossbuild make helloworld
o64-clang     helloworld.c   -o helloworld
$ file helloworld
helloworld: Mach-O 64-bit executable x86_64

windows i386

$ docker run -it --rm -v $(pwd):/workdir -e CROSS_TRIPLE=i686-w64-mingw32  multiarch/crossbuild make helloworld
o32-clang     helloworld.c   -o helloworld
$ file helloworld
helloworld: PE32 executable (console) Intel 80386, for MS Windows

windows x86_64

$ docker run -it --rm -v $(pwd):/workdir -e CROSS_TRIPLE=x86_64-w64-mingw32  multiarch/crossbuild make helloworld
o64-clang     helloworld.c   -o helloworld
$ file helloworld
helloworld: PE32+ executable (console) x86-64, for MS Windows

Using crossbuild in a Dockerfile

FROM multiarch/crossbuild
RUN git clone https://github.com/bit-spark/objective-c-hello-world
ENV CROSS_TRIPLE=x86_64-apple-darwin
WORKDIR /workdir/objective-c-hello-world
RUN crossbuild ./compile-all.sh

Projects using crossbuild

Credit

This project is inspired by the cross-compiler by the venerable Steeve Morin

Legal note

OSX/Darwin/Apple builds: Please ensure you have read and understood the Xcode license terms before continuing.

License

MIT

crossbuild's People

Contributors

artynet avatar iwasakims avatar jimbly avatar lafin avatar maxpeal avatar moul avatar neurocis avatar nlm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crossbuild's Issues

Curl / Wget: Certificate expired error

When I am using curl or wget inside of container to download some files it gives me certificate error:

wget https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
--2022-01-08 03:41:05--  https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
Resolving pkgconfig.freedesktop.org (pkgconfig.freedesktop.org)... 131.252.210.176, 2610:10:20:722:a800:ff:feda:470f
Connecting to pkgconfig.freedesktop.org (pkgconfig.freedesktop.org)|131.252.210.176|:443... connected.
ERROR: The certificate of 'pkgconfig.freedesktop.org' is not trusted.
ERROR: The certificate of 'pkgconfig.freedesktop.org' has expired.
curl https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz -o test.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (60) SSL certificate problem: certificate has expired
More details here: https://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

./a.out: cannot execute binary file: Exec format error

Makefile:

all: main.cpp
    @gcc -xc++ -lstdc++ -shared-libgcc main.cpp
    @echo Finished macOS compile

main.cpp:

#include <iostream>

int main()
{
    std::cout << "Hello world" << std::endl;
    return 0;
}
$ docker run -it --rm -v $(pwd):/workdir -e CROSS_TRIPLE=x86_64-apple-darwin  multiarch/crossbuild bash
$ make
Finished macOS compile
$ ./a.out
bash: ./a.out: cannot execute binary file: Exec format error

unexpected token `FUSE,'

I am trying to build https://github.com/relan/exfat for my router on my Mac.
On my router:

# uname -a
Linux RT-N18U 2.6.36.4brcmarm #1 PREEMPT Fri Jan 12 18:35:32 CST 2018 armv7l GNU/Linux
# grep -i fuse /lib/modules/$(uname -r)/modules.builtin
kernel/fs/fuse/fuse.ko

On my mac:

$ docker run --rm -v ~/workspace/exfat/:/workdir -e CROSS_TRIPLE=armv7l multiarch/crossbuild autoreconf --install
configure.ac:32: installing './ar-lib'
configure.ac:29: installing './compile'
configure.ac:28: installing './install-sh'
configure.ac:28: installing './missing'
dump/Makefile.am: installing './depcomp'
$ docker run --rm -v ~/workspace/exfat/:/workdir -e CROSS_TRIPLE=armv7l multiarch/crossbuild ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
...
...
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
./configure: line 4080: syntax error near unexpected token `FUSE,'
./configure: line 4080: `PKG_CHECK_MODULES(FUSE, fuse)'

Please help me to sort this out.

failed to register layer: Error processing tar file(exit status 1): Error making old root private after pivot: invalid argument

What's wrong with this? I didn’t find this error on google?
docker version:
Client:
Version: 20.10.7
API version: 1.41
Go version: go1.13.8
Git commit: 20.10.7-0ubuntu1~18.04.1
Built: Wed Aug 4 22:43:25 2021
OS/Arch: linux/amd64
Context: default
Experimental: true

Server:
Engine:
Version: 20.10.7
API version: 1.41 (minimum version 1.12)
Go version: go1.13.8
Git commit: 20.10.7-0ubuntu118.04.1
Built: Wed Aug 4 19:22:59 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.5.2-0ubuntu1
18.04.2
GitCommit:
runc:
Version: 1.0.0rc95-0ubuntu118.04.2
GitCommit:
docker-init:
Version: 0.19.0
GitCommit:

failure building the docker image

Ran the make file on my Ubuntu 16.04 VM but the build ended pretty early with this :

`Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
crossbuild-essential-arm64 : Depends: gcc-aarch64-linux-gnu (>= 4.9.1-1) but it is not going to be installed
Depends: g++-aarch64-linux-gnu (>= 4.9.1-1) but it is not going to be installed
crossbuild-essential-armel : Depends: gcc-arm-linux-gnueabi (>= 4.9.1-1) but it is not going to be installed
Depends: g++-arm-linux-gnueabi (>= 4.9.1-1) but it is not going to be installed
crossbuild-essential-armhf : Depends: gcc-arm-linux-gnueabihf (>= 4.9.1-1) but it is not going to be installed
Depends: g++-arm-linux-gnueabihf (>= 4.9.1-1) but it is not going to be installed
crossbuild-essential-mipsel : Depends: gcc-mipsel-linux-gnu (>= 4.9.1-1) but it is not going to be installed
Depends: g++-mipsel-linux-gnu (>= 4.9.1-1) but it is not going to be installed
crossbuild-essential-ppc64el : Depends: gcc-powerpc64le-linux-gnu (>= 4.9.1-1) but it is not going to be installed
Depends: g++-powerpc64le-linux-gnu (>= 4.9.1-1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
The command '/bin/sh -c set -x; echo deb http://emdebian.org/tools/debian/ jessie main > /etc/apt/sources.list.d/emdebian.list && curl -sL http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add - && dpkg --add-architecture arm64 && dpkg --add-architecture armel && dpkg --add-architecture armhf && dpkg --add-architecture i386 && dpkg --add-architecture mips && dpkg --add-architecture mipsel && dpkg --add-architecture powerpc && dpkg --add-architecture ppc64el && apt-get update && apt-get install -y -q autoconf automake autotools-dev bc binfmt-support binutils-multiarch binutils-multiarch-dev build-essential clang crossbuild-essential-arm64 crossbuild-essential-armel crossbuild-essential-armhf crossbuild-essential-mipsel crossbuild-essential-ppc64el curl devscripts gdb git-core libtool llvm mercurial multistrap patch python-software-properties software-properties-common subversion wget xz-utils cmake qemu-user-static && apt-get clean' returned a non-zero code: 100
Makefile:17: recipe for target '.built' failed
make: *** [.built] Error 1`

Any ideas how to fix it ?

OSX/Darwin/Apple builds

Like most users here I am not a lawyer.
There is this comment on the Readme:

OSX/Darwin/Apple builds: [Please ensure you have read and understood the Xcode license terms before continuing.
(https://www.apple.com/legal/sla/docs/xcode.pdf)

Would it be possible to explain a bit better what the crossbuild project understands from that license.

I would argue building the cross toolchain inside a ubuntu container on non apple branded hardware using the SDK distributed in Xcode is already not permitted by the licence.

But again I am not a lawyer and I am asking since I would like to do the same but I am not sure if it is permitted by the Xcode and Apple SDK Agreement.

Compilation which requires intermediate (build system) compilation of tools doesn't work.

Some things, for example, binutils and gcc, have compilation processes that involve compiling temporary stuff that are run on the build machine to do tasks during the compilation process.

This fails even when instructing the build processes to use the correct "native" gcc (CC_FOR_BUILD environment variable, --build and --host configure arguments), because the crossbuild setup does not seem to have any way to allow one to compile within the container something that must execute within the container if the container is started as a cross compiler.

Note that it is not possible to pre-compile this stuff outside of the container as it's done as part of the make (or in some cases, configure) process itself.

Eh, this is easier to demonstrate than describe.

ubuntu@ip-172-30-1-27:~/test$ sudo docker run -it --rm -v /home:/home -w $(pwd) -e CROSS_TRIPLE=x86_64-w64-mingw32  multiarch/crossbuild:dev bash
root@aa68f36ac0c1:/home/ubuntu/test# cat hello.c
#include <stdio.h>

int main(void)
{
  printf("Hello World\n");
  exit(0);
}
root@aa68f36ac0c1:/home/ubuntu/test# /usr/bin/gcc hello.c
hello.c: In function 'main':
hello.c:6:3: warning: incompatible implicit declaration of built-in function 'exit'
  exit(0);
  ^
/tmp/ccJpOPiQ.s: Assembler messages:
/tmp/ccJpOPiQ.s:7: Warning: .type pseudo-op used outside of .def/.endef ignored.
/tmp/ccJpOPiQ.s:7: Error: junk at end of line, first unrecognized character is `m'
/tmp/ccJpOPiQ.s:22: Warning: .size pseudo-op used outside of .def/.endef ignored.
/tmp/ccJpOPiQ.s:22: Error: junk at end of line, first unrecognized character is `m'
/tmp/ccJpOPiQ.s:24: Error: junk at end of line, first unrecognized character is `-'

so the assembler fails, almost certainly gcc has picked up the wrong assembler. We also (I expect the root of the problem) have this interesting thing going on:

root@aa68f36ac0c1:/home/ubuntu/test# /usr/bin/gcc-ar-4.9 
/usr/x86_64-w64-mingw32/bin/ar: no operation specified

so looks like these gcc components in /usr/bin (eg, /usr/bin/gcc-ar-4.9) are getting replaced with the cross compile gcc components (but they are not actually physically replaced, it's like the executable itself is doing the substitution).

If we start with a null cross compile environment (that is, not actually a cross compiler), we can compile stuff for the container from within the container as expected.

ubuntu@ip-172-30-1-27:~/test$ sudo docker run -it --rm -v /home:/home -w $(pwd) -e CROSS_TRIPLE=x86_64-linux-gnu  multiarch/crossbuild:dev bash
root@4cdc067643db:/home/ubuntu/test# gcc hello.c
hello.c: In function 'main':
hello.c:6:3: warning: incompatible implicit declaration of built-in function 'exit'
  exit(0);
  ^
root@4cdc067643db:/home/ubuntu/test# ./a.out
Hello World    

and the gcc components are correct...

root@4cdc067643db:/home/ubuntu/test# /usr/bin/gcc-ar-4.9                                                                                                                                                    
/usr/bin/ar: no operation specified     

issues running commands with spaces

I'm having an issue running commands with spaces, e.g.:
cmake -G "MinGW Makefiles" .

From a quick google and reading of, I believe the $@ at the bottom of the crossbuild script just needs to be enclosed in quotes in order to resolve:
exec "${binary}" "$@"

How to install project specific libraries for multiple platforms required for compiling?

First let me say GREAT!
Exactly what I need for my project (I have to supply binaries for "normal" users for Linux/OSX/Windows).
I also plan to use this as a CI build env.

Now my question: I need some libraries in order to compile my project (e.g. libusb, ncurses).
Usually I use packet manager on the real platforms to install them (apt-get for Linux, brew for OSX and pacman for MSYS2-MinGW/Windows).

Do you have an idea / suggestion how to install (automated or manually) the different platform specific libraries?

Thanks,

Maik

Fedora 26 issue

I'm quite new at docker, so forgive the naivete.
After successfully installing crossbuild on a fedora26 alpha desktop pc, all commands fail.

$ docker run -it --rm -v $(/bin/pwd):/workdir -e CROSS_TRIPLE=arm-linux-gnueabihf multiarch/crossbuild ls      
ls: cannot open directory .: Permission denied

$ docker run -it --rm -v $(/bin/pwd):/workdir -e CROSS_TRIPLE=arm-linux-gnueabihf multiarch/crossbuild ls -l ..
total 24
drwxr-xr-x.   1 root root   267 Jan 30 17:51 bin
drwxr-xr-x.   2 root root     6 Dec 28 17:42 boot
drwxr-xr-x.   5 root root   360 Jun 14 14:25 dev
drwxr-xr-x.   1 root root    66 Jun 14 14:25 etc
drwxr-xr-x.   2 root root     6 Dec 28 17:42 home
drwxr-xr-x.   1 root root   278 Jan 30 17:52 lib
drwxr-xr-x.   1 root root    23 Jan 30 17:49 lib64
drwxr-xr-x.   2 root root     6 Jan 16 18:02 media
drwxr-xr-x.   2 root root     6 Jan 16 18:02 mnt
drwxr-xr-x.   2 root root     6 Jan 16 18:02 opt
dr-xr-xr-x. 419 root root     0 Jun 14 14:25 proc
drwx------.   2 root root    37 Jan 16 18:02 root
drwxr-xr-x.   1 root root    19 Jan 30 17:51 run
drwxr-xr-x.   2 root root  4096 Jan 16 18:05 sbin
drwxr-xr-x.   2 root root     6 Jan 16 18:02 srv
dr-xr-xr-x.  13 root root     0 Jun 14 09:26 sys
drwxrwxrwt.   1 root root     6 Jan 17 00:00 tmp
drwxr-xr-x.   1 root root    17 Jan 30 18:06 usr
drwxr-xr-x.   1 root root    41 Jan 17 00:00 var
drwxr-xr-x.  36 1000 1000 16384 Jun 14 13:37 workdir

$ docker run -it --rm -v $(/bin/pwd):/workdir -e CROSS_TRIPLE=arm-linux-gnueabihf multiarch/crossbuild id
uid=0(root) gid=0(root) groups=0(root)

It is it because workdir is owned by user 1000 and the commands are run as root?

Support for Apple M1 arm64/aarch64 chips

I've been using this docker container to cross-compile some libraries for Mac OS for quite a long time. It works great !
After a quick look to the content of the container, it seems that it contains some of the things needed to build for aarch64 / Apple M1 processor.
Adding a new CROSS_TRIPLE case and setting -arch arm64 with an arm64 compatible GCC could do the work.

I don't know how difficult it would be to implement this new processor. Correct me if I'm wrong.

Using crossbuild to build static external libraries

Is it possible to use crossbuild to build external static libraries for different platforms? More specifically, I would like to build libgit2 and its dependencies statically (openssl and libssh2). I have been encountering one error after another, but it is most likely because I am not familiar enough in the subject matter.

Side note: Both libgit2 and libssh2 uses CMake for the build/install, which in turn depends heavily on pkg-config. I realized that when passing in CROSS_TRIPLE=x86_64-apple-darwin, pkg-config is installed, but otherwise it is not present on the image.

Support for BSD targets?

Hello,

I am curious about using crossbuild to manage some more fringe ports. Could crossbuild add support for compiling BSD targets? For example, FreeBSD.

Add GCC & binutils to osxcross

osxcross allows to additionally build cross-GCC & cross-binutils for Darwin (macOS). This could be done as simple as:

./build_gcc.sh
./build_binutils.sh

One note though - Binutils are being installed in target/binutils folder1, not target where Clang & GCC are being put. And so additional location target/binutils/bin should be added in the PATH.

And with both GCC & Binutils built I may do such a fancy things as building GNU toolchain for multiple CPU architectures that will work on macOS (via process known as a "Canadian cross" with https://github.com/crosstool-ng/crosstool-ng). If of any interest I may explain how that could be easily done :)

If any testing is needed I'll be happy to help.

1As I learned it the hard way there's a good reason for that: some binaries have the same name in both Binutils & cctools while not really being equally good (I bumped into GNU's Binutils ar creating bad archive headers which later leads to linkage problems, see a very similar problem discussed here - golang/go#28796, once I have more time I'll try to see if that might be fixed - I guess it should just work in the end).

How to extend and add other packages?

Hi,

How to extend your docker image and to add other packages like this:

RUN apt-get update -y
RUN apt-get install -y libx11-dev libgtk2.0-dev libgtkglext1-dev cmake

Thanks.

x86_64-apple-darwin cmake not functioning correctly

multiarch/crossbuild currently uses Debian stretch:
FROM buildpack-deps:stretch-curl

This comes with cmake version 3.7.2
https://packages.debian.org/stretch/devel/cmake

Therefore I took the old CMake tutorial (which is compatible with cmake 3.3+)
https://github.com/Kitware/CMake/tree/161b33f12b9a225607a4ea8339eabd4875bebbfe/Help/guide/tutorial/Complete

I placed the tutorials files inside a /src directory and added a docker-compose.yml file:

version: '3'
services:

  linux:
    image: multiarch/crossbuild
    environment:
      CROSS_TRIPLE: x86_64-linux-gnu
      FOLDER: linux
    command: >
      sh -c "mkdir -p ./build/linux &&
             cd ./build/linux &&
             cmake ../../src &&
             cmake --build . &&
            ./Tutorial 4294967296"
    working_dir: /app
    volumes:
      - ./src:/app/src
      - ./build:/app/build

  mac:
    image: multiarch/crossbuild
    environment:
      CROSS_TRIPLE: x86_64-apple-darwin
    command: >
      sh -c "mkdir -p ./build/mac &&
             cd ./build/mac &&
             cmake ../../src &&
             cmake --build . &&
            ./Tutorial 4294967296"
    working_dir: /app
    volumes:
      - ./src:/app/src
      - ./build:/app/build

  win:
    image: multiarch/crossbuild
    environment:
      CROSS_TRIPLE: x86_64-w64-mingw32
      FOLDER: win
    command: >
      sh -c "mkdir -p ./build/win &&
             cd ./build/win &&
             cmake ../../src &&
             cmake --build . &&
            ./Tutorial 4294967296"
    working_dir: /app
    volumes:
      - ./src:/app/src
      - ./build:/app/build

When running docker-compose up you get

  • Linux: all ok
  • Mac: no errors, but binary is not created
  • Win: An error see below

./build/win/CMakeFiles/CMakeError.log

Determining if the C compiler works failed with the following output:
Change Dir: /app/build/win/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_731ec/fast"
/usr/bin/make -f CMakeFiles/cmTC_731ec.dir/build.make CMakeFiles/cmTC_731ec.dir/build
make[1]: Entering directory '/app/build/win/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_731ec.dir/testCCompiler.c.o
/usr/x86_64-w64-mingw32/bin/cc     -o CMakeFiles/cmTC_731ec.dir/testCCompiler.c.o   -c /app/build/win/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_731ec
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_731ec.dir/link.txt --verbose=1
/usr/x86_64-w64-mingw32/bin/cc       CMakeFiles/cmTC_731ec.dir/testCCompiler.c.o  -o cmTC_731ec -rdynamic 
cc: error: unrecognized command line option '-rdynamic'
CMakeFiles/cmTC_731ec.dir/build.make:97: recipe for target 'cmTC_731ec' failed
make[1]: *** [cmTC_731ec] Error 1
make[1]: Leaving directory '/app/build/win/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_731ec/fast' failed
make: *** [cmTC_731ec/fast] Error 2

I have a branch with the code here:
https://github.com/kmturley/cmake-multiarch-docker/tree/feature/crossbuild

What is the issue?

macOS SDK on GitHub

Instead of storing the macOS SDK in Dropbox, how about creating a job on Travis CI that extracts the macOS SDK and upload it to a GitHub release?

arm64 unrecognized command line option '-mfpu=vfp' and '-marm'

use linux-arm64 to build nodejs 4.8.3 from source, error happened
error like below:

`/usr/xcc/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-g++ '-DV8_TARGET_ARCH_ARM' '-DCAN_USE_ARMV7_INSTRUCTIONS' '-DENABLE_DISASSEMBLER' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC' -I../deps/v8 -pthread -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -mfpu=vfp -marm -O3 -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fdata-sections -ffunction-sections -O3 -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /work/out/Release/.deps//work/out/Release/obj.target/v8_base/deps/v8/src/accessors.o.d.raw -c -o /work/out/Release/obj.target/v8_base/deps/v8/src/accessors.o ../deps/v8/src/accessors.cc

aarch64-unknown-linux-gnueabi-g++: error: unrecognized command line option '-mfpu=vfp'; did you mean '-mcpu='?

aarch64-unknown-linux-gnueabi-g++: error: unrecognized command line option '-marm'; did you mean '-fasm'?

deps/v8/tools/gyp/v8_base.target.mk:398: recipe for target '/work/out/Release/obj.target/v8_base/deps/v8/src/accessors.o' failed

make[1]: *** [/work/out/Release/obj.target/v8_base/deps/v8/src/accessors.o] Error 1

make[1]: Leaving directory '/work/out'

Makefile:69: recipe for target 'node' failed

make: *** [node] Error 2`

[x86_64-apple-darwin14] x86_64-apple-darwin14-as: unknown host architecture (can't determine which assembler to run)

Hello!

CROSS_TRIPLE=x86_64-apple-darwin14
Get error while compiling tif_stream.cxx from http://download.osgeo.org/libtiff/tiff-4.0.8.tar.gz

/bin/bash ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.   -I/opt/openslide/include    -c -o tif_stream.lo tif_stream.cxx
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I/opt/openslide/include -c tif_stream.cxx 
fatal error: /usr/osxcross/bin/x86_64-apple-darwin14-as: unknown host architecture (can't determine which assembler to run)
Makefile:695: recipe for target 'tif_stream.lo' failed

[KUDOS] Just a thank you ...

Forked at neurocis/docker-xbuilder, will be moving it to MXE as well as creating qt & mono/xamrin build containers based on this. Great work BTW, nice, succinct and simple. May port in to Alpine base image for ultimate light-weight.

Cheers!

CoreFoundation lib not found

Hello,
I got project with following cmake code:

  find_library(CORE_FOUNDATION CoreFoundation)
  if(NOT CORE_FOUNDATION)
    message(FATAL_ERROR "Apple Core Foundation framework not found!")
  endif()

Attempt to build it with either CROSS_TRIPLE=i386-apple-darwin or CROSS_TRIPLE=x86_64-apple-darwin results in the error about missing lib. I failed to find any extra instructions on the matter. Is there a need to do some extra setup to provide these libs myself or is this a bug?

pkg-config doesn't work osx/darwin

I'm trying to build a CMake project which locates libs via pkg-config. Based on osxcross's pkg-config README I'm trying to instruct pkg-config where are the dependencies (I've already built those), however calling pkg-config doesn't seem to work (always returns exit code 1 or hangs).

$ docker run -it --rm -v $(pwd):/workdir -e CROSS_TRIPLE=x86_64-apple-darwin  multiarch/crossbuild
root@d50c00521f6d:/workdir# pkg-config
root@d50c00521f6d:/workdir# echo $?
1
root@d50c00521f6d:/workdir# pkg-config --version
root@d50c00521f6d:/workdir# echo $?
1
root@d50c00521f6d:/workdir# OSXCROSS_PKG_CONFIG_PATH=/tmp OSXCROSS_PKG_CONFIG_LIBDIR=/tmp pkg-config --libs gthread
...

The last command hangs, I think it's an infinite loop, but I'm not 100% sure.
(/tmp is used only for this snippet, it could be anything, doesn't make a difference, if OSXCROSS_PKG_CONFIG_LIBDIR or similar is defined the command hangs.)

I've created the issue here, because I think this problem is related to the fact there is some symlinking magic going on in the Dockerfile. I kinda understand it, but then it's a bit complicated. Sooo ... I think osxcross's "wrapper" script/binary/program calls itself over and over. That's why there's no ouput. Or maybe am wrong.

I've tried another Docker image of osxcross like this

$ docker run --rm --interactive --volume /Users/rkohanyi/git/glib-2.30.3:/glib apriorit/docker-osxcross-10.11:latest << EOF
OSXCROSS_PKG_CONFIG_PATH=/tmp OSXCROSS_PKG_CONFIG_LIBDIR=/tmp x86_64-apple-darwin15-pkg-config --libs sdl2
EOF
Package sdl2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `sdl2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'sdl2' found

so osxcross seems to work at least.

Any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.