Xcode build fails with Undefined symbols for architecture arm64:

1.8k Views Asked by At

I got the following warning on Github CI when trying to build an iOS archive:

ld: warning: ignoring file ios/myframework.xcframework/ios-arm64/myframework.framework/myframework, building for iOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F )

then this error followed:

Undefined symbols for architecture arm64:

Now the confusing thing is that this error can happen because of several reasons, in my case, it was neither of any I could find online.

1

There are 1 best solutions below

6
On

After hours of debugging I was able to figure out that the unknown-unsupported file format warning appeared because I was using Git LFS for the framework's binary. Git LFS replaces the binary with a text pointer. When Xcode was trying to build my archive on the CI, it didn't pull the binary from LFS, hence the string pointer remained at ios/myframework.xcframework/ios-arm64/myframework.framework/myframework. Make sure to pull your large binaries from LFS before trying to setup an Xcode build on the CI or you might see some not-so-easy-to-debug issues like this.

So the solution was actually as easy as running git lfs pull before trying to build the archive, and voilá, the error was gone.