Hi all, I've posted a Docker image that we use internally for doing cross-compiling. It builds on the original posted by Miyabisun about 2 years ago, https://github.com/miyabisun/docker-nim-cross, but updates it for Nim 1.0.2 instead of 0.18. Choosenim is installed so taking additional versions is straightforward.
It also pulls the osxcross Dockerfile directly into this Dockerfile, so that we can use a more recent version of osxcross and have everything self-contained.
Right now it can compile for Linux, 32/64 bit OS X, and 32/64 bit Windows. The 32 bit Linux support is not setup, but shouldn't be difficult to add.
Haven't tried setting up ARM support, but I don't believe that should be too difficult to add either.
echo 'echo "Hello World"' > hello.nim
docker run --rm -v `pwd`:/usr/local/src chrishellerappsian/docker-nim-cross:latest nim c --os:windows --cpu:i386 --out:hello32.exe hello.nim
docker run --rm -v `pwd`:/usr/local/src chrishellerappsian/docker-nim-cross:latest nim c --os:windows --cpu:amd64 --out:hello64.exe hello.nim
docker run --rm -v `pwd`:/usr/local/src chrishellerappsian/docker-nim-cross:latest nim c --os:macosx --cpu:i386 --out:hello32.osx.bin hello.nim
docker run --rm -v `pwd`:/usr/local/src chrishellerappsian/docker-nim-cross:latest nim c --os:macosx --cpu:amd64 --out:hello64.osx.bin hello.nim
https://hub.docker.com/r/chrishellerappsian/docker-nim-cross
This is already being done in the nightlies builds, except for OSX binaries.
We are using Holy Build Box for older Linux builds and Dockcross for Arm builds.
Isn't that just building Nim itself on different platforms?
I didn't see anything in the official Docker images that are posted, https://hub.docker.com/r/nimlang/nim, about being able to cross-compile your own Nim code.