I am getting a Apple Mach-O Linker Error everytime I import a file from CocoaPods.
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FBSession", referenced from: someFile
ld: symbol(s) not found for architecture arm64
I get about 12 of these, for the various Pods I use.
I am trying to build for the iPhone 5S using XCode 5.
I've been trying various solutions here on SO, but haven't got any of them to work yet.
How do I fix this Apple Mach-O Linker Error?
Just found another warning that might be interesting, I hope this leads me to the solution:
Ignoring file ~/Library/Developer/Xcode/DerivedData/SomeApp/Build/Products/Debug-iphoneos/libPods.a,
file was built for archive which is not the architecture being linked (arm64):~/Library/Developer/Xcode/DerivedData/someApp/Build/Products/Debug-iphoneos/libPods.a
If your Architectures and Valid Architectures are all right, you may check whether you have added $(inherited) , which will add linker flags generated in pods, to Other Linker Flags as below:
The issue is that the cocoapods have not been built for arm64 architecture yet thus they cannot be linked when you build them. Likely you cannot use those packages until they are updated and use that architecture. You can fix the linker error by going to project -> target (your project name) -> build settings and change architectures to standard architectures (armv7, armv7s), and valid architectures to armv7, armv7s.
Note though, this means you won't get the full power of the 64 bit processor. You said you are building for the 5s, so there may be some reason you need this. If you for some reason absolutely need that power (perhaps you are building a game), and desperately need those files, you could submit a pull request and then recompile the project to arm64 by setting those same fields to arm64 in the files you pulled from the open source projects. But, unless you really need these files to be 64 bit compatible, that seems like a bit of overkill for now.
EDIT: Some people also reported that setting Build For Active Architectures to YES was also necessary to solve this problem.
As of 2014-04-28 the setting should look something like this:
I solved this problem by setting that:
ARCHS = armv7 armv7s
VALID_ARCHS = armv6 armv7 armv7s arm64
I ran into the same/similar issue implementing AVPictureInPictureController and the issue was that I wasn't linking the AVKit framework in my project.
The error message was:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_AVPictureInPictureController", referenced from:
objc-class-ref in yourTarget.a(yourObject.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The Solution:
Go to your Project
Select your Target
Then, go to Build Phases
Open Link Binary With Libraries
Finally, just add + the AVKit framework / any other framework.
Hopefully this helps someone else running into a similar issue I had.
I also encountered the same problem , the above methods will not work . I accidentally deleted the files in the following directory on it .
Folder emplacement:
~/Library/Developer/Xcode/DerivedData/
Set Architectures to armv7 armv7s, Build Active Architecture Only to NO, for every target in the project, including every one in Pods
I fixed mine by checking the selected implementation files in the target membership on the right side. This is useful especially in dealing with extensions i.e. custom keyboards.
Here are some explanations why build_active_architecture is set to NO.
Xcode now detects which devices you have connected and will set the active architecture accordingly. So if you plug a 2nd generation iPod Touch into your computer, Xcode should set the active architecture to armv6. Building your target with the above Debug configuration will now only build the armv6 binary to save time (unless you have a huge project you may not notice the difference but I guess the seconds add up over time).
When you create a Distribution configuration for publishing to the App Store, you should make sure this option is not set, so that Xcode will instead build the fat universal binary
http://useyourloaf.com/blog/2010/04/21/xcode-build-active-architecture-only.html
This might be related to libz.dylib or libz.tbd, just have to add it to your targets for the linking binaries, and try to compile again.
You need to just remove arm64 from Valid Architecture and set NO to Active Architecture Only . Now just Clean, Build and Run. You will not see this error again.
:) KP
Solved after deleting the content of the DerivedData-->Build-->Products-->Debug-iphoneos
I solved it by setting valid archs to armv7 armv7s and setting build active architectures only to YES in release and then doing a new "pod install" from the command line
Following worked for me:
Remove all pods
cd ios && pod deintegrate
Comment this line in ios/Podfile -> use_flipper!()
Reinstall all pods arch -x86_64 pod install
Run your app :) npm run ios
Environment:
Node version: 14.17.1
RN version: 6.0.0
OS: macOS BigSur m1
Given an iPhone 5s and not yet having received a 64 bit version of a third party library, I had to go back to 32 bit mode with the latest Xcode (prior to 5.1 it didn't complain).
I fixed this by deleting arm64 from the Valid Architectures list and then setting Build Active Architecture Only to NO. It seems to me this makes more sense than the other way around as shown above. I'm posting in case other people couldn't get any of the above solutions to work for them.
I had the same problem after upgrading to Xcode 5.1 and fixed it by setting Architectures to armv7 armv7s
Had been stuck on this issue the whole day.
I had multiple Schemes, it was compiling fine for Demo, Internal, Release - however Debug scheme just would not compile and was complaining about the libPods.a missing.
The solution was to go to the Project -> Target -> Build Settings and change "Build Active Architecture Only" to YES. Clean and build! Finally hours of head itching solved!
Setting -ObjC to Other Linker Flags in Build Settings of the target solved the problem.
This worked for me:
ios sdk 9.3
into your build setting of app.xcodeproj
valid architecture: armv7 armv7s
Build Active architecture : No
Clean and build , worked for me.
If you faced this issue on your Flutter project while building in Release mode (or Archive) check out my this answer: https://stackoverflow.com/a/61446892/5502121
Long story short:
set your build system to New Build System in File > Project Settingsā¦
remove ios and build_ios folders
run flutter create . to init new ios module
run pod install
run flutter pub get
check your Xcode build config (it should be Release mode and General iOS Device)
and you're good to go
The following worked for me to get GPUImage compiling without errors on Xcode 5.1 for both the 64-bit simulator and retina iPad Mini, without needing to remove arm64 from the Valid Architectures list (which defeats the purpose of owning a 64-bit device for testing 64-bit performance).
Download the .zip folder from the GitHub page: https://github.com/BradLarson/GPUImage
Unzip, and navigate to the 'framework' folder. From here, add and copy the 'Source' folder into your Xcode project. Ensure 'Copy items into destination group's folder' is ticked, and that 'Create groups for any added folders' is also ticked. This will copy the generic, iOS and Mac header/implementation files into your project.
If you don't need the Mac files because you're compiling for iOS you can delete the Mac folder either before you copy the files into your project, or simply delete the group from within Xcode.
Once you've added the Source folder to your project just use the following to begin using GPUImage's classes/methods:
#import "Source/GPUImage.h"
A few things to point out:
If you get an error saying 'Cocoa' not found, you've added the Mac folder/headers into your iOS project - simply delete the Mac group/files from your project and the warning will vanish
If you rename the Source folder (not the group in Xcode), use that name instead of "Source/GPUImage.h" in the #import instruction. So if you rename the folder to GPUImageFiles before you add to your project, use: #import "GPUImageFiles/GPUImage.h
Obviously ensure arm64 is selected in the Valid Architectures list to take advantage of the A7 64-bit processor!
This isn't a GPUImage.framework bundle (such as if you downloaded the framework from http://www.raywenderlich.com/60968/ios-7-blur-effects-gpuimage) so it may not the correct way to use GPUImage that Brad Larson intended, but it works for my current SpriteKit project.
There's no need to link to frameworks/libraries etc - just import the header and implementation source folder as described above
Hope the above helps - it seems there were no clear instructions anywhere despite the question being asked multiple times, but fear not, GPUImage definitely works for arm64 architecture!
This issue occurred for me after installing a pod via Podfile and pod install. After trying a bunch of different fixes I finally just imported the Pod manually (dragging the necessary files into my project) and that solved the problem.
As morisunshine answer pointed in right direction, a little tweak in his answer solved my problem for iOS8.2 .Thanks to him.
I solved this problem by setting that:
ARCHS = armv7
VALID_ARCHS = armv6 armv7 armv7s arm64
BUILD ACTIVE ARCHITECTURE ONLY= NO
Go to target Build Settings.
set BUILD ACTIVE ARCHITECTURE ONLY = NO for both Debug and Release
Build and run
In my case, I had to look for
C++ Standard Library and make sure that the libc++ was the one selected.
For me, I use opencv 2.4.9 in xcode 7.2 for iOS and the errors above occurred, and I solve the errors by using the opencv through pod install rather than offline opencv framework.
You can have a try by adding the opencv pod text below and delete the offline opencv framework if you have used.
pod 'OpenCV', '2.4.9'
None of the solutions fix this error in my case(Xcode 9), with TesseractOCRiOS. After hours of trial and error, I came up with a good solution. I just delete 'pod 'TesseractOCRiOS', '~> 4.0.0' in the Podfile, run pod install. And then, add pod 'TesseractOCRiOS', '~> 4.0.0' back to Podfile and run pod install again.
Bang! It works!
"The OPN [Debug] target overrides the OTHER_LDFLAGS build setting". This was the main issue. After adding $(inherited) in new line in other linker flags solved my issue.
in some case, if you define one more interface in a .h file, but did not implementation all these interface, this error occurred.
The linker can't found the implementation in .m file, so you need to implementation it in your .m file for every interface.
To resolve this error:
1.in .m file, supply the implementation for each interface.
2.rebuild
I faced the same issue.
My solution I found here: Why linker link static libraries with errors? iOS
Adding $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) to the library search paths fixed the problem.
This error consumed my whole day so thought of writing what really worked for me
delete .xworkspace
delete podfile.lock
delete the Pods folder/directory
"DO NOT DELETE PODFILE"
After all this, CLEAN(OPTION + SHIFT + CMD + K) --> BUILD(CMD + B) --> RUN(CMD + R)
I hope this really works for you :)
I am trying to integrate Flurry analytics 4.1.0 into my iPhone application, but I am receiving the following error when trying to build the project:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_Flurry", referenced from:
objc-class-ref in AppDelegate.o
I have followed the Flurry steps and googled the issue but everyone with a similar issue had simply forgotten to link SystemConfiguration.framework.
Below are some screenshots of my project setup.
It seems that the library libFlurry.a isn't properly added to your project. It should appear in the second screenshot.
Click on the + icon at the bottom of the Link Binary with Libraries view (second screenshot) and select the libFlurry.a file. Then build again.
Actually, you also need add the following frameworks:
CFNetwork.framework
Security.framework
SystemConfiguration.framework
I don't know why but my libFlurry.a file is located IN the pod folder named as "libFlurry_6.7.0.a". I am not sure whether I am being stupid here, but just in case someone like me don't know where to look for it...
After adding it, it works.
I'm using flurry via pods:
pod 'Flurry-iOS-SDK/FlurrySDK'
pod 'Flurry-iOS-SDK/FlurryAds'
pod 'Flurry-iOS-SDK/TumblrAPI'
I had to link the libFlurryAds.a from the pods folder.
Recently, I switched to Xcode4 and when I compile my project I got following error.
ld: warning: ignoring file /Users/myname/Library/Developer/Xcode/DerivedData/appname-hezrgyqimckztgbdlslkavphdclw/Build/Products/Debug-iphoneos/libTapkuLibrary.a, file was built for archive which is not the architecture being linked (armv6)
Undefined symbols for architecture armv6:
"_OBJC_CLASS_$_TKLoadingView", referenced from:
objc-class-ref in RootViewController.o
I opened the TapkuLibrary and checked that it's Architectures set to 'Standard (armv6 armv7)'.
What can I do to fix this problem?
I figured out what caused the problem. I changed 'Build Active Architecture Only' of TapkuLibrary from Yes to No and it compiles with no problem.
I was able to solve this problem by doing the opposite of the accepted answer - I changed the 'Build Active Architecture Only' from NO to YES.
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 ;)
I met this problem when I upgraded the XCode to 4.5 and iOS to iOS6. For GMGridView, it just happened.
Not for simulator, but only for device.
I fixed this by the following steps:
1) Go to GMGridView project -> Build Settings
2) Under Setting -> Architectures, select "Standard (armv7, armv7s)"
Then clean all (including DerivedData) and rebuild.
Hope it helps!
Try to remove the armv6 architecture, and compile it only for armv7.
Something else that worked for me was making sure that all sub projects had the architecture set to be armv6 and armv7, making sure to set both the TARGET and the PROJECT of each sub project. After cleaning and rebuilding everything, it worked without a problem.
This solved the problem for me:
Some external library like three20 did extra settings for
Build Settings->Architectures->Any iOS SDK
the value is "armv6 armv7" that different from standard "armv7 armv7s"
drop down and select "Standard", it worked for me.
I managed it by clicking the "unfriendly" Project's (in my case GMGridView).
In tab "Architectures", I changed the value from something (I don't remember exactely anymore, I guess it was:) "armv7, armv6s" to "armv7, armv7".
After that it worked for me.
I managed to resolve this by just creating a adhoc configuration inside the Tapku info settings ...
XCODE 4, Project > Archive = library not found for -lTapkuLibrary - Issues - devinross/tapkulibrary - GitHub
Make sure the build variants on your projects are set to "normal".
If you are building a project which includes other projects, take a look inside the DerivedData folder for the main project. Examine the archive files with the "lipo -info yourarchive.a". Also, examine the timestamps on these archives. You may find that these libraries are not getting rebuilt or you are trying to link against an old version of the archive which is the wrong architecture.
In my case, I shutdown Xcode and deleted the DerivedData folder for my main project. This forced a full rebuild when I reopened the main project in Xcode 4. The full rebuild caused the i386 archives to be created (or the correct version to be found) & the simulator version to link correctly.
This worked for me :
Click on the offending framework's 'Project' file (xcodeproj).
Go to the "Info" tab for the framework's 'Project' (not 'Target').
Expand 'Configurations' and make sure that both 'Debug' and 'Release' have 2 configurations set--one for the framework's 'Project' and another for the framework's 'Target'. In the case of frameworks the 'Target' compiles to a Library and not an application, so it's easy to get confused.
'Debug' should have the Project set to 'Debug' and the Library set to 'Shared'
'Release' should have the Project set to 'Release' and the Library set to 'Shared'
Compile, run, and enjoy.
If you ended up mangling your entire project trying to figure this out, then you might want to double-check your Application's Project build phases (as Gon suggested). The Library should be there highlighted in red, even if it doesn't exist on your drive. If not, as long as it's set to 'Shared' you should be able to add it back again.
If you really really really mangled your project, then you may be forced to blow out your DerivedData folder, as russes suggested. Also, check the 'Organizer', since Xcode has a way of saving crap all over the place.
Oh, and you checked to make sure that 'armv6' is there right? :)
If I get the ignore file warning - I would run lipo -info on ignored file to find it's architecture as below
lipo -info libTapkuLibrary.a
That would print either of i386, armv6, armv7, armv7s, x86_64 etc. In general, that architecture has to match with your target build platform. E.g.
i386 = ios simulator or 32 bit build on mac os x
armv6 armv7 arm7s = ios device
x86_64 = 64 bit build on mac os x
Depending on the mismatch, either you have to rebuild your library for your target platform or change your target platform.
Note: For fat binaries, lipo -info will print a combination of above architectures.
I fixed this problem thanks to another thread where they show that armv6/armv7 is actually a little different than what you think it is: Upgrading to xcode 4 error No architectures to compile for
None of these answers worked for me. (Similar warning message, different static library project). For me it was having configured XCode to honor the build directories of the targets and then having targets build in a local build/ directory that caused the problem. Configuring XCOde to use "Derived data" folder fixed it.
I had this problem with the Three20 library. The thing that finally did it for me was switching the Project Format from Xcode 3.1 to Xcode 3.2 - leaving 'build active arch only' as "no".
I tried all the options above and none worked.
This is the right answer:
simply dragging a framework in your project won't link it properly (or something along these lines, in any case)
what you need to do is select the framework you want to add in Build Phases (click on your project's blue icon, then select your project's name under Targets, then the tab Build Phases), see here for more reference.
Had the same problem, and tried diverse solutions from the page to no avail.
I still had a message telling me my library was not build for arm64.
Finally how I resolved it :
opened the project.pbxproj for the library in a text editor
searched for VALID_ARCHS
there were 4 occurrences, 2 of which did not contain arm64
I manually added arm64 in the chain (VALID_ARCHS = "arm64 i386 armv7 armv7s")
rebuild the lib and it was all right
Seems sometimes the build settings displayed by XCode is incomplete, and doesn't correspond precisely to the make file.
I've been reading through this tutorial for using a SQLite database within an iPhone app. This is great and I've got everything working nicely, in the Simulator. As soon as I build to device I get the following linker errors:
ld: warning: in
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libgcc_s.1.dylib,
missing required architecture arm in
file ld: warning: in
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libSystem.dylib,
missing required architecture arm in
file ld: in
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libobjc.A.dylib,
missing required architecture arm in
file collect2: ld returned 1 exit
status Command
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2
failed with exit code 1
I've tried including different versions of the libsqlite3.0.dylib files as mentioned around this site and other message boards but it doesn't make anything any different (and yes, I have tried cleaning).
If anyone has had a similar issue, how do you get around this?
It looks like you are linking against "Current OS" as SDK. You should select an iPhone SDK in your build settings.
Edit:
Alternative you have selected a library in a different SDK than your current.
The solution to this was very bizarre, and I'm not entirely sure what I've done by removing it... However, this is what I did...
Under the target build settings, I noticed in the "Search Paths" section that under "Library Search Paths" the following was set:
"$(inherited)"
"$(DEVELOPER_DIR)/SDKs/MacOSX10.6.sdk/usr/lib"
"$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/usr/lib"
"$(SRCROOT)"
I checked this with applications that I had created before iPhoneOS 3.1.3 was released and it was blank. By removing the above, my application built and compiled straight away...
Very strange. Thanks goes to Claus Broch for getting me 50% of the way there!