带有动态库的 32 位应用程序在 64 位设备上崩溃 [英] 32-bit App with dynamic library crash on 64-bit device

查看:24
本文介绍了带有动态库的 32 位应用程序在 64 位设备上崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面临以下情况:

  • 32 位设备 + 应用 armv7 + 动态库 armv7 arm64 =工作
  • 64 位设备 + 应用 armv7 + 动态库 armv7 arm64 =不起作用

不起作用 - 应用在加载时崩溃并出现以下错误:

doesn't work - app crashes on load with the following error:

dyld 错误消息库未加载原因未找到合适的图像

dyld error message library not loaded reason no suitable image found

有什么解释吗?

推荐答案

说明:加载到 64 位设备上的 32 位二进制文​​件无法执行此操作,因为 32 位页面大小已从 4096 字节更改为iOS 9 中为 16384 字节.

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.

结论:带有动态库的 32 位应用无法在 64 位设备上运行.

Conclusion: 32-bit apps with dynamic libraries cannot run on 64-bit devices.

解决方案(两者选其一即可):

  • 向动态库项目中的其他链接器标志添加新条目:

  • Add a new entry to Other linker flags in the dynamic library project:

-Wl,-segalign,4000

-Wl,-segalign,4000

  • 更新应用本身以支持 arm64 架构
  • 这篇关于带有动态库的 32 位应用程序在 64 位设备上崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