[cfe-users] Bitcode embedded fat iOS static library from c++ code

Tamas Toth via cfe-users cfe-users at lists.llvm.org
Tue Aug 29 06:31:42 PDT 2017


I would like to create a fat iOS static library from a bunch of c++ code 
(multiple projects) with embedded bitcode. I would like to use this 
library in an Xcode workspace where bitcode is enabled. The server where 
the c++ code is being built is CentOS based. So I downloaded LLVM 4.0 
with clang. With the help of clang and other tools I'm able to compile 
the code into libraries supporting armv7 and arm64 architectures and 
create a single fat library (using libtool and lipo). Everything works 
fine until I would like to achieve a bitcode embedded library. I thought 
that the only thing I need to do is to add the -fembed-bitcode option to 
clang. But when I try to export on Mac OS X the archived workspace for 
ad-hoc distribution, I got a strange error message:

error: Failed to verify bitcode in ***.app/***:

error: Clang option verification failed for bitcode 506 (unrecognized 
arguments: -mrelax-all -fembed-bitcode=all -disable-free 
-disable-llvm-verifier -discard-value-names -main-file-name 
algorithm.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix 
-mdisable-fp-elim -masm-verbose -target-cpu cortex-a8 -target-feature 
+soft-float-abi -target-linker-version 134.9 -dwarf-column-info 
-debugger-tuning=lldb -coverage-file ***/algorithm.opp -resource-dir 
/opt/llvm-4.0.0/bin/../lib64/clang/4.0.0 -std=gnu++11 
-fdebug-compilation-dir *** -ferror-limit 19 -fmessage-length 192 
-stack-protector 1 -fallow-half-arguments-and-returns -fblocks 
-fobjc-runtime=ios-8.0.0 -fencode-extended-block-signature 
-fsjlj-exceptions -fmax-type-align=16 -fdiagnostics-show-option 

Can anybody help what can be the error? Or my thoughts about how to 
build a bitcode embedded static library are wrong? Any help is really 

More information about the cfe-users mailing list