Error iPhone - device - linker

I added libpng to my application. If I build for the simulator, everything is in order. When I create the application for the device, I got a 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 libpng manually from the source, as well as for the simulator and device (only with a modified compilation purpose). I tried to find this problem, but nobody seems to be writing anything about this problem.

+7
source share
2 answers

I "solved" this by replacing lines 117-121 with libpng 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 NEON optimization, which seems to be causing the problem.

This is just a workaround, but I did not have time to further study the real cause of the problem.

+8
source

Adding PSyton to the comment, here's how we solved it. Compile arm/*.c files. However, this only works for Android. For iOS, we also had to create a new pnglibconf.h with entries:

 #undef PNG_ARM_NEON_API_SUPPORTED #undef PNG_ARM_NEON_CHECK_SUPPORTED #define PNG_ARM_NEON_OPT 0 

Looking at ARM defines in libpng, it looks like they are currently a bit buggy, since PNG_ARM_NEON_API_SUPPORTED should be enough to disable NEON compilation.

0
source

Source: https://habr.com/ru/post/954920/


All Articles