Reputation: 211740
I've built a simple Swift project that produces a macOS command-line tool and has an associated custom Swift library (.dylib
) but when compiling and running it there's a number of warnings that show up of the form:
objc[9532]: Class _SwiftNativeNSEnumeratorBase is implemented in both /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftCore.dylib (0x100cca3f0) and /Users/.../Build/Products/Debug/MyTool (0x1003e84c0). One of the two will be used. Which one is undefined.
Scanning the resulting MyTool
binary shows that it contains that function, so I'm presuming it's been baked in somehow via static linking. The .dylib
is expecting that to be present as a shared library, so it seems that's where the duplication comes about.
I've tried many settings in the project and target level, but none seem to control embedding things like the core Framework as a static library other than the explicit embed option.
For both targets Always Embed Swift Libraries is set to "No". Clean and build still produces the duplication warnings.
Upvotes: 1
Views: 869
Reputation: 211740
It looks like there's a few things that have to be changed to resolve this:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx
or the appropriate library set. These seem to include a newer version of the Swift libraries than those present in the default location..../usr/lib/swift/macos
location. A Swift project needs libswiftCore.dylib
.Due to C bindings I also had to include libc
, but the default one (libc.tbc
) sufficed.
Upvotes: 0