[swift-users] Cross-Compiling to Linux from macOS

Rafael Costa rafael at rafaelcosta.me
Wed Sep 21 12:14:11 CDT 2016


Hello fellow Swift users,

I’m encountering some problems and I wish to know if anyone here has ever come across something similar.

In essence, I want to cross-compile a Swift Project on macOS to run it on Linux. I’m using the following command to (try) to do so:

swift build -c release --build-path ./.build/linux -Xswiftc -static-stdlib -Xswiftc -target -Xswiftc x86_64-unknown-linux-gnu 

The “target” parameter is passing to the “swiftc” program just fine. The problem is that it is overwritten by a “target” parameter added automatically by swift-build (that sets the target as the same arch/OS as the host machine)

How can I prevent that? Is it possible to cross-compile for Linux on macOS?

Thanks in advance,
Rafael Costa
rafael at rafaelcosta.me



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160921/31f6fc59/attachment.html>


More information about the swift-users mailing list