I have a static library that is built by other company. I want to know if it's a static library containing bitcode, which command can detect it in terminal?
相关问题
- ld: -bundle and -bitcode_bundle cannot be used tog
- What is exact connection between BITCODE_ENABLE an
- Sudden Error when Uploading to iTunesConnect: ITMS
- How to enable Bitcode for WebRTC iOS framework?
- Error while exporting with Bitcode enabled (symbol
相关文章
- Bitcode disabled on Carthage dependencies
- What's the difference between `-fembed-bitcode
- How to check if a framework is BITCODE supported f
- Disable bitcode for project and cocoapods dependen
- How to disable Bitcode on Carthage dependencies
- Bundled framework issues with Bitcode compilation
- Method to determine whether a binary contains Bitc
- Xcode 7 what happens when I disable bitcode for a
You can try: otool -l (.o or .a file)
and look for "__bitcode" section
It was answered here: How do I xcodebuild a static library with Bitcode enabled?
As it was alread written in other answers,
is the way to go.
An Apple engineer says using
is not reliable.
See also the comments by xCocoa.
It seems, that
otool
does not report the bitcode if code for the iPhone Simulator's architecture is included (x86_64 or arm64).You can list the lib's architectures with:
Then you can check for bitcode for each architecture separately, e.g:
It is recommended to test against LLVM symbols:
otool -l yourlib.a | grep LLVM
You should get some lines with "__LLVM"
And if you want to check if a specific file
(yourFile.o)
in the static library is bitcode enabled, you can extract the'staticLibrary.a'
and use the sameotool
command. However macOS doesn't allow to extract your staticLibrary.a at times with the default extract utility and most 3rd party tools doesn't work either.You can follow these steps to check specific
.o
filesGet the info of the architecture
eg output: armv7 arm64
Extract
yourStaticLibrary.a
for any or both of the above architecture(specify the output path you want to extract to)
You get the
'yourStaticLibraryarmv7.a'
which then can be easily extracted with the default mac unarchiverOn extracting, you then get a folder '
yourStaticLibraryarmv7'
containing all the .o filesotool -l yourFile.o | grep bitcode
or with the specific architectureIf the file is bitcode enabled , you get 'sectname __bitcode' in the commandline
Disclaimer: I'm the author of LibEBC.
You can use
ebcutil
to see whether bitcode is present in a Mach-O binary or library. You can even use it to extract the embedded bitcode from it.https://github.com/JDevlieghere/LibEBC