The SDK of Android webrtc compiled with Ninja – C out / release command reported an error, and the Android NDK processing method could not be found

We have also introduced a lot about webrtc compilation before. Because GN is much faster than gyp, we use GN to generate construction scripts and Ninja to build webrtc.

GN generate Ninja command

Common commands for generating Ninja build files using GN are as follows:

// Generate a debug version of the build file, default configuration
gn gen out/Debug 

// Generate a build file for the release version
gn gen out/Release --args="is_debug=false"

Ninja script

The gyp scripts under skia \ gyp are templates. When sync and gyp is executed, the actual build scripts will be generated dynamically according to these templates. Many module dependencies and conditions can be found in gyp or gypi under this directory.

Use the Ninja – C out/release instruction to compile and report an error

When compiling the webrtc SDK required by Android using the Ninja – C out/release instruction, 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 report, we can know that there is a problem with the file dependency and the required file cannot be found. Sometimes, the project directory changes and dependencies cannot be found. For webrtc, the plug-ins that depend on will be downloaded to the third-party library in webrtc, but the cpu-features.c file cannot be found when opening the third-party library in webrtc, which indicates that webrtc lacks an Android NDK third-party.

Therefore, we need to download the required NDK from the official Android website( and copy it to third under the webrtc directory_part/android_Inside the NDK. Then run the Ninja – C out/release command again, and the error disappears.

Read More: