[英]Iphone - device - linker error
I have added libpng to my application. 我已将libpng添加到我的应用程序中。 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). 我已经从源手动构建了libpng,对于模拟器和设备也是如此(只有更改了编译目标)。 I have tried to find this problem, but noone seems to post anything about this problem. 我试图找到这个问题,但似乎没有人发布有关此问题的任何内容。
I "solved" this by replacing lines 117-121 in libpng
's pngpriv.h
: 我通过替换libpng
的pngpriv.h
中的第117-121行来“解决”这个问题:
# 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. 这会禁用ARM的NEON优化,这似乎是导致问题的原因。
This is merely a workaround though, I didn't have time to investigate the real cause of the problem further. 这仅仅是一种解决方法,我没有时间进一步研究问题的真正原因。
Adding to PSyton's comment, here is how we solved it. 添加到PSyton的评论,这是我们解决它的方式。 Compile the arm/*.c
files. 编译arm/*.c
文件。 This however does only work for Android. 但这只适用于Android。 For iOS, we additionally had to create a new pnglibconf.h
with the entries: 对于iOS,我们还必须使用以下条目创建一个新的pnglibconf.h
:
#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. 看看在libpng中定义的ARM,看起来它们当前有点错误,因为PNG_ARM_NEON_API_SUPPORTED
应该足以关闭NEON编译。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.