5

Using webrtc through the pod,

https://cocoapods.org/pods/WebRTC

However, I cant enable bitcode in the project.

The solution requires building from source with bitcode enabled,

https://webrtc.googlesource.com/src/+/main/docs/native-code/ios/index.md

However, the following line python tools_webrtc/ios/build_ios_libs.py --bitcode is generating error,

[7/3304] CC obj/third_party/libsrtp/libsrtp/srtp.o
FAILED: obj/third_party/libsrtp/libsrtp/srtp.o 
...
clang: error: -mllvm is not supported with -fembed-bitcode

[6/3304] CC obj/third_party/libsrtp/libsrtp/ekt.o
FAILED: obj/third_party/libsrtp/libsrtp/ekt.o 
...
clang: error: -mllvm is not supported with -fembed-bitcode

[9/3304] CC obj/third_party/libvpx/libvpx/bilinearpredict_neon.o
FAILED: obj/third_party/libvpx/libvpx/bilinearpredict_neon.o 
....
clang: error: -mllvm is not supported with -fembed-bitcode

Tried similar answers with no luck.

tanmoy
  • 1,276
  • 1
  • 10
  • 28
  • 1
    In case needed, different error on same command at [link](https://stackoverflow.com/questions/47376034/how-to-enable-bitcode-for-webrtc-ios-framework), [link](https://stackoverflow.com/questions/68498739/cant-build-webrtc-with-bitcode-enabled), [link](https://stackoverflow.com/questions/47376034/how-to-enable-bitcode-for-webrtc-ios-framework) – tanmoy Jan 10 '22 at 06:03
  • 1
    Same here @Muhtasim... one thing I noticed is that my iOS's clang version is `bin % clang++ --version Apple clang version 13.0.0 (clang-1300.0.29.3) Target: x86_64-apple-darwin20.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin` Whereas in PATH: `% ./clang --version clang version 14.0.0 (https://github.com/llvm/llvm-project/ c4b45eeb44fdc49d1b6199f242082268f8c017d0) Target: x86_64-apple-darwin20.6.0 Thread model: posix InstalledDir: ...webrtc_ios/src/third_party/llvm-build/Release+Asserts/bin/.` – Tomer Petel Jan 11 '22 at 16:19
  • Facing exact same error. No solution found yet. Please inform if any solution found. –  Jan 11 '22 at 19:37
  • @MuhtasimUlfatTanmoy I saw you raised a bug to WebRTC [here](https://bugs.chromium.org/p/webrtc/issues/detail?id=13440#c4) but I don't see any progress there. Anything we can do to make WebRTC guys take a lot at it? – Tomer Petel Jan 19 '22 at 07:11
  • 2
    I was able to build it leaving the `-mllvm` flag with slight changes to source as discussed in [this](https://github.com/paulo-coutinho/pdfium-lib/issues/59) issue. I have published it on cocoa pod a [bitcode enabled webrtc binary framework](https://github.com/MuhtasimTanmoy/webRTC-arm64) supporting arm64 only. And the binary size is only 7.5 MB. It is currently working fine for me. Though waiting for a proper fix. – tanmoy Jan 20 '22 at 18:09

1 Answers1

1

I recently discovered this repository which provides Google WebRTC via Swift package manager:

https://swiftpack.co/package/stasel/WebRTC

This solved all my problems!

Binaries are also included for arm64 and x86.

I quote:

This repository contains unofficial distribution of WebRTC framework binaries for iOS and macOS.

Since version M80, Google has deprecated their mobile binary libraries distributions (Was officially using the GoogleWebRTC pod). To get the most up to date WebRTC library, you can compile it on your own, or you can use precompiled binaries from here or other sources.

Releases

The binary releases correspond with official Chromium releases and branches as specified in the Chromium dashboard.

Things to know

• All binaries in this repository are compiled from the official WebRTC source code without any modifications to the sources code or to the output binaries.

• Dynamic framework (xcframework format) which contains multiple binaries for both macOS and iOS.

Bitcode is included and this is the reason for the larger file size.

Daniele Ceglia
  • 849
  • 8
  • 12
  • 1
    Official webRTC binary `GoogleWebRTC` is 22.5 MB though does not include bitcode. This one is nearly 659 MB. – tanmoy Jan 28 '22 at 12:46
  • This [bitcode enabled webrtc binary framework](https://github.com/MuhtasimTanmoy/webRTC-arm64) supporting arm64 only is currently working fine for me. And the binary size is only 7.5 MB. Though waiting for a proper fix. – tanmoy Jan 28 '22 at 12:49
  • The size is certainly an important issue, but without x86 I can't work comfortably in SwiftUI because it doesn't compile and draw the preview of the interface. – Daniele Ceglia Jan 28 '22 at 16:06
  • 1
    And @Muhtasim Ulfat Tanmoy I had tried your compiled framework but when I went to upload my app to the App Store unfortunately it was rejected due to the framework is using a private API. – Daniele Ceglia Jan 28 '22 at 16:16
  • 3
    Currently fixing this and adding support for x86 as well. Any insight into why this fails while uploading to the App store? The `arm64_x86_64` binary is nearly 16.8 Mb. – tanmoy Feb 01 '22 at 16:44
  • 2
    This is the issue reported to me from the App Store Connect: "ITMS-90338: Non-public API usage - The app references non-public selectors in [MY_APP_NAME]: initWithURLStrings:, sdp, setIsEnabled:, setVideoContentMode:, videoSource. If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions. In addition, note that one or more of the above APIs may be located in a static library that was included with your app. If so, they must be removed." – Daniele Ceglia Feb 02 '22 at 08:11