我一直在这方面,几天来。我正在尝试使用libmp3lame构建FFmpeg以用于Android应用程序。构建脚本设置一个--sysroot
标志,指向以Android可以使用它们的方式构建这些库所需的Android NDK目录。
当我将标志添加到--enable-libmp3lame
时出现问题;我在构建启动期间得到ERROR: libmp3lame >= 3.98.3 not found
。我知道LAME和它的库已经安装,因为我可以手动运行./configure --enable-libmp3lame
并且配置启动顺利,并显示为此构建启用了libmp3lame。但是,这样的构建根本无法满足我的需求,因为我需要Android NDK来完成一些工作。
我已经将问题跟踪到这个构建脚本声明sysroot的事实,并且通过一些研究,我尝试将-Luser/include
,-L/user/include
添加到额外的cflags和ldflags (我读过的是gcc的默认搜索位置)。我也尝试了其他几个方面,但我相信有人可以帮助解决这个具体问题。整个构建脚本如下:
额外信息:
build.sh
#!/bin/bash
if [ "$NDK" = "" ]; then
echo NDK variable not set, assuming ${HOME}/android-ndk
export NDK=${HOME}/android-ndk
fi
SYSROOT=$NDK/platforms/android-3/arch-arm
# Expand the prebuilt/* path into the correct one
TOOLCHAIN=`echo $NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/*-x86`
export PATH=$TOOLCHAIN/bin:$PATH
rm -rf build/ffmpeg
mkdir -p build/ffmpeg
cd ffmpeg
# Don't build any neon version for now
for version in armv5te armv7a; do
DEST=../build/ffmpeg
FLAGS="--target-os=linux --cross-prefix=arm-linux-androideabi- --arch=arm"
FLAGS="$FLAGS --sysroot=$SYSROOT"
FLAGS="$FLAGS --soname-prefix=/data/data/net.smartnotes/lib/"
FLAGS="$FLAGS --enable-shared --disable-symver"
FLAGS="$FLAGS --enable-small --optimization-flags=-O2"
FLAGS="$FLAGS --disable-everything --enable-protocol=file"
FLAGS="$FLAGS --enable-libmp3lame --enable-encoder=nellymoser"
case "$version" in
neon)
EXTRA_CFLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=neon"
EXTRA_LDFLAGS="-Wl,--fix-cortex-a8"
# Runtime choosing neon vs non-neon requires
# renamed files
ABI="armeabi-v7a"
;;
armv7a)
# I have tried many things here.
EXTRA_CFLAGS="-march=armv7-a -mfloat-abi=softfp"
EXTRA_LDFLAGS=""
ABI="armeabi-v7a"
;;
*)
# I have tried many things here.
EXTRA_CFLAGS="-Luser/include"
EXTRA_LDFLAGS=""
ABI="armeabi"
;;
esac
DEST="$DEST/$ABI"
FLAGS="$FLAGS --prefix=$DEST"
mkdir -p $DEST
echo $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" > $DEST/info.txt
./configure $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" | tee $DEST/configuration.txt
[ $PIPESTATUS == 0 ] || exit 1
make clean
make -j4 || exit 1
make install || exit 1
done
答案 0 :(得分:1)
为什么不尝试将由'make install'创建的所有libmp3lame文件复制到脚本将查找它们的相关目录,而不是更改包含路径。插入ECHO语句以找出PATH / CFLAGS / LDFLAGS在出现错误时的确切位置,并将文件复制到那里以便找到它们。
答案 1 :(得分:1)
我看到你正在使用位于的项目 http://bambuser.com/opensource
我遇到了同样的问题并且这样解决了:
这是来自“bambuser.com”的原始diff
与我使用的build.sh
之间的小3c3,6
< export NDK=${HOME}/downloads/android-ndk # r8d
---
> if [ "$NDK" = "" ]; then
> echo NDK variable not set, assuming ${HOME}/android-ndk
> export NDK=${HOME}/android-ndk
> fi
15,16c18
< #for version in armv5te armv7a; do
< for version in armv7a; do
---
> for version in armv5te armv7a; do
24c26
< FLAGS="$FLAGS --disable-everything --enable-libmp3lame"
---
> FLAGS="$FLAGS --disable-everything"
:
liblame/jni/lame
将文件夹PATH_TO_NDK/platforms/android-3/arch-arm/usr/include
复制到liblame/libs/armeabi-v7a/liblame.so
PATH_TO_NDK/platforms/android-3/arch-arm/usr/libs
到libmp3lame.so
, RENAME 在build.sh
。install prefix ../build/ffmpeg/armeabi-v7a
source path /home/samuele/downloads/ffmpeg/ffmpeg-android/ffmpeg
C compiler arm-linux-androideabi-gcc
ARCH arm (generic)
big-endian no
runtime cpu detection no
ARMv5TE enabled yes
ARMv6 enabled yes
ARMv6T2 enabled yes
ARM VFP enabled yes
IWMMXT enabled no
NEON enabled no
debug symbols yes
strip symbols yes
optimizations small
static yes
shared yes
postprocessing support no
new filter support yes
network support yes
threading support pthreads
SDL support no
Sun medialib support no
AVISynth enabled no
frei0r enabled no
libdc1394 support no
libdirac enabled no
libfaac enabled no
libgsm enabled no
**libmp3lame enabled yes**
libnut enabled no
libopencore-amrnb support no
libopencore-amrwb support no
libopencv support no
libopenjpeg enabled no
librtmp enabled no
libschroedinger enabled no
libspeex enabled no
libtheora enabled no
libvorbis enabled no
libvpx enabled no
libx264 enabled no
libxavs enabled no
libxvid enabled no
zlib enabled no
bzlib enabled no
Enabled decoders:
Enabled encoders:
mpeg2video nellymoser
Enabled hwaccels:
Enabled parsers:
Enabled demuxers:
Enabled muxers:
Enabled protocols:
Enabled filters:
buffer
Enabled bsfs:
Enabled indevs:
Enabled outdevs:
License: LGPL version 2.1 or later
Creating config.mak and config.h...
libavutil/avconfig.h is unchanged
。你应该没事:
--disable-everything
请注意,我仍然需要测试生成的FFmpeg构建。 说实话,现在我必须学习如何在我的App中使用它...;)
编辑:我尝试删除build
并使用大量编码器,解码器等构建OK,但{{1}}目录增加到~40MB。