illegal text reloc to non_lazy_ptr error while building in xcode 4 with libav* libraries

不打扰是莪最后的温柔 提交于 2019-12-01 05:46:33

问题


I'm trying to build a simple application that uses ffmpeg's libav* libraries in xcode 4 and getting the following error:

ld: illegal text reloc to non_lazy_ptr from /ffmpeg/temp/ffmpeg-0.8/builduni/lib/libavcodec.a(ac3.o) in _ff_ac3_bit_alloc_calc_psd for architecture i386

I've already tried to run ranlib -c libavcodec.a to fix this problem, but nothing happend. One more thing: my libav* libraries are fat binaries (i386 + x86_64).

Any ideas what can it be?


回答1:


I have the same error. Finally, I got the solution at http://lists.apple.com/archives/unix-porting/2008/Jan/msg00027.html

just add other link flag:

-read_only_relocs suppress

* EXPLANATION * The two assembly commands load the absolutes address of _trail into R15. Doing so is fine if _trail is ultimately in the same linkage unit. _trail is in libmodule.dylib. For this to work, at runtime the dynamic loader (dyld) would have to rewrite the two instructions. Normally dyld only updates data pointers. One work around is to make libdyalog an archive (e.g. libdyalog.a) and link that with pere.s. Then all the code would be in the same linkage unit, so there would be no need for runtime text relocs. The runtime (dyld) does support text relocs (updating instructions) for i386, but you need to link with -read_only_relocs suppress.



来源:https://stackoverflow.com/questions/6650178/illegal-text-reloc-to-non-lazy-ptr-error-while-building-in-xcode-4-with-libav-l

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!