`
superonion
  • 浏览: 128279 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

FFmpeg 移植 Android

阅读更多

 

近期项目需要解析苹果的HLS流媒体协议,而FFmpeg从0.11.1“Happiness”版本开始,才增加了对HLS协议的支持。目前网上关于FFmpeg编译移植的文章有很多,但大多都是对旧版本的说明。新版本的源码对很多地方做了改动,包括一些变量名、常量名、函数名、函数参数、结构体等,所以在用旧版本的JNI接口时,需要相应地做出改动。这个编译移植工作确实花了本人不少时间,现在总结一下,希望能给到大家一些帮助。说明一点,本文阐述的不一定都正确,大家在编译过程中,难免会遇到各种各样的错误,可以提出来,一起讨论。

 

编译环境:Ubuntu 12.04、Android NDK r8

 

一、下载源码、新建工程

下载地址:http://ffmpeg.org/download.html ,下载最新ffmpeg-0.11.1压缩包。

在$NDK_HOME/samples/目录下(我的是/root/Develop/android-ndk-r8/samples/)创建一个FFMPEG-0.11目录,在里面新建一个jni目录,然后把ffmpeg源码解压放在jni里面,源码的文件夹重命名为libffmpeg,所以最后源码的路径是:

/root/Develop/android-ndk-r8/samples/FFMPEG-0.11/jni/libffmpeg
  

二、配置源代码

1. 创建config_common.sh脚本

在jni目录下创建一个config_common.sh,内容如下:

 

#!/bin/bash

FFCONFIG_COMMON='
	--enable-version3
	--disable-gpl
	--disable-nonfree
	--disable-debug
	--disable-ffmpeg
	--disable-ffplay
	--disable-ffserver
	--disable-ffprobe
	--disable-encoders
	--disable-muxers
	--disable-devices
	--disable-protocols
	--enable-protocol=file
	--disable-swscale
	--disable-avfilter
	--enable-network
	--disable-avdevice
	--enable-parsers
	--disable-decoders
	--disable-demuxers
	--enable-demuxer=matroska
	--disable-demuxer=rm
	--disable-demuxer=avi
	--disable-demuxer=flv
	--disable-demuxer=mov
	--enable-demuxer=mp3
	--enable-demuxer=mpegps
	--enable-demuxer=mpegvideo
	--enable-demuxer=asf
	--enable-decoder=aac
	--enable-decoder=ac3
	--enable-decoder=dca
	--enable-decoder=flv
	--disable-decoder=h263
	--disable-decoder=h264
	--enable-decoder=svq3
	--enable-decoder=amrnb
	--enable-decoder=nellymoser
	--enable-decoder=pcm_alaw
	--enable-decoder=pcm_dvd
	--enable-decoder=pcm_mulaw
	--enable-decoder=pcm_s16be
	--enable-decoder=pcm_s16le
	--enable-decoder=pcm_s16le_planar
	--enable-decoder=pcm_s24be
	--enable-decoder=pcm_s24daud
	--enable-decoder=pcm_s24le
	--enable-decoder=pcm_s32be
	--enable-decoder=pcm_s32le
	--enable-decoder=pcm_s8
	--enable-decoder=pcm_u16be
	--enable-decoder=pcm_u16le
	--enable-decoder=pcm_u24be
	--enable-decoder=pcm_u24le
	--enable-decoder=pcm_u32be
	--enable-decoder=pcm_u32le
	--enable-decoder=atrac3
	--enable-decoder=pcm_u8
	--enable-decoder=sipr
	--enable-decoder=mjpeg
	--enable-decoder=mp1
	--enable-decoder=mp2
	--enable-decoder=mp3
	--enable-decoder=tscc
	--enable-decoder=mpeg1video
	--enable-decoder=mpeg2video
	--enable-decoder=mpeg4
	--enable-decoder=ra_144
	--enable-decoder=ra_288
	--enable-decoder=cook
	--enable-decoder=rv10
	--enable-decoder=rv20
	--enable-decoder=rv30
	--enable-decoder=rv40
	--enable-decoder=wmav1
	--enable-decoder=wmav2
	--enable-decoder=wmapro
	--disable-decoder=wmv1
	--disable-decoder=wmv2
	--disable-decoder=wmv3
	--enable-decoder=vc1
	--enable-decoder=msmpeg4v1
	--enable-decoder=msmpeg4v2
	--enable-decoder=msmpeg4v3
'
  

可以根据需要自行配置以上参数。

 

2. 创建config.sh脚本

在jni目录下创建一个config.sh,内容如下:

 

#!/bin/bash

source config_common.sh            /*这里执行上面的config_common.sh脚本*/

cd libffmpeg               /*进入libffmpeg目录*/

PREBUILT=/root/Develop/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86
PLATFORM=/root/Develop/android-ndk-r8/platforms/android-14/arch-arm

./configure --target-os=linux \
	--arch=arm \
	--enable-shared \
	--enable-cross-compile \
	--cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
	--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
	--strip=$PREBUILT/bin/arm-linux-androideabi-strip \
	--extra-cflags="-fPIC -DANDROID" \
	--extra-ldflags="-Wl,-T,$PREBUILT/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o -lc -lm -ldl" \
	$FFCONFIG_COMMON


cd ..                       /*返回jni目录*/
ndk-build clean
  

3.  执行config.sh脚本

然后打开终端,执行以下命令:

 

$chmod +x config.sh /*赋予config.sh执行权限*/
$./config.sh
  

如果配置正确的话,显示出来的最后两行是这样的:

 

License:LGPL version 3 or later
Creating config.mak and config.h...

若出现WARNING:/root/Develop/android-ndk-8/.............../arm-linux-androideabi-pkg-config not found, library detection may fail. 可忽略。

 

4. 修改config.h

进入jni/libffmpeg/目录,在刚刚生成的config.h中找到这句:

 

#define restrict restrict

 

因为Android的gcc并不认得restrict这个关键字,所以把它改写成:

 

#define restrict

 

如果需要联网的话,还需要将config.h中的以下定义置为1:

 

#define CONFIG_NETWORK 1
#define CONFIG_HTTP_PROTOCOL 1
#define CONFIG_HTTPPROXY_PROTOCOL 1
#define CONFIG_HTTPS_PROTOCOL 1
#define CONFIG_TCP_PROTOCOL 1
#define CONFIG_UDP_PROTOCOL 1
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
#define HAVE_STRUCT_ADDRINFO 1
#define HAVE_SOCKLEN_T 1

#define HAVE_INET_ATON 0

 

相应的,config.mak中也需要修改为:

 

CONFIG_NETWORK=yes
CONFIG_HTTP_PROTOCOL=yes
CONFIG_HTTPPROXY_PROTOCOL=yes
CONFIG_HTTPS_PROTOCOL=yes 
CONFIG_TCP_PROTOCOL=yes
CONFIG_UDP_PROTOCOL=yes
HAVE_STRUCT_SOCKADDR_STORAGE=yes
HAVE_STRUCT_ADDRINFO=yes
HAVE_SOCKLEN_T=yes

!HAVE_INET_ATON=yes
  

5. 修改libm.h文件

将/libavutil/libm.h中所有的static函数全部注释掉。

 

6. 修改Makefile文件

分別修改libavcodec、libavfilter、libavformat、libavutil、libpostproc和libswscale目录下的Makefile文件,将下面一句注释掉:

 

include $(SUBDIR)../config.mak
  

7. 新建av.mk脚本

在/jni/libffmpeg下建立一个脚本文件av.mk,內容如下:

 

# LOCAL_PATH is one of libavutil, libavcodec, libavformat, or libswscale

#include $(LOCAL_PATH)/../config-$(TARGET_ARCH).mak
include $(LOCAL_PATH)/../config.mak

OBJS :=
OBJS-yes :=
MMX-OBJS-yes :=
include $(LOCAL_PATH)/Makefile
ifdef ADDITION_INC
include $(ADDITION_INC)
endif

# collect objects
OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
OBJS += $(OBJS-yes)

FFNAME := lib$(NAME)
FFLIBS := $(foreach,NAME,$(FFLIBS),lib$(NAME))
FFCFLAGS = -DHAVE_AV_CONFIG_H $(CFLAGS)
FFCFLAGS += -DTARGET_CONFIG=\"config-$(TARGET_ARCH).h\"

ALL_S_FILES := $(wildcard $(LOCAL_PATH)/$(TARGET_ARCH)/*.S)
ALL_S_FILES := $(addprefix $(TARGET_ARCH)/, $(notdir $(ALL_S_FILES)))

ifneq ($(ALL_S_FILES),)
ALL_S_OBJS := $(patsubst %.S,%.o,$(ALL_S_FILES))
C_OBJS := $(filter-out $(ALL_S_OBJS),$(OBJS))
S_OBJS := $(filter $(ALL_S_OBJS),$(OBJS))
else
C_OBJS := $(OBJS)
S_OBJS :=
endif

C_FILES := $(patsubst %.o,%.c,$(C_OBJS))
S_FILES := $(patsubst %.o,%.S,$(S_OBJS))

FFFILES := $(sort $(S_FILES)) $(sort $(C_FILES))
  

8. 新建Android.mk脚本

在jni目录下新建Android.mk,內容如下:

 

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := ExportJNI.cpp ExportPlayer.cpp PacketQueue.cpp /*其中ExportJNI.cpp是我编写的JNI接口*/
LOCAL_STATIC_LIBRARIES := libavformat libavcodec libswscale libavutil libpostproc ffmpeg libsubtitle /*注意Libraries的顺序*/
LOCAL_MODULE := export /*最终生成libexport.so*/ 
LOCAL_ARM_MODE := arm
LOCAL_CFLAGS := -D__STDC_CONSTANT_MACROS -I$(LOCAL_PATH)/libffmpeg/ -I$(LOCAL_PATH)/libsubtitle/
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
include $(call all-makefiles-under,$(LOCAL_PATH))

 

在jni/libffmpeg目录下新建Android.mk:

 

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := settings.c MyLog.cpp       /*如果不需要打印输出等辅助功能,这行可删去*/
LOCAL_MODULE := ffmpeg
LOCAL_ARM_MODE := arm
include $(BUILD_STATIC_LIBRARY)
include $(call all-makefiles-under,$(LOCAL_PATH))

  
在jni/libffmpeg/libavformat目录下新建Android.mk:

 

LOCAL_PATH := $(call my-dir)
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)
LOCAL_ARM_MODE := arm
include $(BUILD_STATIC_LIBRARY)
   

在jni/libffmpeg/libavcodec目录下新建Android.mk:

 

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
ADDITION_INC := $(LOCAL_PATH)/arm/Makefile
include $(LOCAL_PATH)/../av.mk
ADDITION_INC := 

LOCAL_SRC_FILES := $(FFFILES)

LOCAL_C_INCLUDES := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/..
LOCAL_CFLAGS += $(FFCFLAGS)
ifeq ($(TARGET_ARCH_ABI),armeabi)
LOCAL_CFLAGS += -DUSE_INT
endif

LOCAL_LDLIBS := -lz
LOCAL_STATIC_LIBRARIES := $(FFLIBS)
LOCAL_MODULE := $(FFNAME)
LOCAL_ARM_MODE := arm
include $(BUILD_STATIC_LIBRARY)
  

在libavfilter、libavutil、libpostproc和libswscale目录下都分別新建Android.mk:

 

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
include$(LOCAL_PATH)/../av.mk
LOCAL_SRC_FILES:= $(FFFILES)
LOCAL_C_INCLUDES:= \
$(LOCAL_PATH) \
$(LOCAL_PATH)/..
LOCAL_CFLAGS+= $(FFCFLAGS)
LOCAL_STATIC_LIBRARIES:= $(FFLIBS)
LOCAL_MODULE:= $(FFNAME)
include$(BUILD_STATIC_LIBRARY)
  

9. 新建Application.mk脚本

在jni目录下创建一个Application.mk,内容如下:

 

APP_STL := stlport_static
APP_ABI := armeabi

 

三、 NDK编译

在FFMPEG-0.11/下执行ndk-build:

 

$/ FFMPEG-0.11# ndk-build
  

编译过程需要十分钟左右,最后会在FFMPEG-0.11/obj/local/armeabi/目录下生成libavcodec.a、libavformat.a、libavutil.a、libffmpeg.a、libswscale.a和libpostproc.a以及libexport.so,在FFMPEG-0.11/libs/armeabi/目录下生成libexport.so。

 

 

17
18
分享到:
评论
57 楼 whsky 2013-12-06  
swordKing 写道

/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(aacpsdsp.o): in function ff_psdsp_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/aacpsdsp.c:213: error: undefined reference to 'ff_psdsp_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(ac3dsp.o): in function ff_ac3dsp_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/ac3dsp.c:232: error: undefined reference to 'ff_ac3dsp_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(dcadsp.o): in function ff_dcadsp_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/dcadsp.c:50: error: undefined reference to 'ff_dcadsp_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(dsputil.o): in function ff_dsputil_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/dsputil.c:3173: error: undefined reference to 'ff_dsputil_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(fft_fixed.o): in function ff_fft_init_fixed:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/fft.c:167: error: undefined reference to 'ff_fft_fixed_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(fft_float.o): in function ff_fft_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/fft.c:161: error: undefined reference to 'ff_fft_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(fmtconvert.o): in function ff_fmt_convert_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/fmtconvert.c:85: error: undefined reference to 'ff_fmt_convert_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(h264dsp.o): in function ff_h264dsp_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/h264dsp.c:114: error: undefined reference to 'ff_h264dsp_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(h264pred.o): in function ff_h264_pred_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/h264pred.c:535: error: undefined reference to 'ff_h264_pred_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(mpegaudiodsp.o): in function ff_mpadsp_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/mpegaudiodsp.c:43: error: undefined reference to 'ff_mpadsp_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(mpegvideo.o): in function ff_dct_common_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/mpegvideo.c:197: error: undefined reference to 'ff_MPV_common_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(rdft.o): in function ff_rdft_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/rdft.c:125: error: undefined reference to 'ff_rdft_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(sbrdsp.o): in function ff_sbrdsp_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/sbrdsp.c:245: error: undefined reference to 'ff_sbrdsp_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(synth_filter.o): in function ff_synth_filter_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/synth_filter.c:63: error: undefined reference to 'ff_synth_filter_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavutil.a(cpu.o): in function av_get_cpu_flags:/home/sword/FFMPEG/jni/libffmpeg/libavutil/cpu.c:35: error: undefined reference to 'ff_get_cpu_flags_arm'
这个问题有大哥解决过没???????


同样的错,望指点,大谢
56 楼 yuanzeyao 2013-09-09  
n124745678 写道
樓主你好,按你的步驟竟然發現出錯了,以下是錯誤訊息,麻煩您指導一下
/home/android-ndk-r8/build/core/build-binary.mk:41: *** target file `clean' has both : and :: entries.  Stop.

