Unable to build for simulators while working for actual device - swift

While facing no issue with actual iPhone device, my project does not build for simulators. I get this error (which occurres for many fies):
ld: warning: ignoring file /Users/stephanedeluca/Library/Developer/Xcode/DerivedData/AladdinWorkspace-afneoinpxpyfmofvnattjgylgxgo/Build/Products/Debug-iphonesimulator/GoogleDataTransport.o, building for iOS Simulator-arm64 but attempting to link with file built for unknown-x86_64
Which sounds like mixing ARM and 86 architectures.
My VALID_ARCHS is set to arm64 arm64e armv7 armv7s i386
I tried to remove VALID_ARCHS value as stated in the following answer without success:
Xcode 13 failing building with "entry point (_main) undefined. for architecture arm64"
I also tried to delete the DerivedData folder without success either.
[UPDATE] I forgot to mention that there is no more PODs in my workspace as I replaced them by the corresponding g Swift packages.
Any idea?

I found the solution: for some reasons, the architecture for macOS being ˋi386ˋ was not longer right, as I had to change it for x86_64.
Finally, my valid architectures are now:
arm64 arm64e armv7 armv7s x86_64

Related

iPhone Static Library Issues With Simulator

So I have an iPhone static library that I am trying to build. I've got the script that was used in this question (http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4), but the issue I've hit is that I'm seemingly still unable to successfully build the static library for the simulator. When I build in the static library project, I get the follow warnings:
warning: no rule to process file '$(PROJECT_DIR)/GDInAppStore/GDInAppStore.m' of type sourcecode.c.objc for architecture i386
warning: no rule to process file '$(PROJECT_DIR)/GDInAppStore/SKProduct+priceAsString.m' of type sourcecode.c.objc for architecture i386
warning: no rule to process file '$(PROJECT_DIR)/GDInAppStore/VerificationControllerPBK.m' of type sourcecode.c.objc for architecture i386
I believe this issue is causing the problem that is leading to the universal library I get from the build script causing this error in my other project
ld: warning: ignoring file /Users/abotkin/Projects/Static Libraries/GDInAppStore/libGDInAppStore.a, missing required architecture i386 in file
"_OBJC_CLASS_$_GDInAppStore", referenced from:
objc-class-ref in SubscribeNowInAppController.o
ld: symbol(s) not found for architecture i386
I'm using Xcode 4.3.2 and have set the flags in the static library Xcode project so that i386 is included in the Architecture and Valid Architectures. Any tips?
Make sure you are building for the simulator if you are compiling for i386. Basically, your arch parameter has to match your sdk parameter. i.e.
xcodebuild -project proj.xcodeproj -arch armv64 -sdk iphoneos8.1 build
and
xcodebuild -project proj.xcodeproj -arch i386 -sdk iphonesimulator8.1 build
I was able to do a workaround this issue by using Karl's iOS Universal Framework that he mentioned in the other topic here https://stackoverflow.com/a/5721978/497718
That said, if anyone could point me into what I may have been doing wrong in using the script in that same topic, I'd love to learn how to do it the right way.
With Xcode 6, Apple has added iOS framework support to their build tools.
Using Apple's framework target for all new projects, as it is less hacky and is supported by Apple themselves.

ld: warning: unexpected srelocation type 9 while building in xcode

Hi I get around 7000 such warnings in the link stage of building my app for distribution
ld: warning: unexpected srelocation type 9
Any idea what this is and how I can fix it?
EDIT:
These warnings come during the link stage of 'armv7' only when building for distribution, and I also get the following warning
warning: all apps should include an armv7 architecture (current ARCHS = "armv6").
I have checked that armv7 is included in valid architectures" for both debug and distribution configuration.
Please check the following settings in your apps :
In the Info.plist. Check for "Required device capabilities" info, and look the data inside. You should have 2 items (NSArray) : armv6 and armv7
Try setting "Enable Linking With Shared Libraries" under Build Settings to NO
The only workaround for me was to build in XCode 4.2. It appears something in the .a file is not compatible. I was using LLVM-GCC which I thought would fix it, but it didn't.
Just remove it from "Link Binary With Libraries" is OK

Objective C: ARC errors (Automatic release problems) [duplicate]

