AnDevi
AnDevi

Reputation: 111

Build WebRTC M127 for Android

I'm trying to build latest version of Webrtc (m127) for android. I can build it with success, but output library is unusable for me cuz it's build with incorrect clang and I got linker problems during building my code with clang delivered by android's ndk toolchains.

When I'm building WebRTC with command:

gn gen out/android-arm64-v8a --args='target_os="android" target_cpu="arm64"`
ninja -v -C out/android-arm64-v8a webrtc

I can see that it's being built with clang placed in here ../../third_party/llvm-build/Release+Asserts/bin/clang++ I would like to change it to clang prebuilt binary which is part of NDK and which is a clang I use to build my app later on.

I'm was trying to change gn command with added option for ndk path gn gen out/android-arm64-v8a --args='target_os="android" target_cpu="arm64" android_ndk_root="/usr/lib/Android/ndk/25.2.9519653"

but after this files are still being built by ../../third_party/llvm-build/Release+Asserts/bin/clang++

Then I also added clang_base_path option: gn gen out/android-arm64-v8a --args='target_os="android" target_cpu="arm64" android_ndk_root="/usr/lib/dev_tools/Android/ndk/25.2.9519653" clang_base_path="/usr/lib/Android/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/"

but now I'm getting an error: ninja: error: '../../../../../usr/lib//Android/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/lib/clang/20/lib/x86_64-unknown-linux-gnu/libclang_rt.builtins.a', needed by 'clang_x64/obj/third_party/protobuf/libprotoc_lib.a', missing and no known rule to make it

It misses some libs which are placed at third_party/llvm-build/Release+Asserts/lib/clang/

I don't know if it's correct way do build it, as documentation suggests that this custom clang option is only for Windows usage? https://chromium.googlesource.com/chromium/src.git/+/HEAD/docs/clang.md#using-a-custom-clang-binary

Is there any other proper way to build WebRTC for Android with specified clang?

Upvotes: 0

Views: 166

Answers (0)

Related Questions