react-native-unity-view icon indicating copy to clipboard operation
react-native-unity-view copied to clipboard

ld: symbol(s) not found for architecture arm64 - Apple Mach-O Linker (ld) Error Group

Open mkharibalaji opened this issue 5 years ago • 14 comments

Hi , I am facing the below issue in xcode 9.3,unity 2018.1.8f1

Ld /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos/knyp.app/knyp normal arm64 cd /Users/haribalajimk/reactnativeprojects/knyp/ios export IPHONEOS_DEPLOYMENT_TARGET=11.3 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk -L/Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos -L/Users/haribalajimk/reactnativeprojects/knyp/ios/UnityExport/Libraries -L/Users/haribalajimk/reactnativeprojects/knyp/ios/UnityExport/Libraries/libil2cpp/include -F/Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos -filelist /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Intermediates.noindex/knyp.build/Debug-iphoneos/knyp.build/Objects-normal/arm64/knyp.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=11.3 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Intermediates.noindex/knyp.build/Debug-iphoneos/knyp.build/Objects-normal/arm64/knyp_lto.o -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -weak-lSystem -weak_framework CoreMotion -weak_framework GameKit -weak_framework iAd -framework AVFoundation -framework AudioToolbox -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework CoreMedia -framework CoreVideo -framework Foundation -framework MediaPlayer -framework MediaToolbox -framework Metal -framework OpenAL -framework OpenGLES -framework QuartzCore -framework SystemConfiguration -framework UIKit -liconv.2 -liPhone-lib -lil2cpp -weak-lSystem -weak_framework CoreMotion -weak_framework GameKit -weak_framework iAd -framework AVFoundation -framework AudioToolbox -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework CoreMedia -framework CoreVideo -framework Foundation -framework MediaPlayer -framework MediaToolbox -framework Metal -framework OpenAL -framework OpenGLES -framework QuartzCore -framework SystemConfiguration -framework UIKit -liconv.2 -liPhone-lib -lil2cpp -ObjC -lc++ /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos/libRCTBlob.a /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos/libRCTAnimation.a /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos/libReact.a /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos/libRCTAnimation.a /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos/libRCTActionSheet.a /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos/libRCTGeolocation.a /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos/libRCTImage.a /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos/libRCTLinking.a /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos/libRCTNetwork.a /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos/libRCTSettings.a /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos/libRCTText.a /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos/libRCTVibration.a /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos/libRCTWebSocket.a -lRNUnityView -Xlinker -dependency_info -Xlinker /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Intermediates.noindex/knyp.build/Debug-iphoneos/knyp.build/Objects-normal/arm64/knyp_dependency_info.dat -o /Users/haribalajimk/Library/Developer/Xcode/DerivedData/knyp-fxexrnvygqjfwcdokdkzqgdxcqhp/Build/Products/Debug-iphoneos/knyp.app/knyp

