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

Geordie Jay geojay at gmail.com
Mon Jan 18 16:44:59 CST 2016


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.

Out of interest, have you found a version of clang that compiles from your
host machine to an arm-Linux target? Or delved into the source in order to
make your own? I'd be interested in cross-compiling for Raspberry Pi too
but haven't looked into toolchains yet.

Geordie
Tom Gall <tom.gall at linaro.org> schrieb am Mo., 18. Jan. 2016 um 22:07:

> Cool!
>
> I was just starting a similar exercise but using x86-64 linux as the
> host since I've managed to get swift building and running on my
> arm-linux box.
>
> Cheers!
>
> On Mon, Jan 18, 2016 at 1:03 PM, Geordie Jay via swift-dev
> <swift-dev at swift.org> wrote:
> > I have just pushed a branch to the SwiftAndroid repo that is at the
> stage of
> > correctly compiling the swift toolchain and stdlib objects for
> android-armv7
> > and macosx-x86_64 (as verified using nm from the different toolchains):
> > https://github.com/SwiftAndroid/swift/tree/osx-crosscompile. The
> problem is
> > it fails at the linker stage.
> >
> > Basically the OSX linker doesn't understand the “—sysroot” option (See
> > AddSwift.cmake:59). Up until that point though (throughout the compiling
> > stage), we need that option because otherwise the Android components
> attempt
> > to use OSX /usr/include, which throws all sorts of errors because of
> wrong
> > architecture etc. Why it fails to compile when I remove the “—sysroot”
> > option, but also fails _with_ it in the link stage will probably be key
> to
> > fixing this. Again, it seems that what we really need to do is use the
> > Android linker, not the Xcode one.
> >
> > I'm going to try figure out how to do that tomorrow but not confident
> I’ll
> > get far given my limited experience with this.. This work may also be of
> > interest to the Raspberry Pi / BeagleBoard folks, would also love to hear
> > some opinions about how to solve the CMAKE_SYSTEM_NAME problem, that will
> > also affect cross-compilation for those uses. In any case, any hints or
> > collaborators would be most welcome.
> >
> > Geordie
> >
> >
> > _______________________________________________
> > swift-dev mailing list
> > swift-dev at swift.org
> > https://lists.swift.org/mailman/listinfo/swift-dev
> >
>
>
>
> --
> Regards,
> Tom
>
> "Where's the kaboom!? There was supposed to be an earth-shattering
> kaboom!" Marvin Martian
> Director, Linaro Mobile Group
> Tech Lead, GPGPU
> Linaro.org │ Open source software for ARM SoCs
> irc: tgall_foo | skype : tom_gall
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160118/c50ab13c/attachment.html>


More information about the swift-dev mailing list