Can't build Webrtc with Bitcode enabled

1.7k Views Asked by At

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

3

There are 3 best solutions below

9
Vadim Tatarchuk On

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!

1
Richard Tai On

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!

0
Ryan Burgoyne On

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