ld: warning: arm64 function not 4-byte aligned: ltmp0 from /Users/haribalajimk/reactnativeprojects/knyp/ios/UnityExport/Libraries/libiPhone-lib.a(unwind_test_arm64.o) ld: warning: arm64 function not 4-byte aligned: _unwind_tester from /Users/haribalajimk/reactnativeprojects/knyp/ios/UnityExport/Libraries/libiPhone-lib.a(unwind_test_arm64.o) Undefined symbols for architecture arm64: "_UnityDocumentsDir", referenced from: systeminfo::GetPersistentDataPath() in libiPhone-lib.a(TrampolineGlue.o) "_AcquireDrawableMTL", referenced from: EnsureColorSurfaceIsReady(ColorRenderSurfaceMetal*) in libiPhone-lib.a(PluginInterfaceGraphicsMetal.o) "_UnityDeviceUniqueIdentifier", referenced from: systeminfo::GetDeviceUniqueIdentifier() in libiPhone-lib.a(TrampolineGlue.o) "_UnityDeviceCPUCount", referenced from: systeminfo::GetProcessorCount() in libiPhone-lib.a(TrampolineGlue.o) "_UnityCachesDir", referenced from: LocalFileSystemiPhone::GetUserAppCacheFolder() const in libiPhone-lib.a(runtime_virtualfilesystem_0.o) "_UnityGetMetalDrawableCommandQueue", referenced from: MetalContext::PrepareCommandBufferIfNeeded() in libiPhone-lib.a(MetalContext.o) "_UnityGetMetalBundle", referenced from: MetalBundleImpl() in libiPhone-lib.a(PluginInterfaceGraphicsMetal.o) "_il2cpp_no_exceptions", referenced from: ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool) in libiPhone-lib.a(runtime_scripting_2.o) "UnityInitTrampoline()", referenced from: _InitUnity in libRNUnityView.a(UnityUtils.o) "_UnityGetMetalCommandQueue", referenced from: MetalContext::PrepareCommandBufferIfNeeded() in libiPhone-lib.a(MetalContext.o) "_UnityDisplayManager_DisplayRenderingResolution", referenced from: _UnityDisplayManager_GetDisplayDeviceAt in libiPhone-lib.a(LibEntryPoint.o) "_UnityLibraryDir", referenced from: LocalFileSystemiPhone::GetUserAppDataFolder() const in libiPhone-lib.a(runtime_virtualfilesystem_0.o) "_UnityApplicationDir", referenced from: _UnityInitRuntime in libiPhone-lib.a(LibEntryPoint.o) LocalFileSystemiPhone::GetApplicationPath() const in libiPhone-lib.a(runtime_virtualfilesystem_0.o) "_UnityGetGLViewController", referenced from: -[AchievementWrapper showAchievementsUI] in libiPhone-lib.a(GameCenter.o) -[LeaderboardWrapper showLeaderboardUI:withTimeScope:] in libiPhone-lib.a(GameCenter.o) "_UnityUpdateNoBackupFlag", referenced from: iphone::SetFileFlags(char const*, unsigned int, unsigned int) in libiPhone-lib.a(iPhoneMisc.o) "_GetAppController", referenced from: +[RNUnityViewManager handleAppStateDidChange:] in libRNUnityView.a(RNUnityViewManager.o) -[RNUnityViewManager setBridge:] in libRNUnityView.a(RNUnityViewManager.o) -[RNUnityView initWithFrame:] in libRNUnityView.a(RNUnityView.o) "RegisterMonoModules()", referenced from: _InitUnity in libRNUnityView.a(UnityUtils.o) "RegisterFeatures()", referenced from: _InitUnity in libRNUnityView.a(UnityUtils.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Apple Mach-O Linker (ld) Error Group

mkharibalaji avatar Jul 17 '18 03:07 mkharibalaji

Facing the same issue.. created an empty project and followed the Readme guide for setup.

React Native version 0.56.0 react-native-unity-view: ^1.1.3 Unity 2018.1.8f1

im-aditya avatar Jul 23 '18 07:07 im-aditya

see https://github.com/f111fei/react-native-unity-demo/issues/5

f111fei avatar Jul 23 '18 07:07 f111fei

@f111fei : Hey.. thanks for the quick reply.

Can u help me figure out how to remove this folder reference from xcode project. I am from Android background and have never worked on xcode projects.

Thanks again

im-aditya avatar Jul 23 '18 08:07 im-aditya

az s ote f_nctkatafnkmo

f111fei avatar Jul 23 '18 08:07 f111fei

I don't have this folder reference in the first place. I have followed the steps 2-3 times with new projects. I dont get this folder in my XCode.

What am I missing ?

im-aditya avatar Jul 23 '18 10:07 im-aditya

Closing and reopening the project shows this folder. But this solution is not working for me.!!

im-aditya avatar Jul 23 '18 11:07 im-aditya

Hi @f111fei, I have tried your suggestion - deleting the UnityExport folder does not solve the issue and I still see the same errors.

Could you please advise on how to solve this problem?

AkshayBudhiraja avatar Jul 23 '18 23:07 AkshayBudhiraja

Facing the same issue after following the 'How to use' guideline:

Undefined symbols for architecture arm64: "_UnityGetGLViewController", referenced from: -[AchievementWrapper showAchievementsUI] in libiPhone-lib.a(GameCenter.o) -[LeaderboardWrapper showLeaderboardUI:withTimeScope:] in libiPhone-lib.a(GameCenter.o) "_UnityGetMetalDrawableCommandQueue", referenced from: MetalContext::PrepareCommandBufferIfNeeded() in libiPhone-lib.a(MetalContext.o) "_AcquireDrawableMTL", referenced from: EnsureColorSurfaceIsReady(ColorRenderSurfaceMetal*) in libiPhone-lib.a(PluginInterfaceGraphicsMetal.o) "_UnityGetMetalBundle", referenced from: MetalBundleImpl() in libiPhone-lib.a(PluginInterfaceGraphicsMetal.o) "_il2cpp_no_exceptions", referenced from: ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool) in libiPhone-lib.a(runtime_scripting_2.o) "_UnityDeviceCPUCount", referenced from: systeminfo::GetProcessorCount() in libiPhone-lib.a(TrampolineGlue.o) "_UnityGetJoystickCount", referenced from: GetJoystickNames(std::__1::vector<core::basic_string<char, core::StringStorageDefault >, std::__1::allocator<core::basic_string<char, core::StringStorageDefault > > >&) in libiPhone-lib.a(iPhoneInputImpl.o) "_UnityGetMetalCommandQueue", referenced from: MetalContext::PrepareCommandBufferIfNeeded() in libiPhone-lib.a(MetalContext.o) "_UnityGetJoystickName", referenced from: GetJoystickNames(std::__1::vector<core::basic_string<char, core::StringStorageDefault >, std::__1::allocator<core::basic_string<char, core::StringStorageDefault > > >&) in libiPhone-lib.a(iPhoneInputImpl.o) "_UnityDisplayManager_DisplayRenderingResolution", referenced from: _UnityDisplayManager_GetDisplayDeviceAt in libiPhone-lib.a(LibEntryPoint.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

"react-native": "0.53.0" "react-native-unity-view": "^1.1.3" Unity version: 2018.2.6f1

ezhilkumaranPE avatar Sep 21 '18 08:09 ezhilkumaranPE

Any news about this issue? I'm facing the same problem.

brianbatista93 avatar Dec 06 '18 14:12 brianbatista93

anyone figure this out? I am getting this when building my project but it shows up for our iMessageExtension which doesn't use Unity at all. Is there a way to exclude those headers from that target? (It seems to build fine for the app)

Jonovono avatar Feb 12 '19 17:02 Jonovono

I accidentally found that adding Debug.Log("whatever") to XCodePostBuild.cs fixes this error, at least I started seeing messages like

Added file to pbx: 'UnityExport/Classes/CrashReporter.h'

During "export IOS", and I got UnityExport group in XCode which wasn't there before. Apparently Unity didn't pick up the PostBuild hook before or something like that

Bottom line: make sure that XCodePostBuild#OnPostBuild is being executed on build

vlobanov avatar Jun 14 '19 13:06 vlobanov

anything new on this ?

MaxToyberman avatar Sep 16 '19 19:09 MaxToyberman

This workflow works most of the time for me:

  1. Close XCode
  2. Clear XCode Cache
rm -rf ~/Library/Developer/Xcode/DerivedData/*
  1. Export iOS from Unity again
  2. Remove files
rm ios/UnityExport/Classes/DynamicLibEngineAPI-functions.h
rm ios/UnityExport/Classes/DynamicLibEngineAPI.mm
  1. Open Xcode & build again

JanOwiesniak avatar Sep 25 '19 16:09 JanOwiesniak

anyone figure this out? I am getting this when building my project but it shows up for our iMessageExtension which doesn't use Unity at all. Is there a way to exclude those headers from that target? (It seems to build fine for the app)

@Jonovono I am also running into same issue, had you found any solution for the same?

HimaParmar avatar Nov 02 '21 13:11 HimaParmar