请问你的这个问题后来解决了没呢?我现在也遇到了这个问题!
55 楼 zfms 2013-09-05  
大家好,编译后的.so文件谁能给我一个啊,谢谢,qq:64738479
54 楼 fangext520 2013-08-13  
楼主。。我编译FFMPEG 失败啊。。。球指导。。。QQ350449972谢谢啦!!!!!!!!!!!!!
53 楼 zp136666258 2013-04-25  
问题1:
jni/libffmpeg/libavformat/../config.h:9:0: warning: "av_restrict" redefined [enabled by default]
jni/libffmpeg/libavformat/../libavutil/attributes.h:66:0: note: this is the location of the previous definition
jni/libffmpeg/libavformat/tcp.c: In function 'tcp_open':
jni/libffmpeg/libavformat/tcp.c:141:9: error: implicit declaration of function 'close' [-Werror=implicit-function-declaration]

问题2:
把下载的 ExportJNI.cpp 放到jni目录下出现下面情况:
make: *** No rule to make target `jni/ExportJNI.cpp', needed by `obj/local/armeabi/objs/export/ExportJNI.o'.  Stop.

问题3
jni/Android.mk文件中 写成
LOCAL_SRC_FILES := ExportPlayer.cpp PacketQueue.cpp
出现:
make: *** No rule to make target `jni/ExportPlayer.cpp', needed by `obj/local/armeabi/objs/export/ExportPlayer.o'.  Stop.
请大家帮忙解决,谢谢
52 楼 xiao_hua 2013-04-01  
博主,为什么我在FFMPEG-0.11目录下执行
#ndk-build

