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

Dmitri Gribenko gribozavr at gmail.com
Thu Jan 21 13:38:48 CST 2016

On Thu, Jan 21, 2016 at 11:04 AM, Tom Birch <froody at gmail.com> wrote:
> Ok, thanks, I'll run with that. I see
> SWIFT_NATIVE_(LLVM|CLANG|SWIFT)_TOOLS_PATH, is currently used/supported
> anywhere?

Yes, it is supported and can be used to compile the libraries with an
existing swift compiler, while cross-compiling the compiler.  It can
be used for some cross-compilation workflows.

> My current plan is to:
> 1) Build everything (llvm/clang, cmark, swift) for macosx-x86_64
> 2) Setup SWIFT_NATIVE_*_TOOLS_PATH to point to the respective dirs created
> in (1)
> 3) Create a swift-android-armv7 build dir
> 4) Invoke CMake in swift-android-armv7 with vars from (2), plus a
> Toolchain-android-armv7.cmake to set CMAKE_SYSTEM_NAME, CMAKE_SYSROOT, etc
> for the android build

Right, except the step (2) actually happens inside of step (4).
That's exactly how it is supposed to work.

> Ideally I'd only build the stdlib and tests for android, skipping the tools
> and and llvm/clang builds. Does this seem feasible? I know the runtime
> depends on llvm headers, but I can either use the macosx-x86_64 llvm
> headers, or do a partial headers-only install of llvm-android-armv7. Are
> there any binaries/tools needed to be built for the target (i.e
> android-armv7) in order to build stdlib?

Yes, you can do that with appropriate skip-build-* flags, but you
would still need to configure llvm/clang.  build-script should take
care of that if you give it appropriate flags.

> Anything else I should know/watch
> out for?

Nothing that I know of right now.


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

More information about the swift-dev mailing list