Jihan
Jihan

Reputation: 95

Can't build Webrtc with Bitcode enabled

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

Upvotes: 5

Views: 1832

Answers (3)

Richard Tai
Richard Tai

Reputation: 498

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!

Upvotes: 2

Ryan Burgoyne
Ryan Burgoyne

Reputation: 146

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

Upvotes: 1

Vadim Tatarchuk
Vadim Tatarchuk

Reputation: 11

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!

Upvotes: 1

Related Questions