简体   繁体   English

具有动态库的32位应用程序在64位设备上崩溃

[英]32-bit App with dynamic library crash on 64-bit device

I am facing the following scenario: 我正面临以下情形:

  • 32 bit device + app armv7 + dynamic library armv7 arm64 = work 32位设备+应用程序armv7 +动态库armv7 arm64 = 工作
  • 64 bit device + app armv7 + dynamic library armv7 arm64 = doesn't work 64位设备+应用程序armv7 +动态库armv7 arm64 = 不起作用

doesn't work - app crashes on load with the following error: 不起作用 -应用程序加载时崩溃,并显示以下错误:

dyld error message library not loaded reason no suitable image found dyld错误消息库未加载原因找不到合适的图像

Any explanations? 有什么解释吗?

Explanation : 32 bit binaries loaded on 64 bit devices fail to do so since the 32 bit pagesize has been changed from 4096 bytes to 16384 bytes in iOS 9. 说明 :由于在iOS 9中将32位页面大小从4096字节更改为16384字节,因此无法在64位设备上加载32位二进制文​​件。

Conclusion : 32-bit apps with dynamic libraries cannot run on 64-bit devices. 结论 :具有动态库的32位应用程序不能在64位设备上运行。

Solutions (one of the two is enough): 解决方案 (两个就足够了):

  • Add a new entry to Other linker flags in the dynamic library project: 在动态库项目中的“其他链接器”标志中添加一个新条目:

    -Wl,-segalign,4000 -Wl,-segalign,4000

  • Update app itself to support arm64 architecture 更新应用程序本身以支持arm64架构

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

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