这个命令一点输出都没有,瞬间就完成了。
51 楼 gallop_liu 2013-03-31  
请问下楼主有没有遇到这种情况:
libffmpeg/libavutil/float_dsp.c:132: undefined reference to `ff_float_dsp_init_arm'

我编译的时候,感觉libavutil/arm下的类好像都没编译,求帮忙。
50 楼 swordKing 2013-03-12  

/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(aacpsdsp.o): in function ff_psdsp_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/aacpsdsp.c:213: error: undefined reference to 'ff_psdsp_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(ac3dsp.o): in function ff_ac3dsp_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/ac3dsp.c:232: error: undefined reference to 'ff_ac3dsp_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(dcadsp.o): in function ff_dcadsp_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/dcadsp.c:50: error: undefined reference to 'ff_dcadsp_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(dsputil.o): in function ff_dsputil_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/dsputil.c:3173: error: undefined reference to 'ff_dsputil_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(fft_fixed.o): in function ff_fft_init_fixed:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/fft.c:167: error: undefined reference to 'ff_fft_fixed_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(fft_float.o): in function ff_fft_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/fft.c:161: error: undefined reference to 'ff_fft_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(fmtconvert.o): in function ff_fmt_convert_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/fmtconvert.c:85: error: undefined reference to 'ff_fmt_convert_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(h264dsp.o): in function ff_h264dsp_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/h264dsp.c:114: error: undefined reference to 'ff_h264dsp_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(h264pred.o): in function ff_h264_pred_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/h264pred.c:535: error: undefined reference to 'ff_h264_pred_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(mpegaudiodsp.o): in function ff_mpadsp_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/mpegaudiodsp.c:43: error: undefined reference to 'ff_mpadsp_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(mpegvideo.o): in function ff_dct_common_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/mpegvideo.c:197: error: undefined reference to 'ff_MPV_common_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(rdft.o): in function ff_rdft_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/rdft.c:125: error: undefined reference to 'ff_rdft_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(sbrdsp.o): in function ff_sbrdsp_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/sbrdsp.c:245: error: undefined reference to 'ff_sbrdsp_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavcodec.a(synth_filter.o): in function ff_synth_filter_init:/home/sword/FFMPEG/jni/libffmpeg/libavcodec/synth_filter.c:63: error: undefined reference to 'ff_synth_filter_init_arm'
/home/sword/Download/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/sword/FFMPEG/obj/local/armeabi/libavutil.a(cpu.o): in function av_get_cpu_flags:/home/sword/FFMPEG/jni/libffmpeg/libavutil/cpu.c:35: error: undefined reference to 'ff_get_cpu_flags_arm'
这个问题有大哥解决过没???????
49 楼 zfavourite99 2012-12-20  
zfavourite99 写道
undefined reference to `ff_get_cpu_flags_arm'
9774124 写道
BFD: ./libs/armeabi/stxQ2POO: warning: sh_link not set for section `.ARM.exidx'
BFD: ./libs/armeabi/stL7bXOO: warning: sh_link not set for section `.ARM.exidx'
./obj/local/armeabi/libavcodec.a(dsputil_init_arm.o): In function `ff_dsputil_init_arm':
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavcodec/arm/dsputil_init_arm.c:122: undefined reference to `ff_dsputil_init_armv5te'
./obj/local/armeabi/libavcodec.a(mpegvideo_arm.o): In function `ff_MPV_common_init_arm':
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavcodec/arm/mpegvideo_arm.c:47: undefined reference to `ff_MPV_common_init_armv5te'
./obj/local/armeabi/libavutil.a(cpu.o): In function `av_get_cpu_flags':
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavutil/cpu.c:35: undefined reference to `ff_get_cpu_flags_arm'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/libexport.so] Error 1
楼主大神请问下这是什么错觉,调了好久不知道哪里的错误。

