4

Im having trouble enabling bitcode for webrtc framework ios and running out of ideas. I followed the instructions from their website but im getting error running python build_ios_libs.py --bitcode This is one part of error

../../stats/rtc_stats.cc:30:17: error: loop variable 'element' is always a copy because the range of type 'const std::vector<bool>' does not return a reference [-Werror,-Wrange-loop-analysis] for (const T& element : vector)

If anyone made bitcode enable work for webrtc ios, kindly help me thanks

KrisDev
  • 41
  • 1
  • 1
    Unfortunately, this is an issue with the latest clang that comes with Xcode and that specific file, we'll need to wait for google to fix this, or append use_xcode_clang=false to the build script, but that will mean we'll use google's specific clang version which does not support bitcode, so there's not much sense doing that. follow the comment in here: https://stackoverflow.com/questions/47376034/how-to-enable-bitcode-for-webrtc-ios-framework/55125861?noredirect=1#comment113358134_55125861. – goat_herd Sep 29 '20 at 05:13
  • 1
    The webRTC is something complicated to implement. If you don't need the application to be in the App Store you can still use the Private API `WKUIDelegatePrivate`, there are some delegate that will allow you to enable the webRTC https://github.com/wzw19890321/WebKit2/blob/eaa1f907695d6b0f6fd0e6e299c417a4f05cccf3/UIProcess/API/Cocoa/WKUIDelegatePrivate.h#L74 . I managed to enable the webRTC in my macOS app – Mickael Belhassen Sep 29 '20 at 07:19
  • @goat_herd is there a bug filed against webrtc? If not this is unlikely to get fixed... – Philipp Hancke Sep 29 '20 at 07:34
  • @PhilippHancke I don't know exactly, solution for me right now is just wait – goat_herd Sep 29 '20 at 09:52
  • I have this similar error even without the bitcode enabled. Have you checked if you could build when bitcode not enabled? – Abhijith C R Oct 01 '20 at 00:16
  • @AbhijithCR yes its working if bitcode is disabled. We need to enable it to include dsym in iTunes whenever we upload. But now I think we just export dsym from xcode and upload it to crashlytics. – KrisDev Oct 02 '20 at 02:07

3 Answers3

2

You can either wait or fix it yourself!

According to this thread: What is clang's 'range-loop-analysis' diagnostic about?

it is enough to remove the "&" sign from each line that has the problem (the objects are not references anyway in that context and this causes the warning which kills the compilation). So for example:

for (const T& element : vector) {

becomes:

for (const T element : vector) {

Rinse and repeat for all the files the compiler complains about (there are just a few).

Terminus
  • 925
  • 10
  • 23
1

The answer from a project member in here: https://bugs.chromium.org/p/webrtc/issues/detail?id=11729

"I have talked with Chromium about this and we are not going to land my CL because it is a change to support beta software. The right fix is to file a bug on Apple to ask them to pick up https://reviews.llvm.org/D72212 in xcode 12 (can you do that?) and for now just add treat_warnings_as_errors=false to your args.gn."

goat_herd
  • 571
  • 3
  • 13
0

To save you time. If you're building using, for example:

tools_webrtc/ios/build_ios_libs.py --bitcode --arch arm64 x64

edit these files at line 30 and line 40, respectively and remove the & (ampersand sign) in the for-loops:

stats/rtc_stats.cc:30:8:

sdk/objc/api/peerconnection/RTCStatisticsReport.mm:40:14:

iAmcR
  • 859
  • 11
  • 10