Until xcode 4 final (I was using 3.latest and 4 GM for the time it was available) this didn't happen. When I upgraded to xcode 4 final version, I started getting a linking error while trying to link the armv7 version with my non armv7 library (my project is set with the default Standard armv6 armv7 valid architectures):
ld: warning: ignoring file ../bin/iOS static/arm/libssl.a, file was built for archive which is not the architecture being linked (armv7)
ld: warning: ignoring file ../bin/iOS static/arm/libcrypto.a, file was built for archive which is not the architecture being linked (armv7)
Undefined symbols for architecture armv7: -- list of symbols --
The armv6 version compiles just fine, but the overall compilation process fails with 77 link errors.
I understand this is the expected behavior, it wont link towards armv7 with an armv6 lib. The fix is setting my project to armv6 only. My question here is: why was this working in the previous versions of xcode?
If I set to armv6 only, I start to get this warning:
Check dependencies
[BWARN]warning: all apps should include an armv7 architecture (current ARCHS = "armv6").
I don't like seeing warnings :-) Anybody having similar issues?
Thanks,
Fernando
I just turned the Build active architecture only to Yes in the Project -> Build Setting -> Architectures tab.
In iOS SDK 4.3, it looks like the linker will simply refuse to use a armv6 library in an armv7 binary - this wasn't the case before.
That's why I had to update the http://code.google.com/p/ios-static-libraries/ project to generate both armv6 and armv7 versions of the libraries.
I have added 3rd Party framework with some demo classes into project but once implemented it successfully I removed those demo classes and since then the error started coming up
Error
"ld: ........., file is universal but does not contain a(n) armv6 slice for architecture armv6"
After scratching my head for a whole day I found this solution next morning maybe helpful for fellow iphone buddies coz I know the pain
Targets->"Your Project Target"-> Get Info ->Build Active Architecture only set to YES
Thats it..
Had the same problem.
But the reason was different I suppose.
I was using the library.a file built for simulator and trying to run it on device.. came to know that i need different .a files for simulator and device. I hope this helps someone ;)
Although I still don't know why this started happening only in the xcode 4 final version, I found that my external libs (ssl and crypto) were compiled against both armv6 and armv7 in the google code project very few days ago:
http://code.google.com/p/ios-static-libraries/
This will fix the issue if you define two different library search path: one for armv6, one for armv7.
Thanks,

Xcode 4 Final - "armv6 armv7" issue while linking with armv6 libs

Until xcode 4 final (I was using 3.latest and 4 GM for the time it was available) this didn't happen. When I upgraded to xcode 4 final version, I started getting a linking error while trying to link the armv7 version with my non armv7 library (my project is set with the default Standard armv6 armv7 valid architectures):
ld: warning: ignoring file ../bin/iOS static/arm/libssl.a, file was built for archive which is not the architecture being linked (armv7)
ld: warning: ignoring file ../bin/iOS static/arm/libcrypto.a, file was built for archive which is not the architecture being linked (armv7)
Undefined symbols for architecture armv7: -- list of symbols --
The armv6 version compiles just fine, but the overall compilation process fails with 77 link errors.
I understand this is the expected behavior, it wont link towards armv7 with an armv6 lib. The fix is setting my project to armv6 only. My question here is: why was this working in the previous versions of xcode?
If I set to armv6 only, I start to get this warning:
Check dependencies
[BWARN]warning: all apps should include an armv7 architecture (current ARCHS = "armv6").
I don't like seeing warnings :-) Anybody having similar issues?
Thanks,
Fernando
I just turned the Build active architecture only to Yes in the Project -> Build Setting -> Architectures tab.
In iOS SDK 4.3, it looks like the linker will simply refuse to use a armv6 library in an armv7 binary - this wasn't the case before.
That's why I had to update the http://code.google.com/p/ios-static-libraries/ project to generate both armv6 and armv7 versions of the libraries.
I have added 3rd Party framework with some demo classes into project but once implemented it successfully I removed those demo classes and since then the error started coming up
Error
"ld: ........., file is universal but does not contain a(n) armv6 slice for architecture armv6"
After scratching my head for a whole day I found this solution next morning maybe helpful for fellow iphone buddies coz I know the pain
Targets->"Your Project Target"-> Get Info ->Build Active Architecture only set to YES
Thats it..
Had the same problem.
But the reason was different I suppose.
I was using the library.a file built for simulator and trying to run it on device.. came to know that i need different .a files for simulator and device. I hope this helps someone ;)
Although I still don't know why this started happening only in the xcode 4 final version, I found that my external libs (ssl and crypto) were compiled against both armv6 and armv7 in the google code project very few days ago:
http://code.google.com/p/ios-static-libraries/
This will fix the issue if you define two different library search path: one for armv6, one for armv7.
Thanks,

iOS 4.3 Beta 2 Build Issue - Device Only

I just installed the 4.3 Beta 2 and now I can't build on my device (works fine on the simulator). My build settings are:
Base SDK: Latest iOS (iOS 4.3)
Architectures: Standard (armv6 armv7)
I am getting the below errors. What am I missing?
Error #1
Undefined symbols for architecture armv6:
"_OBJC_CLASS_$_UIProgressView", referenced from:
_OBJC_CLASS_$_PDColoredProgressView in PDColoredProgressView.o
....
ld: symbol(s) not found for architecture armv6
collect2: ld returned 1 exit status
Error #2
in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/crt1.o, file is universal but does not contain a(n) armv7 slice for architecture armv7
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
Considering that iOS 4.3 is under NDA, as all betas are, you won't find much help here. And anyone who actually does offer you up an answer that could remotely help you, would be breaching their NDA and could be thrown out of the program. My suggestion is to take this to the apple developer forums, there's a private confidential information forum you can use there (it's in red).
What is the OS version on Device? Try setting the deployment target to 4.0
I tried deleting the framework and reading it. Still no go. To be sure I readded all of my frameworks and now I am also receiving these warnings.
ld: warning: ignoring file /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics, file was built for unsupported file format which is not the architecture being linked (armv6)
If I deleted the frameworks and readded them from iOS4.3 how can 4.2 still be referenced? Is there more to removing the reference than deleting the .framework file?