[swift-dev] Cross-compile for Android armv7 from OSX

Dmitri Gribenko gribozavr at gmail.com
Mon Jan 18 18:47:10 CST 2016

On Mon, Jan 18, 2016 at 2:44 PM, Geordie Jay via swift-dev
<swift-dev at swift.org> wrote:
> I'm in discussions about this with some others over at
> https://github.com/SwiftAndroid/swift/issues/13
> Basically the Swift build process as is isn't made for arbitrary
> cross-compiling. The iOS cross-compiling from OSX relies on some happy
> accidents, e.g. that they're all Apple platforms, and isn't robust. So we're
> discussing some alternatives that would eventually also benefit your porting
> effort.

Unfortunately CMake only supports one C compiler and one linker in one
CMake invocation.  The "CMake way" for cross-compilation is to invoke
CMake once for every part of the build that requires a different set
of tools.  Thus, for Swift, we would need to invoke CMake once for
building the tools running on the host (the swiftc running on OS X)
with the host toolchain (clang from Xcode), and once for the Android
target with the Android toolchain and the just-built Swift to build
the standard library.

The disadvantage to this approach is that there are many CMake
invocations, and many ninja invocations.  This is bad for the same
reasons why recursive make is bad. [1]  So we would like to keep the
current scheme for as many targets as possible (OS X native, OS X to
iOS cross-compilation, Linux native etc.), and use the multi-CMake
scheme only where strictly required.

[1] http://aegis.sourceforge.net/auug97.pdf


(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

More information about the swift-dev mailing list