facebook ios sdk build fails on device, works on simulator - ios5

I am trying to build an app (with ARC) that uses the facebook_ios_sdk (the latest version on github).
As recommended by Facebook, I used the build script to create a static library and then added it to the project.
Now when I build the project for an iPhone 5.1 Simulator, it works fine. However, on running it for an actual device (which is running 5.1), it gives the following build error -
ld: in ../facebook-ios-sdk/libfacebook_ios_sdk.a, file is universal but does not contain a(n) armv7 slice for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any suggestions on how to resolve this?

You could modify the build script for static library (which was too complicated for me), or just skip the library approach:
add the Facebook sources from SDK to your project
if using ARC, go to "target->build phases->compile sources" and mark all the Facbook source files with the--fno-objc-arc flag
That's it, works for me.

One work around that worked was to change the Valid Architectures from"armv6 armv7" to just armv6

Related

Xcode error: building for iOS Simulator, but linking in object file built for iOS

Never had a lot of problems until the time to buy Macbook Air M1. Just yesterday my app was build without any error in Xcode 12.4. I did not make any special changes and today build failed:
/Users/userName/Projects/MyApp/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a(cryptlib.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/userName/Projects/MyApp/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a' for architecture arm64clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please can you help me, how to solve it?
Looks like a missing Arm64 simulator slice in the OpenSSL-Universal CocoaPods distribution.
Make sure that you're using the latest version with pod update and contact the OpenSSL-Universal if there's still an issue.

clang: error no such file or directory: */Debug-iphonesimulator/MailCore/MailCore

I am using mailcore2 in my ios app from fetching my gmail account emails on my device. I have changed the ios sdkversion from 6.1 to 6.0 in the mailcore2 scripts bcz I am trying to compile and run the app using iPhone simulator 6.0 which uses ios sdkversion 6.0. Doing so I am getting the following clang error.
clang: error: no such file or directory: '/Users/shujaat/Library/Developer/Xcode/DerivedData/MyTestApp-ditognlaoajwldfliplqecnxqbfj/Build/Products/Debug-iphonesimulator/MailCore/MailCore'
While trying to compile and run my app using iphone simulator 6.1 (uses ios sdk 6.1), with no changes in the ios sdk version in the shell scripts, I am getting the following error:
/bin/sh /Users/shujaat/Documents/WemoTech/Products/WantList/sourcecode/ThirdPartyLib/MailCore2/Externals/builds/workdir/20130930192723/src/libetpan/build-mac/update.sh
configuring
running prepare-cyrus-sasl.sh
prepare sources
patching file lib/client.c
building tools
generated makemd5i386 properly
building for iPhoneOS - armv7
CONFIGURE FAILED
Command /bin/sh failed with exit code 1
These issues are driving me crazy for the last couple of days. Need your help.
Go to your main project target->"Build phases"->"Target dependencies" add mailcore2 ios
You need to read Check Adding MailCore to Your iOS Project carefully.
These issues are fixed now. I want to explain what I did to get rid of them for others facing same issues:
I made a separate project, and made mailcore2 as a part of it (didn't include the #import line in any of the project files at first). I compiled and run the project and copied the resultant mailcore 2 from it to my original project. It's compiling and running fine now.

clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have developed an iOS Application with Xcode 5, release 6.
I have successfully run the application on the iOS simulator and on my iPhone 5 (iOS7 beta6)
I'm following Apple's tutorial on how to release the app onto the app store (bit complicated).
I've gotten to the point where they want me to "Archive" my project. Everytime I attempt to archive it, it gives me this error:
ld: file not found:
/Users/name/Library/Developer/Xcode/DerivedData/Mobile-cwvgezbobyhhzzccadgoqizqcmfd/Build/Intermediates/ArchiveIntermediates/trial/InstallationBuildProductsLocation/Applications/libCordova.a
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
Well, since you are using Xcode 5, Apple says on the member center:
"Xcode 5 Developer Preview cannot be used to submit apps to the iOS or
Mac App Store. Continue to use the publicly released version of Xcode
to compile and submit apps to the App Stores."
But I will show some suggestions anyway:
With Xcode, click on your project's icon on the left, select the tab Build Phases > Compile Sources and click on the "+" to check if there is some file .m to be imported.
Check if you imported all the frameworks you are using to your project.
Go to Build Settings and look for Architectures and set armv7 instead of armv6 and armv7s.
I hope this helps.

OpenCV.Framework does not compile for the armv7s architecture

I am working on an iphone application using openCV framework.
Everything was working fine. however lately with the release of iOS 6 and XCode 4.5 I was migrating my project to XCode 4.5
When building I encountered this error:
ld: file is universal (2 slices) but does not contain a(n) armv7s
slice:
/Users/jobs/iPhone_Client/workspace/MyProject/third-party/OpenCV.framework/OpenCV
for architecture armv7s clang: error: linker command failed with exit
code 1 (use -v to see invocation)
** BUILD FAILED **
The following build commands failed:
Ld build/MyProject.build/Debug-iphoneos/MyProject.build/Objects-normal/armv7s/MyProject
normal armv7s (1 failure)
As I understood this is due to the new armv7s architecture.
OpenCV is apparently it is not compiling with armv7s.
How can I fix this issue?
Where can I find a new release of the framework that is compatible with the armv7s architecture?
And if there is no compatible framework available, is there a way to get the source code and create my own library compiled against the new architecture? Maybe some quick steps on how to do it?
Note: Just to note that I need the build for armv7s not armv7.
Thank you
This answer builds upon the one given by n9986. As he suggested, I cloned the repository found at
https://github.com/jonmarimba/OpenCV-iOS
When I downloaded it several references inside the project to different libraries were broken which was strange but they were easy to fix. After they were fixed it behaved exactly as n9986 described, outputting libraries compiled for both armv7 and armv7s. For my purposes however I required that they be bundled into a .framework so that they could be a drop in replacement for the old .framework I have been using.
Previously I had downloaded the latest version of Opencv for ios here and spent quite a bit of time trying to modify their cmake files to compile with support for armv7s. jonmarimba has already restructured the xcode project file to strip away its cmake dependencies which makes changing the target architecture much more intuitive. Unfortunately he does not build as many libraries as come with the standard openCV build. I added a new target to jonmarimba's project for opencv_world which is the target used in the standard openCV release for converting into a framework. Once that was built I used it as a drop in replacement for the static library in the framework file structure generated by the standard openCV release.
The framework I created can be downloaded here. It works perfectly for me as a drop in replacement for my previous opencv2.framework. I did notice however that jonmarimba has not converted the targets for opencv_videostab, opencv_stitching, or opencv_nonfree. It is possible that if you use one of those libraries my framework will not work for you. If that is the case let me know and I can try to set those up as targets in the xcode project for you.
Update
To compile for other architectures, change the target architecture in the included xcode project to whatever you like for the opencv_world library. After you build it, go find the library you just built. Rename the opencv_world library to opencv2 and replace the library file found in the .framework with opencv_world.
Update2
OpenCV 2.4.3 now compiles with armv7s support by default so these solutions are outdated.
Clone the Xcode project for opencv and update the opencv git submodule as per the README:
https://github.com/jonmarimba/OpenCV-iOS
Check the build settings, make sure iOS6 and armv7s are present. Click build. You should now have the armv7s compatible .a files. I just tried this:
$ file libopencv_core.a
libopencv_core.a: Mach-O universal binary with 2 architectures
libopencv_core.a (for architecture armv7): current ar archive random library
libopencv_core.a (for architecture cputype (12) cpusubtype (11)): current ar archive random library
The last entry is for armv7s as per my research so far.
Edit: The last entry is indeed armv7s. I ran the Xcode's own lipo info command:
$ xcrun -sdk iphoneos lipo -info libopencv_core.a
Architectures in the fat file: libopencv_core.a are: armv7 armv7s
You can always just not target armv7s, and only target armv7. Your application will still run fine on the iPhone 5, it just won't be fully optimized for the new instruction set.
Simply, I cloned source from here and build with this tutorial.
Then I got opencv2.framewok that works with armv7, armv7s and simulator.
Stating the obvious, you will need to recompile and rebuild the library openCV.framework and target it for armv7s.
Adjust the library "project settings" and "target settings" before rebuild. good luck!
Probably its possible to build it with CMake. I had one year ago a problem with a medical library I wanted to build for iOS. I could handle that with CMake.
Perhaps this link can be a starter.
http://computer-vision-talks.com/2010/12/building-opencv-for-ios/
Good luck!
Pass -DCMAKE_OSX_ARCHITECTURES="armv6;armv7;armv7s;i386" to cmake when compiling OpenCV library/framework for iOS.

xcode invalid archive in organizer

i get message during archive validation. i've tried most of solutions from other questions. but still failed. (It was ok when i submit it last time in xcode 4.02, then i get rejected. i edited some image and .m file(not project settings).
my project Build settings:
Architectures->standard (armv7) - $(ARCH_STANDARD_32_BIT)
Base sdk->Latest ios(ios 5.0)
valid Architectures armv6 armv7 arvm7f armv7k
Build active architecture only->no
ios deployment target: ios3.0
i've tried reinstalling xcode and make sure unix is checked, 5 times.
i've tried install back to xcode 4.02, but the same message as xcode 4.2
i've tried reinstall cocos2d
i've tried to set the llvm/gcc to gcc only
warning message 1:
Project Clean-Up Outdated settings should be updated.
when i click it. one is to set gcc to llve-gcc, another is to 'Enable compiler warning for missing Function Prototypes. ' I clicked cancel
warning message 2:
Check dependencies
[BWARN]warning: iPhone apps with a deployment target lower than 4.3 should include an armv6 architecture (current IPHONEOS_DEPLOYMENT_TARGET = "4.1", ARCHS = "armv7").
warning 3:
Validate /Users/lifesucks/Library/Developer/Xcode/DerivedData/FishvsBirdsLite-frctqlpldaogcjebgvxkvvmsehie/ArchiveIntermediates/FishvsBirdsLite/InstallationBuildProductsLocation/Applications/FishvsBirdsLite.app
cd "/Users/lifesucks/my app/Fish vs Birds/FishvsBirdsLite"
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
setenv PRODUCT_TYPE com.apple.product-type.application
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/Validation /Users/lifesucks/Library/Developer/Xcode/DerivedData/FishvsBirdsLite-frctqlpldaogcjebgvxkvvmsehie/ArchiveIntermediates/FishvsBirdsLite/InstallationBuildProductsLocation/Applications/FishvsBirdsLite.app
2011-06-14 01:30:10.948 Validation[8609:607] *** Warning: Defaulting to the standard codesign tool
warning: iPhone/iPod Touch: application executable is missing a required architecture. At least one of the following architecture(s) must be present: armv6 (-19033)
Unable to validate your application. - (null)
warning: There is no codesign_wrapper executable. Please reinstall the Xcode developer tools. (-19058)
Unable to validate your application. - (null)
the error message in organizer is:
the archive is invalid. /var/folders/H5/.../app.ipa does not exist.
I actually don't know why, but it works now. I reinstall back to xcode 4.0.2. then recreated a project, copied over all my classes. i assume that the problem is 'Architectures->standard (armv7)', in xcode 4.0.2 the Architectures is standard armv6/armv7, maybe it's because of cocos2d compatibility to the new version i don't know. anyway if you encounter the same problem, just install back to non-beta and create a new project (since the original setting of 'Architecture' will be modified to 'armv7 standard'. ) hope it helps.
This happened to me when I updated to Xcode 4.2. I went back to the latest non-Beta Xcode version to fix it. The key is, when uninstalling Xcode, you must do it via the following command in Terminal:
sudo /Developer/Library/uninstall-devtools –mode=all
This takes a few minutes. But when it's done, install the non-Beta Xcode (4.0.2 at this time), and then RESTART before using it. Worked for me.
Remove iphoneossimulator from supported platforms for the distribution/release build configuration. That is if you have it.
You cannot have that for distribution, it is only for your debug configurations.
Check the image below for distribution configuration (ignore release config).