Xcode 7.2动态框架32位设备错误

时间:2022-09-14 20:51:34

We've a large project having multiple apps, So we've moved common code into single dynamic framework. So far running fine on 64 bit devices, but having a crash on 32 bit devices as follow:

我们有一个拥有多个应用程序的大型项目,因此我们将公共代码转移到单个动态框架中。到目前为止,在64位设备上运行良好,但在32位设备上崩溃如下:

dyld: REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB has segment 0 which is not a writable segment (__TEXT) in
/path/to/MyApp.app/Frameworks/MyFramework.framework/MyFramework

A little background: We've ffmpeg and few other fat libs compiled against ARM64, ARMv7 and x86_64 architectures then added to framework. We had some text-relocation errors which were resolved by adding -read_only_relocs suppress to linker flag.

一点背景:我们已经将ffmpeg和其他几个针对ARM64,ARMv7和x86_64架构编译的胖库添加到框架中。我们有一些文本重定位错误,通过将-read_only_relocs suppress添加到链接器标志来解决。

If we take out the ffmpeg and related libraries, it works fine on 32 bit devices.

如果我们取出ffmpeg和相关库,它可以在32位设备上正常工作。

Has anyone came across such error? Any pointer or help would be much appreciated.

有人遇到过这样的错误吗?任何指针或帮助将非常感激。

1 个解决方案

#1


1  

We had the same issue when using "Dynamic Library" for the Mach-O Type inside your framework. Switching to "Relocatable Object File" fixed the issue. The issue seems to be with text relocation inside the libraries.

在框架内使用Mach-O Type的“动态库”时,我们遇到了同样的问题。切换到“可重定位目标文件”修复了该问题。问题似乎在于库内的文本重定位。

As described in more details here: "A text relocation is the result of a reference to an object with a variable address at runtime using an absolute addressing mode. The instruction encoding itself contains the address and therefore the executable text of the binary must be changed to contain the correct address when taking the actual load addresses at runtime into account."

正如这里更详细描述的那样:“文本重定位是在运行时使用绝对寻址模式引用具有变量地址的对象的结果。指令编码本身包含地址,因此必须更改二进制文件的可执行文本在考虑运行时的实际加载地址时包含正确的地址。“

FFMPEG use text relocations and it has been a big issue on Android M (https://trac.ffmpeg.org/ticket/4928)

FFMPEG使用文本重定位,这是Android M上的一个大问题(https://trac.ffmpeg.org/ticket/4928)

Since they are not gonna be fixed anytime soon, "Relocatable Object File" seems to be the only option.

由于它们不会很快被修复,“可重定位目标文件”似乎是唯一的选择。

#1


1  

We had the same issue when using "Dynamic Library" for the Mach-O Type inside your framework. Switching to "Relocatable Object File" fixed the issue. The issue seems to be with text relocation inside the libraries.

在框架内使用Mach-O Type的“动态库”时,我们遇到了同样的问题。切换到“可重定位目标文件”修复了该问题。问题似乎在于库内的文本重定位。

As described in more details here: "A text relocation is the result of a reference to an object with a variable address at runtime using an absolute addressing mode. The instruction encoding itself contains the address and therefore the executable text of the binary must be changed to contain the correct address when taking the actual load addresses at runtime into account."

正如这里更详细描述的那样:“文本重定位是在运行时使用绝对寻址模式引用具有变量地址的对象的结果。指令编码本身包含地址,因此必须更改二进制文件的可执行文本在考虑运行时的实际加载地址时包含正确的地址。“

FFMPEG use text relocations and it has been a big issue on Android M (https://trac.ffmpeg.org/ticket/4928)

FFMPEG使用文本重定位,这是Android M上的一个大问题(https://trac.ffmpeg.org/ticket/4928)

Since they are not gonna be fixed anytime soon, "Relocatable Object File" seems to be the only option.

由于它们不会很快被修复,“可重定位目标文件”似乎是唯一的选择。