Search code examples
objective-clinker-errorslibpng

Iphone - device - linker error


I have added libpng to my application. If I build for simulator, everything is OK. When I build application for device, I got linker error:

    Undefined symbols for architecture armv7: "_png_init_filter_functions_neon", referenced from: _png_read_filter_row in libpng-arm7-release.a(pngrutil.o)

I have build libpng manually from source, same way for simulator and device (only with changed target of compilation). I have tried to find this problem, but noone seems to post anything about this problem.


Solution

  • I "solved" this by replacing lines 117-121 in libpng's pngpriv.h:

    #  ifdef __ARM_NEON__
    #     define PNG_ARM_NEON_OPT 2
    #  else
    #     define PNG_ARM_NEON_OPT 0
    #  endif
    

    by

    #define PNG_ARM_NEON_OPT 0
    

    This disables ARM's NEON optimizations, which seems to be the cause of the problem.

    This is merely a workaround though, I didn't have time to investigate the real cause of the problem further.