illegal text relocation when linking ANE
Hi there, I'm getting this issue when trying to link my ANE with ffmpeg libs which I build on Mac OS X Snow Leopard (XCode 4.2)
ld: illegal text relocation to _uyvyToY_c in ..../libswscale.a(input.o) from _ff_sws_init_input_funcs in ...../libswscale.a(input.o) for architecture i386
Problem is apparently when MachO linking type is set to dynamic lib. When this is static lib/executable any project with ffmpeg links. I've tried something I have found on the internet, which says to use read_only_relocs supress (http://stackoverflow.com/questions/6650178/illegal-text-reloc-to-non-lazy-ptr-error-while-building-in-xcode-4-with-libav-l). This makes the ANE compile, however when I launch the AIR app using this ANE I get a crash. Unfortunately I have a suspicion this is caused by the issue above but because I'm not working on Mac normally and seeing this for first time, I'm not sure. So I'm kind of stuck.
This is a snippet out of the crash(can provide more if needed):
-------------------------------------------------------------------------------------------------------------------------------------
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000016c6d4f1
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 dyld 0x8fe0f318 ImageLoaderMachO::bindLocation(ImageLoader::LinkContext const&, unsigned long, unsigned long, ImageLoader const*, unsigned char, char const*, long, char const*) + 278
1 dyld 0x8fe15ee3 ImageLoaderMachOCompressed::bindAt(ImageLoader::LinkContext const&, unsigned long, unsigned char, char const*, unsigned char, long, int, char const*, ImageLoaderMachOCompressed::LastLookup*) + 131
2 dyld 0x8fe203d1 ImageLoaderMachOCompressed::eachBind(ImageLoader::LinkContext const&, unsigned long (ImageLoaderMachOCompressed::*)(ImageLoader::LinkContext const&, unsigned long, unsigned char, char const*, unsigned char, long, int, char const*, ImageLoaderMachOCompressed::LastLookup*)) + 577
3 dyld 0x8fe22c42 ImageLoaderMachOCompressed::doBind(ImageLoader::LinkContext const&, bool) + 290
4 dyld 0x8fe0cc32 ImageLoader::recursiveBind(ImageLoader::LinkContext const&, bool) + 120
5 dyld 0x8fe0dea3 ImageLoader::link(ImageLoader::LinkContext const&, bool, bool, ImageLoader::RPathChain const&) + 209
6 dyld 0x8fe056af dyld::link(ImageLoader*, bool, ImageLoader::RPathChain const&) + 137
7 dyld 0x8fe0b242 dlopen + 471
8 libSystem.B.dylib 0x904742a8 dlopen + 66
9 com.adobe.AIR 0x02d0b203 FREGetArrayElementAt + 5759
10 com.adobe.AIR 0x02d0b336 FREGetArrayElementAt + 6066
11 com.adobe.AIR 0x02d0b024 FREGetArrayElementAt + 5280
12 com.adobe.AIR 0x02d0a0be FREGetArrayElementAt + 1338
13 com.adobe.AIR 0x02d06443 0x255b000 + 8041539
14 ??? 0x14c93d36 0 + 348732726
15 ??? 0x166b5f28 0 + 376135464
16 com.adobe.AIR 0x027a70ed 0x255b000 + 2408685
-----------------------------------------------------------------------------------------------
As you can see bunch of ImageLoaderMachO and bindLocation, which looks quite connected with the text relocation I supressed above, by the names of the methods at least. The same ffmpeg libs link fine with executables as I said, ie I've got working ffmpeg executable linked with ffmpeg's make and also their samples work. I've tried ffmpeg 2.1 and also ffmpeg 1.1, same issue all the time 😕😕
The same ANE builds fine on Windows, in MingW or VC++...
Anybody has any idea what's wrong, ie. does it look like the crash is casued by this text relocation thing, or did you have something similar in the past, with ffmpeg or other libs? THere's still a chance something else is wrong in my ANE and the relocation hack I had to do is misleading me into thinking its that.
