<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 14, 2017, at 9:44 AM, Andy Best via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hey,<div class=""><br class=""></div><div class="">I'm currently looking at building a portable version of the standard library (for targeting microcontrollers, kernel dev, etc).</div></div></div></blockquote><div><br class=""></div>I’m a bit confused about your terminology. By “portable” do you mean no dependencies on libc or POSIX?</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">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't be a standard lib to link against on the target.</div></div></div></blockquote><div><br class=""></div>There’s a PR open to add cross-compilation support to the build system: <a href="https://github.com/apple/swift/pull/1398" class="">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 class=""></div><div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">I am struggling to find the best way to build the standard library though. I'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 class=""><br class=""></div><div class="">I was wondering if there was an easier way to go about building a custom libswiftcore?</div><div class=""><br class=""></div><div class="">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 class=""></div>Slava</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""></div><div class="">Andy</div></div>
_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-dev<br class=""></div></blockquote></div><br class=""></body></html>