楼主你好,我也是这个错误  undefined reference to `ff_get_cpu_flags_arm'
请问怎么解决?
顺便帮这位朋友解决一下前面那些错误:undefined reference to `xxxx_armv5te'的错误你在
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavcodec/arm/目录下 找 Makefile,打开后把里面 
ARMV5-OBJS                                   += arm/dsputil_init_armv5te.o    \
                                          arm/mpegvideo_armv5te.o       \
                                          arm/mpegvideo_armv5te_s.o     \
                                          arm/simple_idct_armv5te.o     \

改成
OBJS                                   += arm/dsputil_init_armv5te.o    \
                                          arm/mpegvideo_armv5te.o       \
                                          arm/mpegvideo_armv5te_s.o     \
                                          arm/simple_idct_armv5te.o     \

就好了

但是undefined reference to `ff_get_cpu_flags_arm'我始终没有解决掉,只能等大神来指导了。。


undefined reference to `ff_get_cpu_flags_arm'这个问题也解决了
将下面这个方法粘贴进 /home/liu/workspace/ffmpeg/jni/libffmpeg/libavutil/目录下得 cpu.c 文件里面就好了,哈哈,成功生成 .so 库了,明天在实验能用不 -。-
int ff_get_cpu_flags_arm(void)
{
    return AV_CPU_FLAG_ARMV5TE * HAVE_ARMV5TE |
           AV_CPU_FLAG_ARMV6   * HAVE_ARMV6   |
           AV_CPU_FLAG_ARMV6T2 * HAVE_ARMV6T2 |
           AV_CPU_FLAG_VFP     * HAVE_ARMVFP  |
           AV_CPU_FLAG_VFPV3   * HAVE_VFPV3   |
           AV_CPU_FLAG_NEON    * HAVE_NEON;
}
48 楼 zfavourite99 2012-12-20  
undefined reference to `ff_get_cpu_flags_arm'
9774124 写道
BFD: ./libs/armeabi/stxQ2POO: warning: sh_link not set for section `.ARM.exidx'
BFD: ./libs/armeabi/stL7bXOO: warning: sh_link not set for section `.ARM.exidx'
./obj/local/armeabi/libavcodec.a(dsputil_init_arm.o): In function `ff_dsputil_init_arm':
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavcodec/arm/dsputil_init_arm.c:122: undefined reference to `ff_dsputil_init_armv5te'
./obj/local/armeabi/libavcodec.a(mpegvideo_arm.o): In function `ff_MPV_common_init_arm':
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavcodec/arm/mpegvideo_arm.c:47: undefined reference to `ff_MPV_common_init_armv5te'
./obj/local/armeabi/libavutil.a(cpu.o): In function `av_get_cpu_flags':
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavutil/cpu.c:35: undefined reference to `ff_get_cpu_flags_arm'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/libexport.so] Error 1
楼主大神请问下这是什么错觉,调了好久不知道哪里的错误。

楼主你好,我也是这个错误  undefined reference to `ff_get_cpu_flags_arm'
请问怎么解决?
顺便帮这位朋友解决一下前面那些错误:undefined reference to `xxxx_armv5te'的错误你在
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavcodec/arm/目录下 找 Makefile,打开后把里面 
ARMV5-OBJS                                   += arm/dsputil_init_armv5te.o    \
                                          arm/mpegvideo_armv5te.o       \
                                          arm/mpegvideo_armv5te_s.o     \
                                          arm/simple_idct_armv5te.o     \

改成
OBJS                                   += arm/dsputil_init_armv5te.o    \
                                          arm/mpegvideo_armv5te.o       \
                                          arm/mpegvideo_armv5te_s.o     \
                                          arm/simple_idct_armv5te.o     \

就好了

但是undefined reference to `ff_get_cpu_flags_arm'我始终没有解决掉,只能等大神来指导了。。
47 楼 zfavourite99 2012-12-19  
mdboy 写道
博主,您好,我在按照您的方法编译的时候,出现以下问题,麻烦您看下是什么问题
SharedLibrary  : libffmpeg-jni.so
/home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavformat.a(matroskadec.o): In function `matroska_decode_buffer':
/home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavformat/matroskadec.c:1071: undefined reference to `inflateInit_'
/home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavformat/matroskadec.c:1086: undefined reference to `inflate'
/home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavformat/matroskadec.c:1079: undefined reference to `inflateEnd'
/home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavformat/matroskadec.c:1091: undefined reference to `inflateEnd'
/home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavformat.a(id3v2.o): In function `ff_id3v2_parse':
/home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavformat/id3v2.c:683: undefined reference to `uncompress'
/home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavcodec.a(svq3.o): In function `svq3_decode_init':
/home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavcodec/svq3.c:915: undefined reference to `uncompress'
/home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavcodec.a(tscc.o): In function `decode_end':
/home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavcodec/tscc.c:201: undefined reference to `inflateEnd'
/home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavcodec.a(tscc.o): In function `decode_frame':
/home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavcodec/tscc.c:92: undefined reference to `inflateReset'
/home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavcodec/tscc.c:101: undefined reference to `inflate'
/home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavcodec.a(tscc.o): In function `decode_init':
/home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavcodec/tscc.c:177: undefined reference to `inflateInit_'
/home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavcodec.a(dsputil_init_arm.o): In function `ff_dsputil_init_arm':
/home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavcodec/arm/dsputil_init_arm.c:122: undefined reference to `ff_dsputil_init_armv5te'
/home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavcodec.a(mpegvideo_arm.o): In function `ff_MPV_common_init_arm':
/home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavcodec/arm/mpegvideo_arm.c:47: undefined reference to `ff_MPV_common_init_armv5te'
/home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavutil.a(cpu.o): In function `av_get_cpu_flags':
/home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavutil/cpu.c:35: undefined reference to `ff_get_cpu_flags_arm'
collect2: ld returned 1 exit status
make: *** [/home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libffmpeg-jni.so] Error 1


