'Enabling bitcode for WebRTC iOS
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
Solution 1:[1]
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).
Solution 2:[2]
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."
Solution 3:[3]
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:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Terminus |
Solution 2 | goat_herd |
Solution 3 | iAmcR |