[swift-dev] [swift-build-dev] Cross-compiling Swift to WebAssembly

Nathan Gray n8gray at n8gray.org
Tue Jun 27 20:08:35 CDT 2017


Thanks Daniel.  I was guessing this was more of a build challenge but
swift-dev is probably a better forum regardless.

I think a WebAssembly target would more-or-less look like a generic unix
target, so I was thinking about trying a port analogous to the FreeBSD or
Linux port but using the emscripten compiler and linker.  I'm imagining
there will be snags related to linking and packaging, but the emscripten
people seem pretty confident in their compatibility story, so maybe I'll
get lucky?

To be honest, I'm willing to flail at this and cargo-cult my way through
alone but I'd love to hear from anybody else interested in making it
happen.  C'mon folks, Swift in the browser will be a massive, massive game
changer!

Cheers,
-n8

On Tue, Jun 27, 2017 at 9:06 AM, Daniel Dunbar <daniel_dunbar at apple.com>
wrote:

> Hi Nathan,
>
> This is probably best brought up on swift-dev (CC'd), since this is
> (initially) mostly a compiler problem and not related to the build tools
> (the package manager).
>
>  - Daniel
>
> On Jun 25, 2017, at 4:50 PM, Nathan Gray via swift-build-dev <
> swift-build-dev at swift.org> wrote:
>
> Hello,
>
> Is anybody else out there excited by the idea of cross-compiling Swift to
> WebAssembly?  My impression is that almost all of the pieces are in place
> and that the remaining challenges are likely build related.  For example,
> the Clang that ships with Xcode 9 includes support for wasm32 as a
> compilation target.  Has anybody thought about this or pursued it?
>
> If you're unfamiliar with WebAssembly take a look at
> http://webassembly.org.  In essence, they're defining a VM that runs in
> the browser, and all the major browsers are supporting it.  We're talking
> about being able to code for the web without Javascript.  Imagine being
> able to write Swift libraries that could be compiled for iOS, Android,
> Linux, *and* the web!  It's currently possible with C and C++, and Swift is
> a promising candidate.
>
> As I understand it, the first obstacle is getting a version of the Swift
> standard library that's compiled to llvm bitcode using the "wasm32"
> target.  Does that sound achievable?
>
> Thanks,
> -Nathan
>
> --
> Functional Programmer, iOS Developer, Surfs Poorly
> http://twitter.com/n8gray
> _______________________________________________
> swift-build-dev mailing list
> swift-build-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-build-dev
>
>
>


-- 
Functional Programmer, iOS Developer, Surfs Poorly
http://twitter.com/n8gray
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170627/593fb382/attachment.html>


More information about the swift-dev mailing list