为OpenH264 Android构建.so文件

4

我将尝试在OpenH264中为不同的CPU架构构建.so文件。

OpenH264的README.md建议:

add "ARCH=mips" or "ARCH=x86". To build for the older armeabi ABI (which has
armv5te as baseline), add "APP_ABI=armeabi" (ARCH=arm is implicit).

我执行了以下命令:

针对x86架构:

make os=android NDKROOT=/home/neosoft/android-ndk-r10d/ ARCH=x86 TARGET=android-12

我得到的类似于

这样的东西


/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find -lpthread
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
/usr/bin/ld: cannot find -lm
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find -lc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [libopenh264.so] Error 1

当我尝试使用armeabi编译时

make os=android NDKROOT=/home/neosoft/android-ndk-r10d/ ARCH=armeabi TARGET=android-12

我理解了

cc -O3 -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -DLINUX -MMD -MP  -Icodec/common/arm/ -march=armv7-a -mfpu=neon -Icodec/api/svc -Icodec/common/inc   -c -o codec/common/arm/copy_mb_neon.o codec/common/arm/copy_mb_neon.S
cc: error: unrecognized command line option ‘-mfpu=neon’
make: *** [codec/common/arm/copy_mb_neon.o] Error 1

有人能告诉我如何为不同的CPU架构编译此库吗?

1个回答

2

对于Linux系统:
a. 首先运行以下命令:

export PATH=ANDROID_SDK_PATH/tools:$PATH
b. 现在以 x86 架构运行此命令。
 make install os=android NDKROOT=/home/neosoft/android-ndk-r10d TARGET=android-14 ARCH=x86 

对于其他的 Arch,只需通过替换 ARCH 类型来运行此命令。

make os=android NDKROOT=/home/neosoft/android-ndk-r10d TARGET=android-14 ARCH=armeabi 

对于Windows系统:
a. 安装MinGW (https://www.youtube.com/watch?v=DHekr3EtDOA)。
b. 在MinGW/bin文件夹中安装MYSY。
c. 在MinGW/bin/1.0/bin文件夹中安装nasm。
d. 进入MinGW\bin\1.0\位置并运行msys.bat。
e. 通过替换ARCH类型运行下面的命令。

make install os=android NDKROOT=/home/neosoft/android-ndk-r10d TARGET=android-14 ARCH=x86 

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接