我正在尝试从命令行手动链接一些快速代码。这就是我正在做的事情:
ld \
-syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk \
-lSystem \
-arch x86_64 \
-macosx_version_min 10.15 \
-o ./bin/main \
-L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx \
main.o
但这失败了,输出如下:
ld: warning: Could not find or use auto-linked library 'swiftCore'
ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find or use auto-linked library 'swiftFoundation'
ld: warning: Could not find or use auto-linked library 'swiftDarwin'
ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find or use auto-linked library 'swiftIOKit'
ld: warning: Could not find or use auto-linked library 'swiftXPC'
ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
ld: warning: Could not find or use auto-linked library 'swiftDispatch'
如果我使用 usr/lib/swift-5.0 而不是 usr/lib/swift,则可执行文件会抱怨 dylib 不适用于比 10.14.4 更新的 OS X。
我在这里想念什么?你能帮我吗?提前致谢!