<div><div dir="auto">Yes, exactly. Obviously you&#39;d have to provide the necessary functionality for your own platform (e.g. malloc, free, putc, etc.)</div><br><div class="gmail_quote"><div>On Mon, 14 Aug 2017 at 6:54 pm, Slava Pestov &lt;<a href="mailto:spestov@apple.com">spestov@apple.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><blockquote type="cite"><div>On Aug 14, 2017, at 9:44 AM, Andy Best via swift-dev &lt;<a href="mailto:swift-dev@swift.org" target="_blank">swift-dev@swift.org</a>&gt; wrote:</div><br class="m_-6972011506601890959Apple-interchange-newline"><div><div>Hey,<div><br></div><div>I&#39;m currently looking at building a portable version of the standard library (for targeting microcontrollers, kernel dev, etc).</div></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div>I’m a bit confused about your terminology. By “portable” do you mean no dependencies on libc or POSIX?</div><div></div></div><div style="word-wrap:break-word"><div><br><blockquote type="cite"><div><div><div><br></div><div>The easiest way to cross compile Swift at the moment (that I can find) is to get swiftc to generate LLVM IR (-emit-ir), and use clang to build and cross compile. This obviously leaves the problem that there won&#39;t be a standard lib to link against on the target.</div></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div>There’s a PR open to add cross-compilation support to the build system: <a href="https://github.com/apple/swift/pull/1398" target="_blank">https://github.com/apple/swift/pull/1398</a> It would be great if you or someone else would dust it off and get it merged in.</div><div><br></div><div></div></div><div style="word-wrap:break-word"><div><blockquote type="cite"><div><div><div><br></div><div>I figured that the best way to accomplish this would probably be to implement whatever stubs are necessary for the target (e.g. all the libc calls).</div><div><br></div><div>I am struggling to find the best way to build the standard library though. I&#39;ve got a copy of the stdlib files, have run gyb over all of the templates, and am attempting to get swiftc to compile everything and output a giant IR file.</div><div><br></div><div>I was wondering if there was an easier way to go about building a custom libswiftcore?</div><div><br></div><div>It would obviously be great to be able to use Swift in this way without an OS, as it would open up a lot of opportunities for use of the language (embedded development, etc).</div></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div>Slava</div></div><div style="word-wrap:break-word"><div><br><blockquote type="cite"><div><div><div><br></div><div><br></div><div>Thanks,</div><div><br></div><div>Andy</div></div>
_______________________________________________<br>swift-dev mailing list<br><a href="mailto:swift-dev@swift.org" target="_blank">swift-dev@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-dev" target="_blank">https://lists.swift.org/mailman/listinfo/swift-dev</a><br></div></blockquote></div><br></div></blockquote></div></div>