Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 489
Martin Perry Avatar asked Sep 30 '13 07:09

Martin Perry


2 Answers

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.

like image 117
Guillaume Algis Avatar answered Sep 28 '22 06:09

Guillaume Algis


Adding to PSyton's comment, here is how we solved it. Compile the arm/*.c files. This however does only work for Android. For iOS, we additionally had to create a new pnglibconf.h with the entries:

#undef PNG_ARM_NEON_API_SUPPORTED
#undef PNG_ARM_NEON_CHECK_SUPPORTED
#define PNG_ARM_NEON_OPT 0

Looking at the ARM defines in libpng, it seems like they are a bit buggy currently, as PNG_ARM_NEON_API_SUPPORTED should be sufficient to turn NEON compilation off.

like image 30
abergmeier Avatar answered Sep 28 '22 06:09

abergmeier