Community

Topic: Unity 3D Plugin

iOS Build Problem

Niranjan Rao
Tuesday, August 18, 2020

Getting multiple symbols error while building for iOS:

Undefined symbols for architecture arm64: "_gzputs"

Unity 2019.3.6
Xcode 11.3.1

After searching on internet, these looks like OpenCV symbols and the error seems to be getting due to 32 bit vs 64 bit architecture.

But in the Player Settings of Unity's iOS, we have selected only arm64 architecture.

It would be great if there is a solution to this.

Thanks!

user profile image
Support Team  (expert)
Thursday, September 17, 2020

Hi,
you should update the XcodeProjectUpdater.cs in the following way:

#if UNITY_IOS
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.Collections;
using UnityEditor.iOS.Xcode;
using System.IO;

public class MyBuildPostprocessor
{
[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
{
if (buildTarget == BuildTarget.iOS)
{
string projPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";

PBXProject proj = new PBXProject();
proj.ReadFromString(File.ReadAllText(projPath));

//ADD THE FOLLOWING FIVE LINES
#if UNITY_2019_3_OR_NEWER
string target = proj.GetUnityFrameworkTargetGuid();
#else
string target = proj.TargetGuidByName("Unity-iPhone");
#endif

// Set a custom link flag
proj.AddBuildProperty(target, "OTHER_LDFLAGS", "-lz -lsqlite3");
// Disable bitcode
proj.SetBuildProperty(target, "ENABLE_BITCODE", "NO");

File.WriteAllText(projPath, proj.WriteToString());
}
}
}
#endif

This should fix the problem. As an alternative you can update the "Other Linker Flags" in the Build Settings of UnityFramework in Xcode by adding "-lsqlite3" and "-lz".

This has been tested on Unity 2019.4.9f1 and Xcode 11.7.

We will soon release an update to fix this problem.

Best Regards,
Support Team

Sign in to add a comment