Reputation: 39
I am trying to manually link some swift code from the command-line. Here's what I'm doing:
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
but that fails with the following output :
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'
If I use usr/lib/swift-5.0 instead of usr/lib/swift, the executable complains the dylibs are not usable with OS X more recent than 10.14.4.
What am I missing here? Can you help? Thanks in advance!
Upvotes: 3
Views: 3407
Reputation: 57
This error can be fixed by adding "swift file" and "Create Bridging Header" in your Xcode.
Follow the below steps to resolve this.
Upvotes: 1