swift-nio: Can't build SwiftNIOPosix in Release (using Pods as a packet manager)
Expected behavior
I expect I can build in release mode my app that uses SwiftNIO pod. This is my pod (https://github.com/madmag77/STUNClient/blob/master/StunClient.podspec) that uses SwiftNIO as a dependency.
Actual behavior
This is a sample app (https://github.com/madmag77/STUNClient/tree/master/iOSExampleWithPods) that can’t be built in release mode when uses SwiftNIO pod version 2.38.
Output:
Ld /Users/artemgoncharov/Downloads/STUNClient/iOSExampleWithPods/DerivedData/STUNClient/Build/Intermediates.noindex/Pods.build/Release-iphoneos/SwiftNIOPosix.build/Objects-normal/arm64/Binary/NIOPosix normal arm64 (in target 'SwiftNIOPosix' from project 'Pods')
cd /Users/artemgoncharov/Downloads/STUNClient/iOSExampleWithPods/Pods
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target arm64-apple-ios10.0 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk -L/Users/artemgoncharov/Downloads/STUNClient/iOSExampleWithPods/DerivedData/STUNClient/Build/Products/Release-iphoneos/SwiftNIOPosix -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk/usr/lib/swift -F/Users/artemgoncharov/Downloads/STUNClient/iOSExampleWithPods/DerivedData/STUNClient/Build/Products/Release-iphoneos/SwiftNIOPosix -F/Users/artemgoncharov/Downloads/STUNClient/iOSExampleWithPods/DerivedData/STUNClient/Build/Products/Release-iphoneos/CNIOAtomics -F/Users/artemgoncharov/Downloads/STUNClient/iOSExampleWithPods/DerivedData/STUNClient/Build/Products/Release-iphoneos/CNIODarwin -F/Users/artemgoncharov/Downloads/STUNClient/iOSExampleWithPods/DerivedData/STUNClient/Build/Products/Release-iphoneos/CNIOLinux -F/Users/artemgoncharov/Downloads/STUNClient/iOSExampleWithPods/DerivedData/STUNClient/Build/Products/Release-iphoneos/CNIOWindows -F/Users/artemgoncharov/Downloads/STUNClient/iOSExampleWithPods/DerivedData/STUNClient/Build/Products/Release-iphoneos/SwiftNIOConcurrencyHelpers -F/Users/artemgoncharov/Downloads/STUNClient/iOSExampleWithPods/DerivedData/STUNClient/Build/Products/Release-iphoneos/SwiftNIOCore -F/Users/artemgoncharov/Downloads/STUNClient/iOSExampleWithPods/DerivedData/STUNClient/Build/Products/Release-iphoneos/_NIODataStructures -filelist /Users/artemgoncharov/Downloads/STUNClient/iOSExampleWithPods/DerivedData/STUNClient/Build/Intermediates.noindex/Pods.build/Release-iphoneos/SwiftNIOPosix.build/Objects-normal/arm64/NIOPosix.LinkFileList -install_name @rpath/NIOPosix.framework/NIOPosix -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/artemgoncharov/Downloads/STUNClient/iOSExampleWithPods/DerivedData/STUNClient/Build/Intermediates.noindex/Pods.build/Release-iphoneos/SwiftNIOPosix.build/Objects-normal/arm64/NIOPosix_lto.o -fembed-bitcode-marker -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/artemgoncharov/Downloads/STUNClient/iOSExampleWithPods/DerivedData/STUNClient/Build/Intermediates.noindex/Pods.build/Release-iphoneos/SwiftNIOPosix.build/Objects-normal/arm64/NIOPosix.swiftmodule -framework CNIODarwin -framework CNIOLinux -framework CNIOWindows -framework NIOConcurrencyHelpers -framework NIOCore -framework _NIODataStructures -framework Foundation -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/artemgoncharov/Downloads/STUNClient/iOSExampleWithPods/DerivedData/STUNClient/Build/Intermediates.noindex/Pods.build/Release-iphoneos/SwiftNIOPosix.build/Objects-normal/arm64/NIOPosix_dependency_info.dat -o /Users/artemgoncharov/Downloads/STUNClient/iOSExampleWithPods/DerivedData/STUNClient/Build/Intermediates.noindex/Pods.build/Release-iphoneos/SwiftNIOPosix.build/Objects-normal/arm64/Binary/NIOPosix
Undefined symbols for architecture arm64:
"_catmc_nio_atomic__Bool_compare_and_exchange", referenced from:
NIOPosix.PendingDatagramWritesManager.add(envelope: NIOCore.AddressedEnvelope<NIOCore.ByteBuffer>, promise: NIOCore.EventLoopPromise<()>?) -> Swift.Bool in PendingDatagramWritesManager.o
NIOPosix.PendingStreamWritesManager.add(data: NIOCore.IOData, promise: NIOCore.EventLoopPromise<()>?) -> Swift.Bool in PendingWritesManager.o
"_catmc_nio_atomic_long_add", referenced from:
NIOPosix.MultiThreadedEventLoopGroup.next() -> NIOCore.EventLoop in MultiThreadedEventLoopGroup.o
function signature specialization <Arg[0] = Owned To Guaranteed, Arg[1] = Owned To Guaranteed> of NIOPosix.MultiThreadedEventLoopGroup.init(threadInitializers: [(NIOPosix.NIOThread) -> ()], selectorFactory: () throws -> NIOPosix.Selector<NIOPosix.NIORegistration>) -> NIOPosix.MultiThreadedEventLoopGroup in MultiThreadedEventLoopGroup.o
"_catmc_nio_atomic_long_create_with_existing_storage", referenced from:
variable initialization expression of NIOPosix.MultiThreadedEventLoopGroup.(index in _C2B1528F4FBA68A3DBFA89DBAEBE9D4D) : NIOConcurrencyHelpers.NIOAtomic<Swift.Int> in BaseSocket.o
one-time initialization function for (nextEventLoopGroupID in _C2B1528F4FBA68A3DBFA89DBAEBE9D4D) in MultiThreadedEventLoopGroup.o
function signature specialization <Arg[0] = Owned To Guaranteed, Arg[1] = Owned To Guaranteed> of NIOPosix.MultiThreadedEventLoopGroup.init(threadInitializers: [(NIOPosix.NIOThread) -> ()], selectorFactory: () throws -> NIOPosix.Selector<NIOPosix.NIORegistration>) -> NIOPosix.MultiThreadedEventLoopGroup in MultiThreadedEventLoopGroup.o
"_catmc_nio_atomic__Bool_store", referenced from:
NIOPosix.BaseSocketChannel.close0(error: Swift.Error, mode: NIOCore.CloseMode, promise: NIOCore.EventLoopPromise<()>?) -> () in BaseSocketChannel.o
NIOPosix.BaseSocketChannel.becomeActive0(promise: NIOCore.EventLoopPromise<()>?) -> () in BaseSocketChannel.o
NIOPosix.PendingDatagramWritesManager.(didWrite in _DAB463F912477C8697B1F8AEBF8BD15A)(_: NIOPosix.IOResult<Swift.Int>, messages: Swift.UnsafeMutableBufferPointer<__C.CNIODarwin_mmsghdr>?) -> NIOPosix.OneWriteOperationResult in PendingDatagramWritesManager.o
function signature specialization <Arg[0] = [Closure Propagated : closure #1 (NIOPosix.WriteMechanism) throws -> NIOPosix.OneWriteOperationResult in NIOPosix.PendingDatagramWritesManager.triggerAppropriateWriteOperations(scalarWriteOperation: (Swift.UnsafeRawBufferPointer, Swift.UnsafePointer<__C.sockaddr>, Swift.UInt32, Swift.Optional<NIOCore.AddressedEnvelope<NIOCore.ByteBuffer>.Metadata>) throws -> NIOPosix.IOResult<Swift.Int>, vectorWriteOperation: (Swift.UnsafeMutableBufferPointer<__C.CNIODarwin_mmsghdr>) throws -> NIOPosix.IOResult<Swift.Int>) throws -> NIOPosix.OverallWriteResult, Argument Types : [NIOPosix.PendingDatagramWritesManager@callee_guaranteed (@unowned Swift.UnsafeRawBufferPointer, @unowned Swift.UnsafePointer<__C.sockaddr>, @unowned Swift.UInt32, @guaranteed NIOCore.AddressedEnvelope<NIOCore.ByteBuffer>.Metadata?) -> (@unowned NIOPosix.IOResult<Swift.Int>, @error @owned Swift.Error)@callee_guaranteed (@unowned Swift.UnsafeMutableBufferPointer<__C.CNIODarwin_mmsghdr>) -> (@unowned NIOPosix.IOResult<Swift.Int>, @error @owned Swift.Error)]> of generic specialization <NIOPosix.PendingDatagramWritesManager> of (extension in NIOPosix):NIOPosix.PendingWritesManager.triggerWriteOperations(triggerOneWriteOperation: (NIOPosix.WriteMechanism) throws -> NIOPosix.OneWriteOperationResult) throws -> NIOPosix.OverallWriteResult in PendingWritesManager.o
function signature specialization <Arg[0] = [Closure Propagated : closure #1 (NIOPosix.WriteMechanism) throws -> NIOPosix.OneWriteOperationResult in NIOPosix.PendingStreamWritesManager.triggerAppropriateWriteOperations(scalarBufferWriteOperation: (Swift.UnsafeRawBufferPointer) throws -> NIOPosix.IOResult<Swift.Int>, vectorBufferWriteOperation: (Swift.UnsafeBufferPointer<__C.iovec>) throws -> NIOPosix.IOResult<Swift.Int>, scalarFileWriteOperation: (Swift.Int32, Swift.Int, Swift.Int) throws -> NIOPosix.IOResult<Swift.Int>) throws -> NIOPosix.OverallWriteResult, Argument Types : [NIOPosix.PendingStreamWritesManager@callee_guaranteed (@unowned Swift.UnsafeRawBufferPointer) -> (@unowned NIOPosix.IOResult<Swift.Int>, @error @owned Swift.Error)@callee_guaranteed (@unowned Swift.UnsafeBufferPointer<__C.iovec>) -> (@unowned NIOPosix.IOResult<Swift.Int>, @error @owned Swift.Error)@callee_guaranteed (@unowned Swift.Int32, @unowned Swift.Int, @unowned Swift.Int) -> (@unowned NIOPosix.IOResult<Swift.Int>, @error @owned Swift.Error)]> of generic specialization <NIOPosix.PendingStreamWritesManager> of (extension in NIOPosix):NIOPosix.PendingWritesManager.triggerWriteOperations(triggerOneWriteOperation: (NIOPosix.WriteMechanism) throws -> NIOPosix.OneWriteOperationResult) throws -> NIOPosix.OverallWriteResult in PendingWritesManager.o
NIOPosix.PendingStreamWritesManager.(didWrite in _E8AD929129EAA2971226E80CBC6171E1)(itemCount: Swift.Int, result: NIOPosix.IOResult<Swift.Int>) -> NIOPosix.OneWriteOperationResult in PendingWritesManager.o
generic specialization <NIOPosix.Socket> of NIOPosix.BaseSocketChannel.close0(error: Swift.Error, mode: NIOCore.CloseMode, promise: NIOCore.EventLoopPromise<()>?) -> () in SocketChannel.o
...
"_catmc_nio_atomic__Bool_load", referenced from:
NIOPosix.BaseSocketChannel.isActive.getter : Swift.Bool in BaseSocketChannel.o
NIOPosix.BaseStreamSocketChannel.isWritable.getter : Swift.Bool in BaseStreamSocketChannel.o
function signature specialization <Arg[0] = [Closure Propagated : closure #1 (NIOPosix.WriteMechanism) throws -> NIOPosix.OneWriteOperationResult in NIOPosix.PendingDatagramWritesManager.triggerAppropriateWriteOperations(scalarWriteOperation: (Swift.UnsafeRawBufferPointer, Swift.UnsafePointer<__C.sockaddr>, Swift.UInt32, Swift.Optional<NIOCore.AddressedEnvelope<NIOCore.ByteBuffer>.Metadata>) throws -> NIOPosix.IOResult<Swift.Int>, vectorWriteOperation: (Swift.UnsafeMutableBufferPointer<__C.CNIODarwin_mmsghdr>) throws -> NIOPosix.IOResult<Swift.Int>) throws -> NIOPosix.OverallWriteResult, Argument Types : [NIOPosix.PendingDatagramWritesManager@callee_guaranteed (@unowned Swift.UnsafeRawBufferPointer, @unowned Swift.UnsafePointer<__C.sockaddr>, @unowned Swift.UInt32, @guaranteed NIOCore.AddressedEnvelope<NIOCore.ByteBuffer>.Metadata?) -> (@unowned NIOPosix.IOResult<Swift.Int>, @error @owned Swift.Error)@callee_guaranteed (@unowned Swift.UnsafeMutableBufferPointer<__C.CNIODarwin_mmsghdr>) -> (@unowned NIOPosix.IOResult<Swift.Int>, @error @owned Swift.Error)]> of generic specialization <NIOPosix.PendingDatagramWritesManager> of (extension in NIOPosix):NIOPosix.PendingWritesManager.triggerWriteOperations(triggerOneWriteOperation: (NIOPosix.WriteMechanism) throws -> NIOPosix.OneWriteOperationResult) throws -> NIOPosix.OverallWriteResult in PendingWritesManager.o
function signature specialization <Arg[0] = [Closure Propagated : closure #1 (NIOPosix.WriteMechanism) throws -> NIOPosix.OneWriteOperationResult in NIOPosix.PendingStreamWritesManager.triggerAppropriateWriteOperations(scalarBufferWriteOperation: (Swift.UnsafeRawBufferPointer) throws -> NIOPosix.IOResult<Swift.Int>, vectorBufferWriteOperation: (Swift.UnsafeBufferPointer<__C.iovec>) throws -> NIOPosix.IOResult<Swift.Int>, scalarFileWriteOperation: (Swift.Int32, Swift.Int, Swift.Int) throws -> NIOPosix.IOResult<Swift.Int>) throws -> NIOPosix.OverallWriteResult, Argument Types : [NIOPosix.PendingStreamWritesManager@callee_guaranteed (@unowned Swift.UnsafeRawBufferPointer) -> (@unowned NIOPosix.IOResult<Swift.Int>, @error @owned Swift.Error)@callee_guaranteed (@unowned Swift.UnsafeBufferPointer<__C.iovec>) -> (@unowned NIOPosix.IOResult<Swift.Int>, @error @owned Swift.Error)@callee_guaranteed (@unowned Swift.Int32, @unowned Swift.Int, @unowned Swift.Int) -> (@unowned NIOPosix.IOResult<Swift.Int>, @error @owned Swift.Error)]> of generic specialization <NIOPosix.PendingStreamWritesManager> of (extension in NIOPosix):NIOPosix.PendingWritesManager.triggerWriteOperations(triggerOneWriteOperation: (NIOPosix.WriteMechanism) throws -> NIOPosix.OneWriteOperationResult) throws -> NIOPosix.OverallWriteResult in PendingWritesManager.o
NIOPosix.PendingStreamWritesManager.description.getter : Swift.String in PendingWritesManager.o
NIOPosix.PipeChannel.description.getter : Swift.String in PipeChannel.o
NIOPosix.DatagramChannel.isWritable.getter : Swift.Bool in SocketChannel.o
...
"_catmc_nio_atomic__Bool_create_with_existing_storage", referenced from:
NIOPosix.PendingDatagramWritesManager.init(msgs: Swift.UnsafeMutableBufferPointer<__C.CNIODarwin_mmsghdr>, iovecs: Swift.UnsafeMutableBufferPointer<__C.iovec>, addresses: Swift.UnsafeMutableBufferPointer<__C.sockaddr_storage>, storageRefs: Swift.UnsafeMutableBufferPointer<Swift.Unmanaged<Swift.AnyObject>>, controlMessageStorage: NIOPosix.UnsafeControlMessageStorage) -> NIOPosix.PendingDatagramWritesManager in PendingDatagramWritesManager.o
NIOPosix.PendingStreamWritesManager.init(iovecs: Swift.UnsafeMutableBufferPointer<__C.iovec>, storageRefs: Swift.UnsafeMutableBufferPointer<Swift.Unmanaged<Swift.AnyObject>>) -> NIOPosix.PendingStreamWritesManager in PendingWritesManager.o
function signature specialization <Arg[1] = Owned To Guaranteed, Arg[2] = Owned To Guaranteed> of generic specialization <NIOPosix.ServerSocket> of NIOPosix.BaseSocketChannel.init(socket: A, parent: NIOCore.Channel?, eventLoop: NIOPosix.SelectableEventLoop, recvAllocator: NIOCore.RecvByteBufferAllocator) throws -> NIOPosix.BaseSocketChannel<A> in SocketChannel.o
function signature specialization <Arg[1] = Owned To Guaranteed, Arg[2] = Owned To Guaranteed> of generic specialization <NIOPosix.PipePair> of NIOPosix.BaseSocketChannel.init(socket: A, parent: NIOCore.Channel?, eventLoop: NIOPosix.SelectableEventLoop, recvAllocator: NIOCore.RecvByteBufferAllocator) throws -> NIOPosix.BaseSocketChannel<A> in SocketChannel.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Same errors I’m having when use command pod lib lint
for the above pod:
-> StunClient (1.0.5)
- ERROR | xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
- NOTE | xcodebuild: note: Using new build system
- NOTE | xcodebuild: note: Using codesigning identity override: -
- NOTE | xcodebuild: note: Build preparation complete
- NOTE | xcodebuild: note: Planning
- NOTE | xcodebuild: note: Building targets in dependency order
- NOTE | xcodebuild: NIOPosix.BaseSocketChannel.close0(error: Swift.Error, mode: NIOCore.CloseMode, promise: NIOCore.EventLoopPromise<()>?) -> () in BaseSocketChannel.o
- NOTE | xcodebuild: generic specialization <NIOPosix.Socket> of NIOPosix.BaseSocketChannel.close0(error: Swift.Error, mode: NIOCore.CloseMode, promise: NIOCore.EventLoopPromise<()>?) -> () in SocketChannel.o
- NOTE | xcodebuild: merged generic specialization <NIOPosix.ServerSocket> of NIOPosix.BaseSocketChannel.close0(error: Swift.Error, mode: NIOCore.CloseMode, promise: NIOCore.EventLoopPromise<()>?) -> () in SocketChannel.o
- NOTE | xcodebuild: clang: error: linker command failed with exit code 1 (use -v to see invocation)
- NOTE | xcodebuild: note: Using codesigning identity override:
another evidence from the independent source - https://github.com/grpc/grpc-swift/issues/1369 - they are having the same issue.
Steps to reproduce
- git clone git@github.com:madmag77/STUNClient.git
- cd STUNClient
- pod lib lint
If possible, minimal yet complete reproducer code (or URL to code)
no code needed to reproduce
SwiftNIO version/commit hash
SwiftNIO 2.38
System & version information
Please provide at the very least your operating system and Swift version information.
Ideally, run
scripts/nio-diagnose -o nio-diagnose.md PID_OF_YOUR_NIO_PROGRAM
and attach (or paste) the resulting file nio-diagnose.md
into this bug report
or send it to the SwiftNIO maintainers privately.
I’ve done the above and can send that file to the maintainers (need an email to send to).
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (11 by maintainers)
Commits related to this issue
- Script to list transitive dependencies Motivation: Cocoapods appears to have a different idea of the dependency graph to SPM which has led to a handful of build failures (e.g. https://github.com/app... — committed to glbrntt/swift-nio by glbrntt 2 years ago
- Script to list transitive dependencies Motivation: Cocoapods appears to have a different idea of the dependency graph to SPM which has led to a handful of build failures (e.g. https://github.com/app... — committed to glbrntt/swift-nio by glbrntt 2 years ago
- Script to list transitive dependencies (#2082) Motivation: Cocoapods appears to have a different idea of the dependency graph to SPM which has led to a handful of build failures (e.g. https://gi... — committed to apple/swift-nio by glbrntt 2 years ago
- Update podspec script Motivation: To workaround https://github.com/apple/swift-nio/issues/2073 we must list all transitive dependencies when building podspecs. Modifications: - Include transitive ... — committed to glbrntt/swift-nio-transport-services by glbrntt 2 years ago
- Update podspec script (#143) Motivation: To workaround https://github.com/apple/swift-nio/issues/2073 we must list all transitive dependencies when building podspecs. Modifications: - Inclu... — committed to apple/swift-nio-transport-services by glbrntt 2 years ago
- Update podspec generation Motivation: Pods need to include all transitive dependencies in order to work around https://github.com/apple/swift-nio/issues/2073. We also ship a second library from thi... — committed to glbrntt/swift-nio-extras by glbrntt 2 years ago
- Update pod generation script Motivation: To workaround https://github.com/apple/swift-nio/issues/2073 we must list all transitive dependencies when building podspecs. Modifications: - Copy over `l... — committed to glbrntt/swift-nio-ssl by glbrntt 2 years ago
- Update podspec generation (#161) Motivation: Pods need to include all transitive dependencies in order to work around https://github.com/apple/swift-nio/issues/2073. We also ship a second libr... — committed to apple/swift-nio-extras by glbrntt 2 years ago
- Update pod generation script Motivation: To workaround https://github.com/apple/swift-nio/issues/2073 we must list all transitive dependencies when building podspecs. Modifications: - Copy over `l... — committed to glbrntt/swift-nio-ssl by glbrntt 2 years ago
- Update pod generation script Motivation: To workaround https://github.com/apple/swift-nio/issues/2073 we must list all transitive dependencies when building podspecs. Modifications: - Copy over `l... — committed to apple/swift-nio-ssl by glbrntt 2 years ago
- update swift-nio https://github.com/apple/swift-nio/issues/2073 — committed to entaku0818/grpc-swift by entaku0818 2 years ago
- Update SwiftNIO dependency to 2.40.0 (#153) SwiftNIO team fixed a CocoaPods link error issue that was preventing clients from building with parallelization enabled: apple/swift-nio#2073 (comment) ... — committed to mobilecoinofficial/MobileCoin-Swift by collinjackson 2 years ago
@madmag77 this should be resolved in the latest NIO releases (2.40.0), please let us know if it isn’t!
Indeed it does not, but
dump-package
tells us which package dependency the product dependency comes from and the URL to that package, so we can recursively clone our way to success. I can throw a prototype together real quick.Seems to be the same issue as grpc/grpc-swift#1369.
@glbrntt any idea whether we changed the pod spec generation here? If not, I think the SwiftPM we’re using is generating a different dependency graph.