Cross-Compiling macOS to Linux

Here”s the PR: Add zlib to package names by SlaunchaMan · Pull Request #2614 · apple/swift-package-manager · GitHub

To build this, first I generate the toolchain like this (using my patched version):

./swiftpm/Utilities/build_ubuntu_cross_compilation_toolchain /tmp/ ~/Downloads/swift-5.1.4-RELEASE-osx.pkg ~/Downloads/swift-5.1.4-RELEASE-ubuntu18.04.tar.gz

Then I run this to build:

swift build --destination /tmp/cross-toolchain/ubuntu-xenial-destination.json

Here’s the output from that command in a fresh Vapor install (created using vapor new):

Build Log
VaporTest jeff$ swift build --destination /tmp/cross-toolchain/ubuntu-xenial-destination.json

Fetching https://github.com/vapor/core.git

Fetching https://github.com/vapor/database-kit.git

Fetching https://github.com/vapor/sql.git

Fetching https://github.com/vapor/validation.git

Fetching https://github.com/vapor/crypto.git

Fetching https://github.com/vapor/sqlite.git

Fetching https://github.com/vapor/routing.git

Fetching https://github.com/vapor/service.git

Fetching https://github.com/vapor/fluent.git

Fetching https://github.com/apple/swift-nio-zlib-support.git

Fetching https://github.com/vapor/websocket.git

Fetching https://github.com/apple/swift-nio-ssl.git

Fetching https://github.com/vapor/multipart.git

Fetching https://github.com/apple/swift-nio-ssl-support.git

Fetching https://github.com/vapor/console.git

Fetching https://github.com/apple/swift-nio.git

Fetching https://github.com/vapor/vapor.git

Fetching https://github.com/vapor/template-kit.git

Fetching https://github.com/vapor/fluent-sqlite.git

Fetching https://github.com/vapor/http.git

Fetching https://github.com/vapor/url-encoded-form.git

Completed resolution in 14.86s

Cloning https://github.com/vapor/crypto.git

Resolving https://github.com/vapor/crypto.git at 3.3.3

Cloning https://github.com/vapor/template-kit.git

Resolving https://github.com/vapor/template-kit.git at 1.4.0

Cloning https://github.com/vapor/sqlite.git

Resolving https://github.com/vapor/sqlite.git at 3.2.1

Cloning https://github.com/vapor/fluent.git

Resolving https://github.com/vapor/fluent.git at 3.2.0

Cloning https://github.com/vapor/console.git

Resolving https://github.com/vapor/console.git at 3.1.1

Cloning https://github.com/vapor/service.git

Resolving https://github.com/vapor/service.git at 1.0.2

Cloning https://github.com/vapor/validation.git

Resolving https://github.com/vapor/validation.git at 2.1.1

Cloning https://github.com/vapor/websocket.git

Resolving https://github.com/vapor/websocket.git at 1.1.2

Cloning https://github.com/apple/swift-nio-ssl-support.git

Resolving https://github.com/apple/swift-nio-ssl-support.git at 1.0.0

Cloning https://github.com/vapor/url-encoded-form.git

Resolving https://github.com/vapor/url-encoded-form.git at 1.0.6

Cloning https://github.com/vapor/database-kit.git

Resolving https://github.com/vapor/database-kit.git at 1.3.3

Cloning https://github.com/vapor/vapor.git

Resolving https://github.com/vapor/vapor.git at 3.3.1

Cloning https://github.com/apple/swift-nio-ssl.git

Resolving https://github.com/apple/swift-nio-ssl.git at 1.4.0

Cloning https://github.com/vapor/sql.git

Resolving https://github.com/vapor/sql.git at 2.3.2

Cloning https://github.com/vapor/core.git

Resolving https://github.com/vapor/core.git at 3.9.2

Cloning https://github.com/apple/swift-nio.git

Resolving https://github.com/apple/swift-nio.git at 1.14.1

Cloning https://github.com/vapor/routing.git

Resolving https://github.com/vapor/routing.git at 3.1.0

Cloning https://github.com/vapor/http.git

Resolving https://github.com/vapor/http.git at 3.2.1

Cloning https://github.com/vapor/multipart.git

Resolving https://github.com/vapor/multipart.git at 3.0.4

Cloning https://github.com/vapor/fluent-sqlite.git

Resolving https://github.com/vapor/fluent-sqlite.git at 3.0.0

Cloning https://github.com/apple/swift-nio-zlib-support.git

Resolving https://github.com/apple/swift-nio-zlib-support.git at 1.0.0

**/Users/jeff/VaporTest/.build/checkouts/core/Sources/Core/Process+Execute.swift:163:17:** **warning:** **'launchPath' is deprecated: renamed to 'executableURL'**

process.launchPath = path

**^**

**/Users/jeff/VaporTest/.build/checkouts/core/Sources/Core/Process+Execute.swift:163:17:** **note:** **use 'executableURL' instead**

process.launchPath = path

**^~~~~~~~~~**

executableURL

**/Users/jeff/VaporTest/.build/checkouts/core/Sources/Core/Process+Execute.swift:167:17:** **warning:** **'launch()' is deprecated: renamed to 'run'**

process.launch()

**^**

**/Users/jeff/VaporTest/.build/checkouts/core/Sources/Core/Process+Execute.swift:167:17:** **note:** **use 'run' instead**

process.launch()

**^~~~~~**

run

**/Users/jeff/VaporTest/.build/checkouts/core/Sources/Core/Process+Execute.swift:163:17:** **warning:** **'launchPath' is deprecated: renamed to 'executableURL'**

process.launchPath = path

**^**

**/Users/jeff/VaporTest/.build/checkouts/core/Sources/Core/Process+Execute.swift:163:17:** **note:** **use 'executableURL' instead**

process.launchPath = path

**^~~~~~~~~~**

executableURL

**/Users/jeff/VaporTest/.build/checkouts/core/Sources/Core/Process+Execute.swift:167:17:** **warning:** **'launch()' is deprecated: renamed to 'run'**

process.launch()

**^**

**/Users/jeff/VaporTest/.build/checkouts/core/Sources/Core/Process+Execute.swift:167:17:** **note:** **use 'run' instead**

process.launch()

**^~~~~~**

run

**/Users/jeff/VaporTest/.build/checkouts/websocket/Sources/WebSocket/WebSocketHandler.swift:37:13:** **warning:** **variable 'frame' was never mutated; consider changing to 'let' constant**

var frame = self.unwrapInboundIn(data)

**~~~ ^**

let

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**

**/Users/jeff/VaporTest/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift:2:8:** **error:** **missing required module 'CFURLSessionInterface'**

import FoundationNetworking

**^**