在Linux下为Android构建openh264

我正在尝试构建openh264以在android上使用


-我有来自git的最新openh264源码


-我已经ndk 17


-我正在使用Ubuntu 16.04


跑步


make OS=android NDKROOT=/home/r/aff/ndk TARGET=android-27 NDKLEVEL=27 sysroot=/home/r/aff/ndk/sysroot

我得到了错误:


r@r:~/aff/openh264$ make OS=android NDKROOT=/home/r/aff/ndk TARGET=android-27 NDKLEVEL=27 sysroot=/home/r/aff/ndk/sysroot/home/r/aff/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -O3 -DNDEBUG -DHAVE_NEON -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -DANDROID_NDK -fpic --sysroot=/home/r/aff/ndk/platforms/android-27/arch-arm -MMD -MP -DGENERATED_VERSION_HEADER -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc -I/home/r/aff/ndk/sysroot -Dandroid_getCpuIdArm=wels_getCpuIdArm -Dandroid_setCpuArm=wels_setCpuArm -Dandroid_getCpuCount=wels_getCpuCount -Dandroid_getCpuFamily=wels_getCpuFamily -Dandroid_getCpuFeatures=wels_getCpuFeatures -Dandroid_setCpu=wels_setCpu  -I/home/r/aff/ndk/sources/android/cpufeatures -c -o codec/common/src/cpu-features.o /home/r/aff/ndk/sources/android/cpufeatures/cpu-features.c

In file included from /home/r/aff/ndk/sources/android/cpufeatures/cpu-features.c:64:0:

/home/r/aff/ndk/sources/android/cpufeatures/cpu-features.h:31:23: fatal error: sys/cdefs.h: No such file or directory

 #include <sys/cdefs.h>

                       ^

compilation terminated.

build/platform-android.mk:96: recipe for target 'codec/common/src/cpu-features.o' failed

make: *** [codec/common/src/cpu-features.o] Error 1


aluckdog
浏览 385回答 2
2回答

宝慕林4294392

如有疑问,请停止滚动自己的构建配置并使用独立的工具链(请特别注意底部的“使用独立的工具链构建开源项目”部分:https&nbsp;:&nbsp;//developer.android.com/ndk/guides/ standalone_toolchain

哈士奇WWW

从改变TARGET = android-27 NDKLEVEL = 27至TARGET = android-21 NDKLEVEL = 21为我解决了这个问题。
打开App,查看更多内容
随时随地看视频慕课网APP