moozzyk/SignalR-Client-Swift

Undefined symbols for architecture arm64

Closed this issue · 5 comments

GJDK commented

The code which worked 3 months back is throwing the below build error.

Kindly help me in this.

Undefined symbols for architecture arm64:
"_inflate", referenced from:
MyFramework.(Inflater in 141339CDE6DAD76818B2487D3534D40B).inflate(: Swift.UnsafePointer<Swift.UInt8>, length: Swift.Int, final: Swift.Bool) throws -> (p: Swift.UnsafeMutablePointer<Swift.UInt8>, n: Swift.Int) in WebSocket.o
"_zlibVersion", referenced from:
MyFramework.(Inflater in _141339CDE6DAD76818B2487D3534D40B).init(windowBits: Swift.Int) -> MyFramework.(Inflater in _141339CDE6DAD76818B2487D3534D40B)? in WebSocket.o
MyFramework.(Deflater in _141339CDE6DAD76818B2487D3534D40B).init(windowBits: Swift.Int, memLevel: Swift.Int) -> MyFramework.(Deflater in _141339CDE6DAD76818B2487D3534D40B)? in WebSocket.o
"deflateInit2", referenced from:
MyFramework.(Deflater in _141339CDE6DAD76818B2487D3534D40B).init(windowBits: Swift.Int, memLevel: Swift.Int) -> MyFramework.(Deflater in _141339CDE6DAD76818B2487D3534D40B)? in WebSocket.o
"_inflateEnd", referenced from:
MyFramework.(Inflater in _141339CDE6DAD76818B2487D3534D40B).__deallocating_deinit in WebSocket.o
"_deflateEnd", referenced from:
MyFramework.(Deflater in _141339CDE6DAD76818B2487D3534D40B).__deallocating_deinit in WebSocket.o
"inflateInit2", referenced from:
MyFramework.(Inflater in _141339CDE6DAD76818B2487D3534D40B).init(windowBits: Swift.Int) -> MyFramework.(Inflater in _141339CDE6DAD76818B2487D3534D40B)? in WebSocket.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

GJDK commented

@moozzyk I resolved this issue by linking libz.tbd file in Xcode.

I am having this problem with xcode 11, so, how did you add libz.tbd in xcode?

@oswaldozapata - I think you need to go to your project settings and try adding libz.tbd to Linked Frameworks and Libraries. Let me know if this helps.

@oswaldozapata Xcode will fail to build the package without a zlib/libz reference. Depending on how you are using the library, you either need to do as Pawel suggests above, or what I've been doing is adding a import zlib reference at the top of the WebSocket.swift file. That allows Xcode to successfully compile SignalRClient.

import Foundation
#if canImport(zlib)
import zlib
#endif