5

I am trying to rebuild WebRTC iOS framework with Bitcode enabled but it's not working it's giving me errors. And the error messages are

clang++: error: unknown argument: '-ffile-compilation-dir=.'

clang++: error: -gdwarf-aranges is not supported with -fembed-bitcode

If I build it without bitcode enable true only then it's working. Can anyone have any idea why I am having this issue? My Xcode version is 12.5.1

Jihan
  • 95
  • 9

3 Answers3

2

I used llvm12 to build webrtc on arm64 linux and encounter the same error clang++: error: unknown argument: '-ffile-compilation-dir=.' at first.


In the src/build/config/compiler/BUILD.gn, there are some setting like below:

if (is_nacl) {
# TODO(https://crbug.com/1231236): Use -ffile-compilation-dir= here.
cflags += [
"-Xclang",
"-ffile-compilation-dir",
"-Xclang",
".",
]
} else {
# -ffile-compilation-dir is an alias for both -fdebug-compilation-dir=
# and -fcoverage-compilation-dir=.
cflags += [ "-ffile-compilation-dir=." ]
}

I replace all of the -ffile-compilation-dir into -fdebug-compilation-dir then it worked fine!

A.J.Bauer
  • 2,803
  • 1
  • 26
  • 35
Richard Tai
  • 88
  • 1
  • 8
1

The error occurs due to the old version of clang in Xcode. I executed the script with the given arguments:

build_ios_libs.py --extra-gn-args 'use_xcode_clang=false enable_dsyms=true' --bitcode --arch device:arm64 simulator:x64

Inside the webRTC dist, there is a new version of the LLVM (clang) package that will build the correct framework!

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
  • arm64 simulator fails. It is needed for a MacBook on M1. This error was not defeated – Vadim Tatarchuk Aug 12 '21 at 23:24
  • By using this args, framework is created successfully for simulator and devices but when I try to add in demo project which is bitcode enabled throwing error for bitcode. – Mrugesh Tank Aug 14 '21 at 13:56
  • @MrugeshTank if you use firebase crashlitics. You can turn off bitcode and upload dSYMs files manually. It works for me https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports?platform=ios – Vadim Tatarchuk Aug 16 '21 at 09:44
  • 1
    webRTC framework uses llvm14, but xcode uses only llvm12. They are not compatible with each other, for this reason the framework is not built. Even the new version of xCode 13 beta 5 doesn't support building the webRTC framework because uses llvm 13 :( – Vadim Tatarchuk Aug 16 '21 at 09:47
  • So, there is no option for building bitcode enabled framework? – Mrugesh Tank Aug 25 '21 at 16:19
  • I'm using Firebase Crashlytics with Bitcode enabled. I need Bitcode to reduce app size for Download from AppStore. And that's why I need to build WebRTC with bitcode enabled – Mrugesh Tank Aug 25 '21 at 16:20
  • @MrugeshTank dSYMs files are not included in your application release. They are only needed to view crashes in firebase. These dSYMs files are stored in the archive of your application when you collect it for submission to the store. I was unable to build a framework with bitcode enabled – Vadim Tatarchuk Aug 27 '21 at 02:45
  • I forced to use clang 14 from "..../src/third_party/llvm-build/Release+Asserts/bin" (via "sudo nano /etc/paths" adding this path on top) but I still get this error: clang++: error: "-mllvm is not supported with -fembed-bitcode" – Daniele Ceglia Jan 19 '22 at 11:40
  • @DanieleCeglia same here... in addition when I try to use the flag `use_xcode_clang=false` I'm getting this message `The variable "use_xcode_clang" was set as a build argument but never appeared in a declare_args() block in any buildfile.` and still getting the same error – Tomer Petel Jan 20 '22 at 06:44
1

It looks like this has been addressed in top-of-tree chromium. According to this pull request, use_xcode_clang is being removed because top-of-tree clang supports -fembed-bitcode: https://github.com/chromium/chromium/commit/6edcf847d80f13740e1a26a86d3b95a0bb9fbcad