8

In the configurations from my iOS build, there is no option to disable bitcode. While in Xcode it is possible to set ENABLE_BITCODE=NO

I need this because my linked frameworks are not build with bitcode, and nowadays Apple does not allow half-bitcode-compiled apps anymore.

Jelle
  • 365
  • 3
  • 11
  • I am kinda sitting in the same boat, just reversed. My library does include Bitcode while my main project does not. I tried setting the property MtouchEnableBitcoe to "true" but "Bitcode is currently not supported on iOS" as the error message promptly told me. Really hope we can find a solution for this asap. – Eugen Timm Jun 08 '16 at 06:30
  • Bitcode is supported in Xamarin. Maybe post your error/issue on stackoverflow and send me the link ;) – Jelle Jun 09 '16 at 19:20
  • My thread is actually right here: http://stackoverflow.com/questions/37689054/sudden-error-when-uploading-to-itunesconnect-itms-90635-invalid-mach-o-format When I set the MtouchEnableBitcode property to true Xamarin Studio literally tells me "Error executing task Mtouch: Bitcode is currently not supported on iOS" Am I missing something here? – Eugen Timm Jun 10 '16 at 07:47

3 Answers3

7

In your .csproj for your iOS application, search for the PropertyGroup for the release configuration that you need to turn off bit code for, i.e.:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">

Within that group, see if a MtouchEnableBitcode already exists and edit it, otherwise add:

<MtouchEnableBitcode>false</MtouchEnableBitcode>
SushiHangover
  • 73,120
  • 10
  • 106
  • 165
  • For some reason my app is still not valid says Apple: 'ERROR ITMS-90668: "Invalid Bundle Executable. The executable file SoToGo.Touch.app/Frameworks/FrameWorkName.framework/FrameWorkName contains incomplete bitcode. To compile binaries with complete bitcode, open Xcode and choose Archive in the Product menu."' How can i disable bitcode for a native reference (Framework) ? – Jelle Jun 07 '16 at 17:00
  • @Jelle If you `otool` your framework's library, what is the address and size of the llvm segment? something like: `otool -arch arm64 FrameWorkName.framework/FrameWorkName | grep __bitcode -A 3` – SushiHangover Jun 07 '16 at 17:22
  • I'm missing an argument for the otool: one of -fahlLtdoOrTMRIHCGScisP or --version must be specified – Jelle Jun 07 '16 at 17:35
  • @Jelle I missed the `-l` so try `otool -arch arm64 -l FrameWorkName.framework/FrameWorkName | grep __bitcode -A 3` – SushiHangover Jun 07 '16 at 17:45
  • Then nothing comes out. Nothing found I guess. When I run the command without grep, there is a whole list of things. (btw: thanks for the help so far) – Jelle Jun 07 '16 at 20:31
  • I saw some other post about this, they suggested grep __LLVM then I get this result: `Load command 2 cmd LC_SEGMENT_64 cmdsize 152 segname __LLVM vmaddr 0x000000000000c000 vmsize 0x0000000000004000 fileoff 49152 filesize 16384 maxprot 0x00000003 initprot 0x00000003 nsects 1 flags 0x4 Section sectname __bundle segname __LLVM addr 0x000000000000c000 size 0x0000000000000001 offset 49152 align 2^0 (1) reloff 0 nreloc 0 flags 0x00000000 reserved1 0 reserved2 0` But I think there is no bitcode in this frmwrk – Jelle Jun 07 '16 at 20:41
  • @Jelle `addr 0x000000000000c000 size 0x0000000000000001` yes, with a size of one there is no llvm bitcode in that library. Seems like Apple made a change recently and multiple people are getting this ITMS-90668 error... – SushiHangover Jun 07 '16 at 21:46
  • They did indeed. Still strange they thing it's a incomplete bitcode build, while I disabled bitcode for the whole project. – Jelle Jun 08 '16 at 10:38
  • For the record, I was also using a Binding Lib to a Native Framework in this project, which had bitcode enabled... – Jelle Jun 07 '17 at 10:00
1

I am able to build the application with bitcode disabled by adding following lines to the iOS app project's .csproj file immediately before the closing </Project> tag.

<Target Name="BeforeCodesign">
  <Exec Command="$(_SdkDevPath)\Toolchains\XcodeDefault.xctoolchain\usr\bin\bitcode_strip %(_Frameworks.FullPath) -r -o %(_Frameworks.FullPath)" />
</Target>
Vittal Pai
  • 3,317
  • 25
  • 36
1

My team and I have done what Vittal Pai and SushiHangover suggested but we faced another error:

Command "\Applications\Xcode.app\Contents\Developer\Toolchains\XcodeDefault.xctoolchain\usr/bin\bitcode_strip PathToOurFrameWorks -r -o PathToOurFrameWorks" ended with code 3

^ It's translated from French so please don't bite me too hard :)

The only way we made it work was by importing the project from our GitHub to a Mac with VS 2017 and then rebuilding it there.

The error is still present on the Windows version but it's gone on the Mac version.

budiDino
  • 13,044
  • 8
  • 95
  • 91
Ylios
  • 11
  • 4