Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 7.2 Dynamic Framework 32 bit device error

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:

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.

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

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

like image 918
Adil Soomro Avatar asked Feb 18 '16 15:02

Adil Soomro


1 Answers

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.

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)

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

like image 121
Jean-Philippe Jodoin Avatar answered Nov 11 '22 04:11

Jean-Philippe Jodoin