遇到的几个问题:
1、android-ndk-r8d/build/core/build-binary.mk:41:***target file `clean' has both : and :: entries. Stop
解决办法:因为在libavfilter目录中的Makefile的末尾处多了Clean这个玩意儿将其注释掉或者删掉就可以了
2、parseutils.c文件多处报错
jni/ffmpeg/libavutil/parseutils.c:555:15: error: storage size of 'dt' isn't known
jni/ffmpeg/libavutil/parseutils.c:650:20: error: variable 'dt2' has initializer but incomplete type
jni/ffmpeg/libavutil/parseutils.c:650:38: error: invalid type argument of unary '*' (have 'int')
jni/ffmpeg/libavutil/parseutils.c:650:54: error: invalid type argument of unary '*' (have 'int')
jni/ffmpeg/libavutil/parseutils.c:650:23: error: storage size of 'dt2' isn't known
解决办法:打开 libavutil/parseutils.h,把 #include <time.h> 替换为 #include <sys/../time.h>
android-ndk-r8d/build/core/build-binary.mk:41: *** target file
`clean' has both : and :: entries. Stop.
#define restrict
jni/ffmpeg/libavcodec/../libavutil/float_dsp.h:150:50: error: expected ';', ',' or ')' before 'v1'
jni/ffmpeg/libavcodec/aacdec.c: In function 'apply_mid_side_stereo':
jni/ffmpeg/libavcodec/aacdec.c:1746:29: error: 'AVFloatDSPContext' has no member named 'butterflies_float'
make: *** [obj/local/armeabi/objs/avcodec/aacdec.o] Error 1
#define avrestrict restrict为#define restrict
这个应该改为 #define av_restrict
/home/usr/android-ndk-r9/platforms/android-18/arch-arm/usr/include/stdlib.h:54:14: error: expected ')' before numeric constant
jni/ffmpeg/libavutil/parseutils.c:541:15: error: storage size of 'dt' isn't known
jni/ffmpeg/libavutil/parseutils.c:634:20: error: variable 'dt2' has initializer but incomplete type
jni/ffmpeg/libavutil/parseutils.c:634:38: error: invalid type argument of unary '*' (have 'int')
jni/ffmpeg/libavutil/parseutils.c:634:54: error: invalid type argument of unary '*' (have 'int')
jni/ffmpeg/libavutil/parseutils.c:634:23: error: storage size of 'dt2' isn't known
include $(CLEAR_VARS)
include $(LOCAL_PATH)/../av.mk
LOCAL_SRC_FILES := $(FFFILES)
LOCAL_C_INCLUDES := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/..
LOCAL_CFLAGS += $(FFCFLAGS)
LOCAL_LDLIBS := -lz
LOCAL_STATIC_LIBRARIES := $(FFLIBS)
LOCAL_MODULE := $(FFNAME)
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
include $(LOCAL_PATH)/../av.mk
LOCAL_SRC_FILES := $(FFFILES)
LOCAL_C_INCLUDES := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/..
LOCAL_CFLAGS += $(FFCFLAGS)
LOCAL_CFLAGS += -include "string.h" -Dipv6mr_interface=ipv6mr_ifindex
#LOCAL_LDLIBS := -lz
#LOCAL_STATIC_LIBRARIES := $(FFLIBS)
LOCAL_MODULE := $(FFNAME)
include $(BUILD_STATIC_LIBRARY)
libavformat/libavformat.a(log2_tab.o):(.rodata+0x0): multiple definition of `ff_log2_tab'
libavcodec/libavcodec.a(log2_tab.o):(.rodata+0x0): first defined here
libavutil/libavutil.a(log2_tab.o):(.rodata+0x0): multiple definition of `ff_log2_tab'
libavcodec/libavcodec.a(log2_tab.o):(.rodata+0x0): first defined here
移植ffmpeg的时候如果遇到这样的情况,在两个文件的Makefile中删掉一个log2_tab.o文件就可以了
lls1.o \
lls2.o \
log.o \
# log2_tab.o \
mathematics.o \
md5.o \
OBJS-$(CONFIG_SHARED) += log2_tab.o
OBJS-$(CONFIG_SINEWIN) += sinewin.o
3、
/home/usr/android-ndk-r9c/platforms/android-19/arch-arm/usr/include/stdlib.h:54:14: error: expected identifier or '(' before 'void'
/home/usr/android-ndk-r9c/platforms/android-19/arch-arm/usr/include/stdlib.h:54:14: error: expected ')' before numeric constant
搜到一种解决方案 :
添加了I,应该是stdlib的头文件没有找对导致的
经实验,未成功
解决方案二:
自做主张把stdlib.h 中的 extern char *getenv(const char *);改成extern char *_getenv(const char *);
变量名加个下划线,编译完再改回来。
总觉得不正统啊,会引起问题啊,不知道编译出来的库会不会哪里哪里的就冒出问题稀奇古怪的问题来。
但是问题解决了,编译通过了。。。
4、修改jni/ffmpeg/config.h下的
教程里说 #define restrict restrict 改为 #define restrict
restrict
5、libm.h的static方法记得注释或者删除掉,不然会报错