在 macOS 上为 Raspberry Pi 交叉编译 Swift 代码

Cross-compile Swift code for Raspberry Pi on macOS

使用 macOS Xcode 设置为 Raspberry Pi (3b+) 构建代码的最简单/最佳方法是什么?

有些构建可能非常繁重,因此在 Raspberry 上构建它们会花费很长时间。因此,最好在 macOS 上构建。我应该怎么做?

注意:我知道那里有很多信息。 但是,有些已经有几年了,Swift 变化很快。

为了回答我自己的问题,目前最好的解决方案(最近)是: https://github.com/CSCIX65G/swift-mac2arm-x-compile-toolchain

这提供了在 macOS 上为 R Pi 构建所需的工具链等。 可以在此处找到远程调试(使用 lldb)的最佳说明: https://lldb.llvm.org/use/remote.html

请注意,在 macOS 上,您需要使用工具链提供的 lldb 版本,例如:

[path_to_toolchains]/Toolchains/arm64-swift.xctoolchain/usr/bin/lldb -o "platform select remote-linux" -o "platform connect connect://ipaddress:port" -o "file ./remoteProgram"

仍在寻求将 lldb 调试器连接到 Mac 上的 Xcode 运行。如果可以做到,则开发周期完成。