Linker error when unit testing: ld: illegal text-relocation to cstring in … from _av_image_check_size in …/libavutil.a(imgutils.o)

前端 未结 4 943
说谎
说谎 2021-01-13 04:16

In Xcode 4.3.2, building an iPad app, which includes libavutil.a from the ffmpeg distribution, it builds and runs correctly but when I try to run unit tests (Cm

相关标签:
4条回答
  • 2021-01-13 04:48

    I solved this linker error by enabling Position-Independent Code in the compiler and linker settings in XCode.

    0 讨论(0)
  • 2021-01-13 04:52

    The answer, from here.

    is to add:

    -read_only_relocs suppress
    

    to the linker flags.

    The other link explains why. The solution was originally found here.

    0 讨论(0)
  • 2021-01-13 05:04

    Just to be specific, the line that specifically worked to fix a similar linking error with ffmpeg for 32bit OSX link using xcode/c++11, was to add -Wl,-read_only_relocs,suppress to the link line. Variations of this didn't work.

    0 讨论(0)
  • 2021-01-13 05:13

    For those who have read answers above but it did not help, check your "Product -> Scheme -> Edit Scheme". It should be "debug" for simulator and for device it does not matter. Otherwise you will get strange bugs like it cannot see some parts of your project.

    0 讨论(0)
提交回复
热议问题