I'm using Xcode 4.6 and I've been writing some Unit Tests for an iOS app. I've tried to do some code coverage following from this tutorial: http://supermegaultragroovy.com/2005/11/03/unit-testing-and-code-coverage-with-xcode/ .
I've followed the 3 steps for my AppTests Target:
Check “Generate Test Coverage Files”
Check “Instrument Program Flow”
Add “-lgcov” to “Other Linker Flags”
The problem is that if I hit "Test" I get this error:
ld: library not found for -lgcov
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How can I fix this?
I think it's caused by your xcode version. Apple remove the library code-coverage needed after xcode 4.3. You need to add one file to your project manually. You can see check this blog for more details: http://www.gerardcondon.com/blog/2012/02/21/code-coverage-updates-for-xcode-4-dot-3/
You can try this. I tried but failed since my project include C++ code. I think that's because xcode 4.6 has not supported this feature...
Related
I'm trying to import Firebase into my iOS app. I followed this tutorial for doing this manually with Objective-C (as opposed to using CocoaPods).
http://www.mokacoding.com/blog/setting-up-firebase-without-cocoapods/
When I try to build my project, I get the following errors:
"Apple Mach-O Linker Error"
"Linker command failed with exit code 1 (use -v to see invocation)"
I'm familiar with the Linux CLI (less so with Macs), but I don't understand how to apply the -v flag to XCode's build process to get more info.
I've been Googling this for the last 3 hours, but every answer I find seems to be directed at users who weren't using an XCode workspace with CocoaPods.
I don't have CocoaPods installed, so I don't think this is my issue. Despite that I have converted my project and properly imported it into an XCode workspace, this still didn't solve my problem.
My app is a Swift project, and I have imported the modulemap, firebase.h, and googleServices.plist files.
I've also made my Header and Library search paths recursive for the entire project folder in an attempt to fix this.
Here's my project navigation. Although at this point I suspect it's some kind of build setting that isn't correct.
Some selected answers I've tried to apply without success:
Apple Mach -O Linker command failed
In Xcode how do I create a new workspace and add 1 project to it so that I can see the project and its files?
Framework not found GoogleToolboxForMac
Adding system header search path to Xcode
https://github.com/firebase/firebase-ios-sdk/issues/258
Apple Mach-O Linker & Ditto Error - Xcode 8
https://github.com/invertase/react-native-firebase/issues/198
https://forum.ionicframework.com/t/ios-xcode-8-apple-mach-o-linker-ld-error-group-in-xcode/89903
Upgrading to xcode 9.2 fixes this. It appears to be an issue with earlier versions not properly handling linking.
Which is misleading b/c the firebase documentation indicates it's compatible with xcode 8. But I think that's assuming you use cocoapods. If you don't, and instead try to link the obj-c frameworks you need xcode 9+
Once I knew how to examine the more verbose linking error, googling for x86_64 led me to some helpful answers.
This and other answers helped me investigate upgrading.
ld: framework not found Stripe for architecture x86_64
I am trying to add RMQClient framework to my XCODE 7.3 project.
I am following the steps as specified in https://github.com/rabbitmq/rabbitmq-objc-client as well as in the RabbitMQ official site.
After adding the framework and running Tools->Build I am receiving
ld: framework not found RMQClient
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error messages and can't import any of the header files from the framework.
Any suggestions for this issue?
Copying the framework package to the Project tree on Xcode solved the problem.
remember to make sure the framework is also linked and files are copied in the Build Phases section
Has anybody used chatboost with unity 5 on IOS? I get a linking error and a warning
warning: directory not found for option '-L/Users/alexm/Downloads/iosFree/LibrariesPlugins/iOS'
ld: library not found for -lChartboost
clang: error: linker command failed with exit code 1 (use -v to see invocation)
On the Android everything is fine. Do I have to do anything extra other what i mentioned on chartboost integration page?
Make sure that if the Chartboost plugin is using some PostprocessBuildPlayer stuff, that is isn't getting clobbered by a different script.
If, in XCode, you check the build phases tab for linked frameworks and you don't see Chartboost.framework, it's likely the build script not running correctly.
I'm having a issue compiling my app for Simulator. In the device runs perfectly but once I tried it to compile in simulator I get the following error:
ld: building for iOS Simulator, but linking against dylib built for MacOSX file '/Applications/Xcode.app/Contents/Developer/Library/Frameworks/XCTest.framework/XCTest' for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I checked before posting this question, but the answers I found in stackoverflow, like to run this,
export PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH
or
The problem was that Xcode 5 replaces gcc with clang and adds in a "-triple" option that specifies OSX as the target. If you pass "-miphoneos-version-min=7.0" on both gcc command lines it works. You can see the clang command line if you pass "--verbose" to gcc. It's also necessary to add to the PATH for Xcode 5 so that cmake can find the necessary tools: export PATH=/Applications/Xcode5-DP6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode5-DP6.app/Contents/Developer/usr/bin:$PATH None of this is official.. but works for me so far.
I dont really understand how to to do this. Any help, please?
Check Build Settings for your test target. This values should look similar:
If you have any escaped symbol, consider to fix it. I had here : \". I just removed them
Also notice: order is important!
P.S. from GraehamF It's always a good thing to Build -> Clean and restart Xcode, so the changes to take affect
When I faced this error with an XCode project, I open the file ???.xcodeproj (in a SubLime Text editor) and removed the below lines. The warning will no longer be there!
LIBRARY_SEARCH_PATHS = (
"\"${PROJECT_DIR}/../../../../../usr/lib\"/**",
"\"${PROJECT_DIR}/../../../../../usr/lib\"/**",
);
I am setting the cocoapods dependency management tool for iOS project, when building my project i got this error:
ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am using Xcode 4.5 and Mac OS X Lion 10.7.4. Thanx in advance.
Can't comment yet, so posting as an answer.
It would help to have a bit more information on what you did to setup cocoapods, library settings in XCode and whether this is your first time using cocoapods or if the issue suddenly started. Try to give us a good idea of the details of your current situation.
For the time being, a little googling popped up this URL: https://github.com/CocoaPods/CocoaPods/issues/155
You might find it helpful, specifically the post near the bottom:
In my environment the issue was that the Pods project did not have a
target called ADHOC (as per the main project). I duplicated the Pods
release target, called it ADHOC, changed the OS Deployment Target to
my requirement (5.0) and then everything worked.