我参考了其他编译教程
configure
修改内容:
SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
LIB_INSTALL_EXTRA_CMD='$$(RANLIB)"$(LIBDIR)/$(LIBNAME)"'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR)$(SLIBNAME)'
替换:
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
LIB_INSTALL_EXTRA_CMD='$$(RANLIB)"$(LIBDIR)/$(LIBNAME)"'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
SLIB_INSTALL_LINKS='$(SLIBNAME)'
构建结果:
libavdevice-55.so ...
build_android.sh
NDK=/home/dennis/android-ndk-r9d
SYSROOT=$NDK/platforms/android-9/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64
enter code here
function build_one
{
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-static \
--disable-doc \
--disable-ffserver \
--enable-cross-compile \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--target-os=linux \
--arch=arm \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
$ADDITIONAL_CONFIGURE_FLAG
}
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"
build_one
我想删除版本号
结果:
libavdevice.so ...
答案 0 :(得分:2)
无需更改config.mak
只需更改
--target-os=linux
带
--target-os=android
我的例子:
NDK=${HOME}/android-sdk-linux/ndk-bundle
ABI=arm
./configure \
--arch=$ABI \
--target-os=android \
--disable-everything \
--disable-symver \
--enable-runtime-cpudetect \
--enable-pic \
--enable-shared \
--disable-static \
--prefix=../build/$ABI \
--cross-prefix=$NDK/toolchains/$ABI-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/$ABI-linux-androideabi- \
--sysroot=$NDK/platforms/android-26/arch-$ABI \
--extra-cflags="-march=armv7-a -mfloat-abi=softfp -fPIC -DANDROID" \
--extra-ldflags="" \
|| exit 1
make clean
make -j4 || exit 1
make install || exit 1
答案 1 :(得分:0)
./configure
中的:
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
<{1>}中的:更改行
./library.mak
与
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)