博主你好,我也是这个问题,请问怎么解决,谢谢了
46 楼 zfavourite99 2012-12-19  
楼主你好,我自己写了个接口文件,但是编译的时候出错了,报的错全是

libavformat/allformats.c 这个文件中的注册宏的宏定义问题 

/root/Develop/android-ndk-r8/samples/FFMPEG-0.11/jni/libffmpeg/libavformat/allformats.c:284:1: error: 'CONFIG_UDP_PROTOCOL' undeclared (first use in this function)
/root/Develop/android-ndk-r8/samples/FFMPEG-0.11/jni/libffmpeg/libavformat/allformats.c:287:1: error: 'CONFIG_LIBNUT_MUXER' undeclared (first use in this function)
/root/Develop/android-ndk-r8/samples/FFMPEG-0.11/jni/libffmpeg/libavformat/allformats.c:287:1: error: 'CONFIG_LIBNUT_DEMUXER' undeclared (first use in this function)
/root/Develop/android-ndk-r8/samples/FFMPEG-0.11/jni/libffmpeg/libavformat/allformats.c:288:1: error: 'CONFIG_LIBRTMP_PROTOCOL' undeclared (first use in this function)
/root/Develop/android-ndk-r8/samples/FFMPEG-0.11/jni/libffmpeg/libavformat/allformats.c:289:1: error: 'CONFIG_LIBRTMPE_PROTOCOL' undeclared (first use in this function)
/root/Develop/android-ndk-r8/samples/FFMPEG-0.11/jni/libffmpeg/libavformat/allformats.c:290:1: error: 'CONFIG_LIBRTMPS_PROTOCOL' undeclared (first use in this function)
/root/Develop/android-ndk-r8/samples/FFMPEG-0.11/jni/libffmpeg/libavformat/allformats.c:291:1: error: 'CONFIG_LIBRTMPT_PROTOCOL' undeclared (first use in this function)
/root/Develop/android-ndk-r8/samples/FFMPEG-0.11/jni/libffmpeg/libavformat/allformats.c:292:1: error: 'CONFIG_LIBRTMPTE_PROTOCOL' undeclared (first use in this function)

