• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by PaulineTilak · Dec 04, 2020 at 09:48 AM · iosxcodelinker

Why do I get a linking error after updating to Xcode 12 ?

Hello,

I have a Unity project that uses a native Swift + ObjC library that I made using Firebase MLKit. When trying to build for iOS, the Unity project always builds with Xcode 11.3.1, but when updating to any Xcode 12.X version, I get the following errors :

ld: warning: Could not find or use auto-linked library 'swiftCoreMIDI' ld: warning: Could not find or use auto-linked library 'swiftUniformTypeIdentifiers' Undefined symbols for architecture armv7:
"__swift_FORCE_LOAD_$swiftUniformTypeIdentifiers", referenced from: swift_FORCE_LOAD$swiftUniformTypeIdentifiers$NativeLibrary_iOS in NativeLibrary_iOS.a(NativeLibrary.o) swift_FORCE_LOAD$swiftUniformTypeIdentifiers$NativeLibrary_iOS in NativeLibrary_iOS.a(UIImage.o) (maybe you meant: swift_FORCE_LOAD$swiftUniformTypeIdentifiers$NativeLibrary_iOS) "swift_FORCE_LOAD$swiftCoreMIDI", referenced from: swift_FORCE_LOAD$swiftCoreMIDI$NativeLibrary_iOS in NativeLibrary_iOS.a(NativeLibrary.o) swift_FORCE_LOAD$swiftCoreMIDI$NativeLibrary_iOS in NativeLibrary_iOS.a(UIImage.o) (maybe you meant: swift_FORCE_LOAD$swiftCoreMIDI$_NativeLibrary_iOS) ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am not using either swiftCoreMIDI nor swiftUniformTypeIdentifiers in my code. For the record, I did recompile my native library with Xcode 12 before importing it again in Unity.

Things I have tried:

  • Building a Unity project with a Swift library that doesn’t use Firebase MLKit : works fine

  • Building an Xcode only project that uses Firebase MLKit : works fine

  • Building the project with a more recent Unity version : fails

  • Integrating the Firebase SDK frameworks directly instead of using CocoaPods : fails

  • Adding an empty Swift file + bridging header to my project : fails

  • Adding the user defined setting LD_VERIFY_BITCODE = NO in XCode : fails

I’m using:

  • Xcode 12.2

  • Firebase 6.34

  • Swift 5.0

  • Unity 2019.3.6f1

Any help would be appreciated, I’ve been stuck on this for a while!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by PaulineTilak · Dec 07, 2020 at 02:29 PM

SOLUTION

I finally found the solution, it was linked to the UnityFramework target in Xcode. I had to remove some architectures that are not concerned by my build: i386 and x86_64. In addition, I updated the Library Search Paths to include $(SDKROOT)/usr/lib/swift.

To execute those actions automatically, you can add those lines in a PostProcessBuild file in your Unity project :

 var projPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
 var proj = new PBXProject();
 proj.ReadFromFile(projPath);
 
 // Update the Library Search Paths of the whole Xcode project
 proj.AddBuildProperty(proj.ProjectGuid(), "LIBRARY_SEARCH_PATHS", "$(SDKROOT)/usr/lib/swift");
 
 // Get the UnityFramework target and exclude the unwanted architectures
 var unityFrameworkGuid = proj.TargetGuidByName("UnityFramework");
 proj.SetBuildProperty(unityFrameworkGuid, "EXCLUDED_ARCHS", "i386");
 proj.AddBuildProperty(unityFrameworkGuid, "EXCLUDED_ARCHS", "x86_64");

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

251 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Xcode - Mach-O Linker Error after upgrade to Unity 2019.4 (LTS) 0 Answers

Unity with FMOD iOS build - many linker errors Xcode 0 Answers

Xcode Apple Mach-O linker error 1 __frkparticlePluginSDKProcess 1 Answer

How to add shadows for multiple 3D models in native arkit ios 0 Answers

Memory issues for IOS, but not at all for Android 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges