I have Unity3D project and I built it for iOS. If I run it using XCode's simulator it works fine. But if I want to compile it for "iOS Device" or for a physical device connected to my Mac, I get lots of errors and as a result I can't create an Archive.
For a testing purpose, I even created an empty Unity3D project, built it for iOS and still get the same errors, although this project does absolutely nothing.
The errors are the following:
ld: library not found for -liPhone-lib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And these are the settings I use:
Architectures: armv7, armv7s, arm64 (also tried removing arm64 without any positive result)
Base SDK: iOS 7.1
Build active: no
Supported platform: iOS
Valid arch: armv7, armv7s, arm64
I use XCode 5.1.1 and Unity 4.5.1 (previously even tried 4.3.2)
How can I build the project and create the Archive?
I've run into the same issue some time ago and it was fixed by replacing quotes under library search path:
replace
"$(SRCROOT)/Libraries"
with
$(SRCROOT)/Libraries
more: http://answers.unity3d.com/questions/538363/error-when-i-updated-to-xcode-5-to-get-import-to-i.html
Related
Getting linker error in Xcode 12 when I am trying to build my large iOS app (hybrid, swift+objc). The application is building fine for real device, but It gives linker error when I am trying to run in Simulator directly with Debug configuration.
I have tried all possible solutions in other post here, but unfortunately it didn't work. Although the error in other post is different. I have checked Build for active architectures only to YES for Debug configs and NO for Release configs.
Other post error,
building for iOS Simulator, but linking in object file built for iOS, for architecture arm64
My error,
building for iOS Simulator, but linking in object file built for macOS, file for architecture x86_64
How can I resolve this issue? I need to run in both iOS real device and Simulator.
Wherever you got your library you should request the library that is compiled for iOS Simulator, not for macOS, although they have the same binary architectures that are returned via lipo -info <file>.
You can verify that your static (.a) or dynamic library (.dylib) is compiled for iOS Simulator using this command:
otool -l <path-to-library> | grep platform
The output means the following:
platform 7 - iOS Simulator
platform 6 - Mac Catalyst
platform 4 - watchOS
platform 2 - iOS
platform 1 - macOS
Here is the full definition of the enum for platform.
Try to add x86_64 in VALID_ARCHS in the User-defined section in Build Settings.
How can I fix the error mentioned below?
ld: warning: URGENT: building for iOS simulator, but linking in object file (/Users/amy/Desktop/amy/swift_proj/swift_proj/include/libcrypto_x86_64.a(asn1_lib.o)) built for OSX. Note: This will be an error in the future.
I assume that to run on iPhone simulator, we use arch type x86_64. Is that correct? The library I'm trying to link (libcrypto) is of arch type x86_64.
I've shown my Xcode build settings below:
Architectures: Standard architectures
Base SDK: Latest iOS (iOS 11.4)
Build active architecture only: No
Supported platforms: iOS
Valid architectures: arm64
I'm a newbie.
I have a Unity project which I have successfully built for Android without issue. When trying to build for iOS I am encountering an issue once the project is in Xcode.
Unity compiles without any errors and creates an Xcode project.
Upon opening the Xcode project I have NO simulators available. I can get these simulators by selecting ios in the Supported Platforms section, at which point simulators become available - originally Supported Platforms is set to iphoneos. This seems extremely odd behaviour to me, and suggests something larger going wrong.
After getting a simulator to select I get the following error when trying to compile/run/build:
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The full error is available on Pastebin (too large to post directly on here):
https://pastebin.com/3fYR8fE3
I'm really at a loss on what I can do. I have tried a number of things, including:
Building from Unity as Debug and Release
Building from Unity with 'Symlink Unity Libraries' on and off
Building from Unity with .Net 3.5 and .Net 4.* flavours
Manually adding the libiconv.2.dylib file in the linked frameworks tab as the .tbd equivalent
Setting the target minimum version of iOS to 9.0 (negates the need for libiconv.2.dylib entirely)
I am using latest versions of everything:
Unity 2018.2.17f1
Xcode 10.1
It seems like you have the library il2cpp built for another architecture, have you tried to change your target's "Build Settings > Build Active Architectures Only" to "No"?
However I made some researches and it seems that Unity for iPhone doesn't deploy on simulator. It only works on device or in the Unity editor. Check this link out
I installed JTCalendar using cocoa pods into my project but when I run the project on the XCode Simulators, it shows an error
ld: library not found for -lJTCalendar
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It is working fine when I debug the project using a real time device. WHy am I facing this issue on the simulator?
Thank you all for your replies. Actually the issue was that when I installed the pods, the pod project architecture was set to arm64 armv7 armv7s and Build active architectures only was set to YES. My real time device was armv7 and the simulator was x86_64. I changed Build active architectures only to NO in the pod project and the issue was fixed. Thanks again.
I finally realised why the 'Archive' option was gray. I needed to select an iOS device.
The only device that I currently have with me has iOS6 installed on it.
It says the following when trying to Archive the app:
ld: warning: ignoring file
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/crt1.3.1.o,
file was built for armv7 which is not the architecture being linked
(armv6):
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/crt1.3.1.o
ld: entry point (start) undefined. Usually in crt1.o for architecture
armv6 clang: error: linker command failed with exit code 1 (use -v to
see invocation)
But I want to support armv6. What should I do?
EDIT: I tried changing the target from iOS4.0 to iOS 4.2 and said the following:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo:
/Users/airrider3/Library/Developer/Xcode/DerivedData/TRGame-fvkoniflczyexwhcnmjvozqbuozd/Build/Intermediates/ArchiveIntermediates/AppStore/IntermediateBuildFilesPath/TRGame.build/Release-iphoneos/iOSGame.build/Objects-normal/armv7/Kipos
and
/Users/airrider3/Library/Developer/Xcode/DerivedData/TRGame-fvkoniflczyexwhcnmjvozqbuozd/Build/Intermediates/ArchiveIntermediates/AppStore/IntermediateBuildFilesPath/TRGame.build/Release-iphoneos/iOSGame.build/Objects-normal/armv7/Kipos
have the same architectures (armv7) and can't be in the same fat
output file Command
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo
failed with exit code 1
EDIT: I now managed to archive with just armv7 to iOS 4.0. Is it going to work?
You can't archive an file with IOS6, you need to downgrade to the latest official version to archive.
Edit:
Devices updated to iOS 6 beta can not be restored to earlier versions
of iOS. Registered development devices will be able to upgrade to
future beta releases and the final iOS 6 software.
https://developer.apple.com/devcenter/ios/index.action#
I figured it out. Instead of adding the 'armv6 armv7', I just needed to add 'armv6', as the code for 'armv7' was already written with that other default bizarre code.
That's why it was telling that two armv7 was being built.
Thanks everyone for the help, either way!