好多好多,控制台都放不下。。。
请问这个怎么解决呢? 新手对这个不懂,求指导
45 楼 superonion 2012-12-18  
zfavourite99 写道
楼主你好,我在写接口文件的时候 引用了 jni.h ,然后就报

jni.h:592:13: note: the mangling of 'va_list' has changed in GCC 4.4

这个错误,请问楼主有没有遇到这个错误

网上说 在Android.mk中加 LOCAL_CFLAGS = -Wno-psabi ,我加了,但是还是一样抱着个错误,该怎么解决?

这个错误没有遇到过。
44 楼 superonion 2012-12-18  
guofeng007 写道
写的很详细,博主能不能把ExportJNI.cpp 也共享下呢,想在Android 上转码,提高音量,唉,搞了好久

zfavourite99 写道
其中ExportJNI.cpp是我编写的JNI接口,这个能是怎么写的呢?能共享下么?没这个会编译失败还是?

ExportJNI.cpp已上传,供参考。
43 楼 zfavourite99 2012-12-18  
楼主你好,我在写接口文件的时候 引用了 jni.h ,然后就报

jni.h:592:13: note: the mangling of 'va_list' has changed in GCC 4.4

这个错误,请问楼主有没有遇到这个错误

网上说 在Android.mk中加 LOCAL_CFLAGS = -Wno-psabi ,我加了,但是还是一样抱着个错误,该怎么解决?
42 楼 guofeng007 2012-12-17  
写的很详细,博主能不能把ExportJNI.cpp 也共享下呢,想在Android 上转码,提高音量,唉,搞了好久
41 楼 zfavourite99 2012-12-12  
abettor 写道
superonion 写道
n124745678 写道
樓主你好,按你的步驟竟然發現出錯了,以下是錯誤訊息,麻煩您指導一下
/home/android-ndk-r8/build/core/build-binary.mk:41: *** target file `clean' has both : and :: entries.  Stop.

这个问题我没有发现过哦,你再仔细检查一遍参数。。


lz,我也遇到了完全相同的问题,除了我是android-ndk-r8c之外。我是Linux下编译的。

楼主你好,你在
abettor 写道
superonion 写道
n124745678 写道
樓主你好,按你的步驟竟然發現出錯了,以下是錯誤訊息,麻煩您指導一下
/home/android-ndk-r8/build/core/build-binary.mk:41: *** target file `clean' has both : and :: entries.  Stop.

这个问题我没有发现过哦,你再仔细检查一遍参数。。


lz,我也遇到了完全相同的问题,除了我是android-ndk-r8c之外。我是Linux下编译的。

