YetAnotherHttpHandler icon indicating copy to clipboard operation
YetAnotherHttpHandler copied to clipboard

iOS Unity Cloud Build Failing

Open jehowell opened this issue 1 year ago • 3 comments

We can't seem to get YetAnotherHttpHandler building in Unity Cloud Build for iOS

We get a linker error:

[error] [2023-09-20T04:48:30.206Z] - 7.3.22.2.7.4 - INFO: ❌ ld: could not reparse object file in bitcode bundle: 'Opaque pointers are only supported in -opaque-pointers mode (Producer: 'LLVM16.0.2-rust-1.70.0-stable' Reader: 'LLVM APPLE_1_1400.0.29.202_0')', using libLTO version 'LLVM version 14.0.0, (clang-1400.0.29.202)' for architecture arm64

The latest version of xcode that Unity supports is 14.2. Was this built with something later?

jehowell avatar Sep 20 '23 04:09 jehowell

Disabling ENABLE_BITCODE in the project does seem to solve the problem, but its not a great long term solution. Looks like there's some build settings for the native lib that are missing.

jehowell avatar Sep 20 '23 05:09 jehowell

#if UNITY_IOS
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEditor.iOS.Xcode;

public class DisableBitCode : IPostprocessBuildWithReport
{
	public int callbackOrder => 1;

	public void OnPostprocessBuild(BuildReport report)
	{
		if (report.summary.platform == BuildTarget.iOS)
		{
			string projectPath = report.summary.outputPath + "/Unity-iPhone.xcodeproj/project.pbxproj";


			PBXProject pbxProject = new PBXProject();
			pbxProject.ReadFromFile(projectPath);


			//Disabling Bitcode on all targets


			//Main
			string target = pbxProject.GetUnityMainTargetGuid();
			pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");


			//Unity Tests
			target = pbxProject.TargetGuidByName(PBXProject.GetUnityTestTargetName());
			pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");


			//Unity Framework
			target = pbxProject.GetUnityFrameworkTargetGuid();
			pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");


			// Game Assembly
			target = pbxProject.TargetGuidByName("GameAssembly");
			pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");


			pbxProject.WriteToFile(projectPath);
		}
	}
}
#endif

This is a script you can add to your project to disable the bitcode

ben-tbotlabs avatar Sep 20 '23 08:09 ben-tbotlabs

Bitcode is deprecated by Apple in Xcode 14. You can (and should) disable it.

Last8Exile avatar Sep 24 '24 18:09 Last8Exile