Git Product home page Git Product logo

xcode-cross's Introduction

Cross compilation with Xcode tools

This is a reproducible Dockerfile for cross compiling for Apple platforms from Linux, usable as base image for CI style setups.

This builds on cctools-port for providing the basic tools for cross compilation, together with xcbuild for building xcode project files, wrapping it up into a easy to use and reproducible Dockerfile.

Not all build tools used by Xcode project files are available; some are stubbed out (like ibtool), making it usable as a CI tool for testing compilation, while other Xcode project file features makes the build fail altogether.

This setup currently uses a vanilla LLVM/Clang release instead of the Apple provided clang sources.

This requires an original Xcode.app bundle (which can't be redistributed freely). It has been tested with and should work with Xcode versions 7, 8, 9 and 10. Older versions of Xcode can be downloaded from Apple.

Using an Xcode 11 or 12 bundle works somewhat; building with generic build systems works fine, but there's a few known issues if building Xcode project files with xcbuild, for other than the simplest project files. (For Xcode 12, xcbuild doesn't seem to work at all.)

The Xcode bundle can be stripped down to more manageable sizes for use with this cross compilation setup, since very little of the bundle actually is used:

cp -a /Applications/Xcode.app .
./strip-xcode.sh Xcode.app
tar -Jcvf xcode.tar.xz Xcode.app
rm -rf Xcode.app

Host the resulting xcode.tar.xz file somewhere, then build the docker image like this:

docker build --build-arg XCODE_URL=http://path/to/your/xcode.tar.xz .

The docker image has got all the necessary tools added to the path, but at the end of the path, so that e.g. gcc still resolves to the normal host compiler (for cases when projects need to compile things for both the host and the target). The cross tools can be used with normal cross compilation prefixes like x86_64-apple-darwin-gcc (which invokes clang, not gcc), or less architecturally biased like apple-darwin-gcc (for cases when the architecture will be specified with an -arch parameter.

xcode-cross's People

Contributors

mstorsjo avatar alexandre-janniaux avatar xkm123 avatar

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.