简体   繁体   English

条件链接arm64 / armv7

[英]Conditional link arm64/armv7

I have a .a library that was compiled only for the arm64 architecture and I don't have access to the source code. 我有一个.a库,仅针对arm64体系结构进行了编译,但无法访问源代码。

I added preprocessor flags to disable the usage of the library when compiling under armv7 我添加了预处理器标志以在armv7下编译时禁用库的使用

#if arch(arm64)
  // Instatiate an object of the library and use it
#else
  // Do nothing (for armv7)
#endif 

The linking is done via Other linker flags but I am getting the error "Invalid bitcode signature" / Linker command failed. 链接是通过Other linker flags完成的,但出现错误“无效的位码签名” /链接器命令失败。

Is there a way to conditionally link the library? 有条件地链接库的方法吗? I am using Xcode 9 我正在使用Xcode 9

What I actually end up doing to silence the compiler is create a FAT library with no compiled code for the other architectures. 我实际上最终要使编译器保持沉默的方法是创建一个FAT库,而没有其他体系结构的已编译代码。 This would solve the problem as the library is not needed during the linking process 这将解决问题,因为在链接过程中不需要该库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM