'ld: Invalid record for architecture arm64
I'm building a framework for tvOS and use an obfuscation software. All sources are compiled with -emit-llvm, obfuscator processes LLVM IR code, then it is compiled into .o with clang++, then ld is being called to produce the final binary and ld fails with this error:
ld: Invalid record for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Program xcrun returned error code 1
Reproducible on different machines with Xcode 11.2.1 and 11.3.
How can I troubleshoot this error? I've added -v to the linker flags but it did not add any hints to the output.
Solution 1:[1]
In my case, I was getting this error when the app was linked to external libraries but only when generating the Product Archive.
The solution for me was to disable the bitcode of the Target under Build Settings > Build Options.
I had it previously disabled but my Xcode updated recently and the setting might have gotten overridden.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Marcelo Santos |
