Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Framework was built without full bitcode - Framework bitcode already enabled

Getting this error on Archiving my app. Framework used is my own. So I cross checked. Bitcode in framework is Enabled. Not sure why am I getting this issue. These are the build settings in my framework :

enter image description here

I followed this link but didn't work. Tried to set -fembed-bitcode in framework's project (not target, but project, since it is recommended in the link) setting.

like image 907
Nitish Avatar asked Dec 06 '18 10:12

Nitish


People also ask

What is enable Bitcode?

Bitcode is file that can be available to iTunes connect and they can use it to recompile with the updated clang compiler. 47.

Why should I enable Bitcode?

Bitcode-enabled builds When this option is disabled, the compiler generates an executable file that only contains machine code. But when it is enabled, the bitcode is included in the executable file alongside the generated machine code.


Video Answer


3 Answers

Bitcode is an abstract encoding of an app that can be used to re-compile it in different ways, given a set of instructions. You can confirm whether your binary is bitcode-compatible by running :

otool -l (my .o or .a file) | grep __LLVM.

When you build normally, Xcode adds the build flag -fembed-bitcode-marker to any clang invocation.

To Add -fembed-bitcode: select project Build Settings -> Other C flags, set Debug to -fembed-bitcode-marker and Release to -fembed-bitcode this will build your lib with bitcode.

BITCODE_GENERATION_MODE

If you set BITCODE_GENERATION_MODE=bitcode on your User-defined Setting, even during the build phase, the files will be compiled using the flag -fembed-bitcode.

And, if you set BITCODE_GENERATION_MODE=marker, the files will be compiled using the flag -fembed-bitcode-marker, independent of the action phase.

So, if you want to enable the bitcode to every action (build and archive), the better way to do so is using the BITCODE_GENERATION_MODE setting you can do so either manual or by script.

Manual

On Build Settings, click on the + sign at the top to add a user-defined build setting with the name BITCODE_GENERATION_MODE, and set Debug to marker, Release to bitcode.

Edit schema as Release Then link the library.a file and get the build path get the library form Release folder

Script

xcodebuild BITCODE_GENERATION_MODE=bitcode OTHER_CFLAGS="-fembed-bitcode" -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build

like image 104
JhonnyTawk Avatar answered Oct 14 '22 02:10

JhonnyTawk


Try to set Skip Install to YES and Enable Bitcode to Yes in framework build settings.

Skip Install

Embed Bitcode

like image 11
Vitalii Gozhenko Avatar answered Oct 14 '22 02:10

Vitalii Gozhenko


if you do below commands

  • Enable Bitcode' set to 'YES' Adding
  • Flags' Adding 'BITCODE_GENERATION_MODE' with the value 'bitcode' set skip install to yes

they will not work until

  • flutter clean
  • flutter build ios

so that after you change build settings you need to run flutter build

like image 3
Ucdemir Avatar answered Oct 14 '22 01:10

Ucdemir