楼主你好,之前那个问题已经解决了,是在 config.sh 里面的 每一行的最后有空格导致的。。
现在的问题是 你在第二大步的第八小步中提到:
8. 新建Android.mk脚本

在jni目录下新建Android.mk,內容如下:


LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := ExportJNI.cpp ExportPlayer.cpp PacketQueue.cpp /*其中ExportJNI.cpp是我编写的JNI接口*/
LOCAL_STATIC_LIBRARIES := libavformat libavcodec libswscale libavutil libpostproc ffmpeg libsubtitle /*注意Libraries的顺序*/
LOCAL_MODULE := export /*最终生成libexport.so*/
LOCAL_ARM_MODE := arm
LOCAL_CFLAGS := -D__STDC_CONSTANT_MACROS -I$(LOCAL_PATH)/libffmpeg/ -I$(LOCAL_PATH)/libsubtitle/
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
include $(call all-makefiles-under,$(LOCAL_PATH))


其中ExportJNI.cpp是我编写的JNI接口,这个能是怎么写的呢?能共享下么?没这个会编译失败还是?
40 楼 superonion 2012-12-12  
zfavourite99 写道
你好,执行到第三步  执行config.sh脚本  的时候报错

root@zbf:~/Develop/android-ndk-r8/samples/FFMPEG-0.11/jni# ./config.sh
Unknown option "".
See ./configure --help for available options.
./config.sh: line 11: --arch=arm: command not found
./config.sh: line 12: --enable-shared: command not found
./config.sh: line 13: --enable-cross-compile: command not found
./config.sh: line 14: --cc=/root/Develop/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: No such file or directory
./config.sh: line 15: --cross-prefix=/root/Develop/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-: No such file or directory
./config.sh: line 16: --strip=/root/Develop/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-strip: No such file or directory
./config.sh: line 17: --extra-cflags=-fPIC -DANDROID: command not found
./config.sh: line 18: --extra-ldflags=-Wl,-T,/root/Develop/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=/root/Develop/android-ndk-r8/platforms/android-14/arch-arm/usr/lib -L/root/Develop/android-ndk-r8/platforms/android-14/arch-arm/usr/lib -nostdlib /root/Develop/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o /root/Develop/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o -lc -lm -ldl: No such file or directory
./config.sh: line 19: --enable-version3: command not found
Android NDK: Could not find application project directory !   
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.   
/root/Develop/android-ndk-r8/build/core/build-local.mk:130: *** Android NDK: Aborting    .  Stop.

这是错误信息,麻烦看下这是怎么回事,好像很多命令都不认识
NDK 目录已经加入到环境变量中了


参照22楼。
39 楼 zfavourite99 2012-12-12  
你好,执行到第三步  执行config.sh脚本  的时候报错

root@zbf:~/Develop/android-ndk-r8/samples/FFMPEG-0.11/jni# ./config.sh
Unknown option "".
See ./configure --help for available options.
./config.sh: line 11: --arch=arm: command not found
./config.sh: line 12: --enable-shared: command not found
./config.sh: line 13: --enable-cross-compile: command not found
./config.sh: line 14: --cc=/root/Develop/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: No such file or directory
./config.sh: line 15: --cross-prefix=/root/Develop/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-: No such file or directory
./config.sh: line 16: --strip=/root/Develop/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-strip: No such file or directory
./config.sh: line 17: --extra-cflags=-fPIC -DANDROID: command not found
./config.sh: line 18: --extra-ldflags=-Wl,-T,/root/Develop/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=/root/Develop/android-ndk-r8/platforms/android-14/arch-arm/usr/lib -L/root/Develop/android-ndk-r8/platforms/android-14/arch-arm/usr/lib -nostdlib /root/Develop/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o /root/Develop/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o -lc -lm -ldl: No such file or directory
./config.sh: line 19: --enable-version3: command not found
Android NDK: Could not find application project directory !   
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.   
/root/Develop/android-ndk-r8/build/core/build-local.mk:130: *** Android NDK: Aborting    .  Stop.

