madmag77 / STUNClient

Stun client written in Swift for exploration of NAT traversal details (iOS/macOs/Linux)
MIT License
21 stars 7 forks source link

Xcode 13.3 and Swift 5.6 #12

Open rbrovko opened 2 years ago

rbrovko commented 2 years ago

Need update StunClient.podspec from s.dependency 'SwiftNIO', '~> 2.18.0' to s.dependency 'SwiftNIO', '~> 2.38.0'

programming086 commented 2 years ago

PR https://github.com/madmag77/STUNClient/pull/13

madmag77 commented 2 years ago

It turned out to be not that easy. When I'm doing pod lib lint with the new version inside the podSpec it returns error and doesn't allow me to upload new spec to cocoaPods:

-> 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:

Same results can be achived by trying to build the StunClientWithPods for simulator in release. You can see errors, like:

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
      ...

I believe it's a problem in SwiftNIOConcurrencyHelpers, so I'll create an issue for them.

rbrovko commented 2 years ago

OK. I tried to build StunClientWithPods for simulator in debug mode only.

madmag77 commented 2 years ago

Yeah, me too. But updated pod can't be uploaded to CocoaPods without fixing the building in release mode, unfortunately.

Issue to SwiftNIO - https://github.com/apple/swift-nio/issues/2073

rbrovko commented 2 years ago

Hello @madmag77 . Swift-NIO fixed and released 2.40.0

madmag77 commented 2 years ago

Hey @rbrovko, thanks a lot for your help with this issue! I updated the pod to 1.0.6 with the new Swift-NIO. Please let me know if there is still a problem. For me it works like a charm now...