编译arm64错误记录

时间:2023-03-09 01:49:22
编译arm64错误记录

响应2月底appstore 64位APP的上线要求,开始编译IOS arm64版本引擎库。
编译arm64遇到一些问题,在此记录。

1. 数据类型的错误 __int64 相关,提示error: expected  ';' after top level declarator
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
改为
typedef long long int64_t;
typedef unsigned long long uint64_t;
其中:
__int64为微软MSVC定义的数据类型,long long为C99定义的数据类型。
相关说明可参看blog http://blog.csdn.net/shiwei408/article/details/7463476

2. 隐式声明函数报错
error: implicit declaration of function 'SynthesisPolyphaseFiltering' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
其中
void SynthesisPolyphaseFiltering() 定义在另外一个.c文件中,并没有在相应的.h头文件声明。
经网友们帮忙,应该是gcc默认带参数-Werror=implicit-function-declaration,将警告
implicit-function-declaration做为error处理。
解决方法:
a. 如果函数定义在头文件中,将头文件引入 #include "XXX.h"
b. 如果是直接定义在.c文件中的隐式声明,
在引用的.c文件中添加 extern void SynthesisPolyphaseFiltering();
或者 通过编译选项,禁用这个警告
-Wno-error -Wno-implicit-function-declaration

编译arm64错误记录

编译arm64错误记录

3. has no symbols 提示
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: for architecture: armv7 file: libaacdec_armv7.a(ad_lt_predict_armv7.o) has no symbols

$ nm ad_lt_predict_armv7.o 提示 no name list

看一下源文件ad_lt_predict.c 发现整个.c文件 定义在 #ifdef LTP_DEC 下
而我的编译选项没有使用LTP_DEC。这样看来当然不会编译进来了,在编译选项中去掉这个c文件。

编译arm64错误记录

编译arm64错误记录