这是错误信息,麻烦看下这是怎么回事,好像很多命令都不认识
NDK 目录已经加入到环境变量中了
38 楼 abettor 2012-11-30  
superonion 写道
n124745678 写道
樓主你好,按你的步驟竟然發現出錯了,以下是錯誤訊息,麻煩您指導一下
/home/android-ndk-r8/build/core/build-binary.mk:41: *** target file `clean' has both : and :: entries.  Stop.

这个问题我没有发现过哦,你再仔细检查一遍参数。。


lz,我也遇到了完全相同的问题,除了我是android-ndk-r8c之外。我是Linux下编译的。

相关推荐

    ffmpeg移植android需要的android.mk

    FFmpeg是一款强大的开源多媒体处理工具,它包含了音视频编解码库...通过以上步骤,我们可以成功地将FFmpeg移植到Android平台,并在Android应用中使用FFmpeg的强大功能,进行音视频的编码、解码、播放、录制等多种操作。

    FFMPEG 移植到android

    将 FFmpeg 移植到 Android 平台,可以让 Android 应用程序具备处理多媒体文件的强大能力,比如播放视频、音频,进行格式转换等。在 Android 上移植 FFmpeg 需要对 C/C++ 语言、Android NDK(Native Development Kit...

    xmt-FFMpeg.rar_ffmpeg_ffmpeg android _ffmpeg移植_surface

    本压缩包“xmt-FFMpeg.rar”显然是针对FFmpeg在Android上的移植进行了优化,目标是使其不依赖于底层的Surface和AudioTrack。 1. **FFmpeg基础知识**: FFmpeg包含了一系列的库,如libavcodec(编码/解码库)、...

    FFmpeg的Android平台移植源码

    Android NDK(Native Development Kit)允许开发者在Android应用中使用原生C/C++代码,为FFmpeg移植提供了基础。 2. **交叉编译**: 由于Android系统与Linux有所不同,需要通过交叉编译来生成适用于Android架构的...

    ffmpeg移植到android项目

    本文将详细介绍如何将FFmpeg移植到Android项目,并使用NDK进行编译,生成可在Android平台JNI层调用的SO库。 首先,我们需要从FFmpeg官方网站下载源代码。通常,选择最新稳定版或根据项目需求选择特定版本。下载完成...

    FFmpeg移植到android平台使用的.so包

    将FFmpeg移植到Android,需要进行一系列的编译和配置工作,以便使其能够与Android系统兼容并集成到Java或Kotlin应用中。以下将详细解释这个过程的关键步骤和知识点。 1. **NDK和Android Studio集成** - Android ...

    利用NDK将ffmpeg移植到android

    利用NDK,将FFMPEG移植到android平台 这个是一个完整的android工程,里面有编译好的ffmpeg库 环境: ubuntu 14.04 ffmpeg 2。5 android 4.1.2 android-ndk-r10d

    Android FFmpeg 6.1+FFmpeg 4.0.2

    2. **Android上的FFmpeg**:在Android平台上使用FFmpeg需要进行一些额外的配置工作,包括编译FFmpeg库以适应Android的NDK环境,创建适用于Android的静态或动态库。动态库(.so文件)通常体积较小,但需要在运行时...

    ffmpeg移植到android的基础工程

    在将 FFmpeg 移植到 Android 平台时,我们需要进行一系列的步骤以确保其能在 Android 设备上正常工作。 首先,我们需要了解 FFmpeg 的基本结构。libavcodec 提供了各种音频和视频编码器和解码器,能够处理常见的...

    android ffmpeg rtsp播放

    在Android平台上实现FFmpeg RTSP播放涉及多个技术层面,包括FFmpeg库的移植、Android多媒体框架的理解以及网络流媒体协议的处理。以下是对这个主题的详细解析: **FFmpeg库移植** FFmpeg是一个开源的多媒体处理框架...

    FFmpeg For Android (三) 移植main函数到安卓上执行ffmpeg命令

    FFmpeg For Android (三) 移植main函数到安卓上执行ffmpeg命令 完整源码 执行在安卓上执行ffmpeg命令, 示范了音频剪切和视频格式转换 有了它 你可以做很多有趣的app

    ffmpeg的编译以及ffmpeg命令行工具在android上的移植

    ffmpeg的编译过程详解,ffmpeg命令行工具在android 上的移植,通过ndk-build或者cmake方式在android studio2.2,ndk14(官网下载android studio2.2,然后通过studio上sdk下载ndk-bundle)构建工程项目。使用的ffmpeg...

    ubuntu 下 编译 ffmpeg for Android armv7-a armv8-a

    FFmpeg是用C语言编写的,具有高度可移植性,因此可以在多种操作系统和架构上运行。 3. **Android**: Android是一种基于Linux内核的操作系统,主要用于移动设备,如智能手机和平板电脑。Android有多种处理器架构,...

    Android ffmpeg算法移植所需库文件armeabi

    "Android ffmpeg算法移植所需库文件armeabi"是指将FFmpeg库适配到Android平台的armeabi架构的过程。 首先,armeabi是Android支持的一种处理器架构,它适用于大多数早期的ARM处理器,如ARMv5TE及更高版本。由于...

    基于Android平台的ffmpeg的移植和应用

    因此,本文旨在介绍如何将成熟的开源多媒体框架ffmpeg移植到Android平台,以此来扩展Android平台的编解码能力,并利用ffserver作为流媒体服务器,实现摄像头拍摄视频的远程观看功能。本文将重点探讨ffmpeg的移植、...

    android 移植ffmpeg源码 实现rtsp流实时播放及保存成MP4文件可以回放

    在Android上移植FFmpeg源码,主要目的是利用其强大的视频音频处理能力,包括解码RTSP流中的H264视频和AAC音频,以及对视频进行封装。 2. **RTSP(Real-Time Streaming Protocol)**: RTSP是一种应用层协议,用于...

    ffmpeg android库文件编译脚本

    build_android.sh ffmpeg编译android库的脚本,ffmpeg2.6、1.1.2编译正常

    Android 移植ffmpeg解码h264文件并播放渲染

    1.移植ffmpeg到android 2.通过JNI接口调用ffmpeg实现h264的解码以及渲染 3.h264渲染采用opengles技术 代码保护局ffmpeg源码 JNI部分 以及opengles渲染部分,还有上层demo APP程序,该程序可以直接安装,播放h264...

Global site tag (gtag.js) - Google Analytics