Using the Ninja -c out/release command to compile the SDK of Android webrtc, an error is reported and the Android NDK cannot be found for processing

Tsingsee green rhino video 2022-06-24 06:24:20 阅读数:373


We have also introduced a lot about webrtc Compilation of , because gn Than GYP Much faster , So now we compile WebRTC It's using gn To generate build scripts , Use ninja To build .

gn Generate ninja command

Use gn Generate ninja Common commands for building files are as follows :

// Generate debug Version of the build file , The default configuration

gn gen out/Debug

// Generate release Version of the build file

gn gen out/Release --args="is_debug=false"

ninja Script

stay skia\gyp Below gyp Scripts are templates , perform sync-and-gyp The actual build script will be generated dynamically according to these templates . Many modules depend on 、 Conditions can be found in this directory gyp or gypi Find .

Use ninja -C out/Release Command compilation error

Use ninja -C out/Release Instructions needed to compile Android webrtc sdk when , The following error occurred :

ninja: Entering directory `android/Release’

ninja: error: ‘…/…/third_party/android_ndk/sources/android/cpufeatures/cpu-features.c’, needed by ‘obj/third_party/android_sdk/cpu_features/cpu-features.o’, missing and no known rule to make it

From this error, we can know that there is a problem with the file dependency , The required file could not be found . Sometimes this happens because the directory where the project is located changes , No dependencies found , about webrtc for , All the plug-ins it depends on will be downloaded to webrtc Middle third party Library , But turn it on webrtc Look in the third-party library cpu-features.c The file cannot be found , So it shows webrtc The lack of android ndk The third party .

Therefore, we need to download the required... From the official Android website ndk(, And copy to webrtc Under directory third_part/android_ndk Inside . Then run... Again ninja -C out/Release Instructions , This error disappears .

copyright:author[Tsingsee green rhino video],Please bring the original link to reprint, thank you.