GDB: Program received signal "SIGABRT"
I'm running a problem with a few things according to the Build log, please could you shed light on the possibilities that these errors could be caused by. All help is appreciated.
Summary of project:
I have two projects which i have taken some .h, .m and .a files from one project folder, dragged them into the other project, then going through
Menu > Project > Add to project I have imported them into the Static Library of the project.
Some lines of code I have blanked my details out for privacy.
Here are the errors I'm getting...
found branch-22 without store in _SOGLH
found branch-22 without store in TrackerInterface::InstantiateTracker()
ld: warning: ignoring file /Users/myname/Desktop/*projectname*/*It's_a_dot_A_file*.a, file was built for archive which is not the architecture being linked (armv7)
I'm relatively new to Xcode so I'm not confident with some of the terms so please bear that in mind.
King Regards,
R.
For the last error, it is quite self-explanatory: you are trying to include a library (.a) file that has been built for a different architecture.
Probably a library that has been built for OSX-32bits or OSX-64bits and that you are trying to use for iOS (which uses architectures armv6 & armv7).
Rebuild the library for the correct architecture (armv7) of if it is a third-party library, use the appropriate .a file for the appropriate architecture.
Related
I am trying to build an App using the GData static library libGDataTouchStaticLib.a
I have made all the appropriate linkings in my project settings and have copied GDataXMLNode.h and GDataXMLNode.m to my project.
I am receiving the error below. Can someone help me understand what this is?
ld: duplicate symbol _kGDataXMLXPathDefaultNamespacePrefix in
/Users/myUser/Library/Developer/Xcode/DerivedData/GData-edmqtrniowvhfjgfgngtlfxttvri/Build/Products/Debug-iphoneos/libGDataTouchStaticLib.a(GDataXMLNode.o) and
/Users/myUser/Library/Developer/Xcode/DerivedData/MyApp-grzimbvctfmwhmdluxbuxmskcvzy/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/armv7/GDataXMLNode.o for architecture armv7
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1
You shouldn't have to copy in GDataXMLNode.h and GDataXMLNode.m to your project. I believe the reason you are getting the duplicate symbol error is because the libGDataTouchStaticLib.a library already contains the compiled GDataXMLNode.m class.
I am currently using the GData library in a project I am working on, and got it set up by using these instructions: http://hoishing.wordpress.com/2011/08/23/gdata-objective-c-client-setup-in-xcode-4/, so this answer assumes that you have the same setup. However I have used a slightly different way of importing the headers that was suggested by one of the comments on the above blog.
In your Xcode project remove the GDataXMLNode.h and GDataXMLNode.m files, and make sure that the GData.xcodeproj project is linked into your project the same way as in the above blog, but do not drag the headers directory to your source tree. Add these arguments to the Debug and Release Header Search Paths of your current target instead:
/usr/include/libxml2
${BUILT_PRODUCTS_DIR}/Headers
You can find this under the Build Settings tab of your target. The second argument will import all the GData headers into your project if you have set up the GData.xcodeproj file correctly. Once you have done this you should be able to import the various GData classes including GDataXMLNode.h class wherever you need it by typing this at the top of the appropriate class:
#import "GDataXMLNode.h"
Much credit goes to Kelvin's blog for his great tutorial. Hope that helps!
I have an existing iPhone application, and I just wanted to make a static library out of the code, so that I can use it by a separate test application (within the workspace). The application compiles fine, but when I try to compile the library version (which has the same code files) I get the following error:
Lexical or Preprocessor Issue - "MyClass.h" file not found
However, the application still runs, even through there is this error. In fact when I compile the application (which uses the static library) it initially says no errors, and then after a second or two the above mention error then appears.
I'm basically doing:
Create a new target in the project using the Coco Touch Static Library
Add the .m files in the targets "Compile Sources"
Adding the .h files in the targets "Copy Headers"
Adding the same set of libraries in the "Link binaries with libraries"
Go into the Profile and modified the Target to be RELEASE
Any suggestions? Am I missing a step here?
I'll have a stab at this :-) I think it might be that MyClass.h has been set to private. Thus it is not added to header directory when you create the static library. You should check to see if this is so by checking the output header directory. If the header file is missing, then it's pretty sure thats whats going on.
Secondly, why use a seperate app for testing and therefore require building a static library at all? I have several static libraries and apps which I unit test with GHUnit. I do it by simply adding a new app target and configuring it to run the GHUnit iOS app. I can then add the classes I want to test and any testing frameworks such as OCMock without having to create separate projects. Basically it sounds like your testing methodolody is perhaps more complex than necessary. :-)
So, the issue turned out to be I had "-ObjC" set in the "Other Link Flags" option, which I'd put there as at one stage trying to get things working I read this was required - Dereks advice to review the compilation log worked well here
The documentation states that "This project compiles to a static library which you can include, or you can just reference the source files directly."
Here's what I've done. I've downloaded it from GitHub and unzipped it. Here are the classes I can see.
Now which file among these is the 'static library' that I should import into my project?
Additionally, if I just want to reference the source files, should I just copy the .h/.m files in Classes into my project? I tried doing that but throws the following error when I try to build it:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CALayer", referenced from:
objc-class-ref in AQGridViewCell.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
Can any one show me how to set this up?
You may try to add the QuartzCore framework to your target.
All you need to do is add the class files to your project. Use the AQGridView.xcodeproj just as a reference to see how it uses the classes. It is actually a very friendly to use library of classes.
Once you added the class files to your project, when you create a new viewController, just follow the setup. Make sure you use the delegates for it and if you want to modify the gridViewCells just extend the AQGridViewCell class.
Also, as #FoJjen mentions, make sure you add the QuartzCore.framework to your project
First, add the classes. Then attach the library QuartzCore from Build Phases->LinkBinary with Libraries.
That's all.
Wasted 1-2 hours myself so wanted to share it with others
I see two possible ways of achieving this (tested on Xcode 4.5)
First way - Proper referencing
Ensure no other Xcode instance is open. Drag the Xcode project file (from Finder) into your project (into Xcode explorer window).
Click on your project in the explorer window, go to Build Phases, under Link Binary with Libraries, add "libAQGridView.a" and QuartzCore.framework
You should be all set. Just remember to include the necessary header files when you use it
Second way - Copying classes
You can have a look at the samples. It's merely copying the source code into the project (as opposed to linking it as a static library)
I just started programming in Xcode and I'm trying to write an iphone application. I started out with a simple template for Iphone development and took it from there. Now I would like to build a command line tool (for converting data) which reuses some of the classes in my iphone project. I managed to add a new target 'convert', link the appropriate source code to the target, make the target dependent on the main target. Everything builds, so far so good, but it does not generate the right executable, it will build only build/Debug-iphonesimulator/convert which is not runnable from the command line (I'm guessing because it is not linked with the right libraries).
~/Documents/XCode/SQLiteTutorial> ./build/Debug-iphonesimulator/convert
dyld: Symbol not found: _OBJC_CLASS_$_NSCharacterSet
Referenced from: /Users/marc/Documents/XCode/SQLiteTutorial/./build/Debug-iphonesimulator/convert
Expected in: /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
in /Users/marc/Documents/XCode/SQLiteTutorial/./build/Debug-iphonesimulator/convert
Trace/BPT trap
Is this possible with xcode at all? I'm not sure what kind of extra information you would need to answer this question, so let me know what to provide, if anything.
Kind regards,
Marc van Kempen.
What if you simply created a different project entirely and then dragged in the relevant classes you wanted to reuse, but instead of copying them, merely used references to them? Just don't select 'copy items into destination's folder' option when you drag the class files into your groups & files pane. That way your CL project always uses the latest version from the main iPhone one.
Having it all in one project would no doubt be cleaner though.
iPhone SDK does not officially support building command-line tools. iPhone does not run command-line tools; at least, not without jailbreaking.
This question already has answers here:
How can I avoid "duplicate symbol" errors in xcode with shared static libraries?
(3 answers)
Closed 2 years ago.
I have an Xcode project that has a "master" static library target, that includes/links to a bunch of other static libraries from other Xcode projects.
When building the master library target for "Optimized (armv6 armv7)", an error occurs in the last phase, during the CreateUniversalBinary step. For each .o file of the libraries that is included by the master library, the following error is reported (for example, the FBConnectGlobal.o file):
warning for architecture: armv6 same member name (FBConnectGlobal.o)
in output file used for input files: /Developer_Beta/Builds/MTToolbox/MTToolbox.build/Debug-iphoneos/MTToolbox.build/Objects-normal/armv6/libMTToolbox.a(FBConnectGlobal.o)
and: /Developer_Beta/Builds/MTToolbox/MTToolbox.build/Debug-iphoneos/MTToolbox.build/Objects-normal/armv7/libMTToolbox.a(FBConnectGlobal.o)
due to use of basename, truncation and blank padding
In the end, Xcode tells that the build has succeeded. However, when using the final static library in an application project, it won't build because it finds duplicate symbols in one part of build (armv6) and misses symbols in the other part of the build (armv7).
Any ideas how to fix this?
M
I dont think that's the answer at all. It will totally work if you don't have two architectures in there. In the example given in the link, it is possible to link libraries a, b, and c into one library, and link with that.
The problem that Carl is having is that there are two different architectures in the library (arm6 and arm7) and the linker is failing to resolve them correctly.
I found the problem. Its a bug in libtool as far as I can tell. See my post for a solution:
https://binaryfinery.wordpress.com/2010/06/11/universal-static-library-problem-in-iphone-sdk/
Another fix I found is to set Architectures to "armv6". ARCHS_STANDARD_32_BIT changed from armv6 to "armv6 armv7" which aggravates the libtool bug you describe above. Obviously it won't be producing armv7 optimized binaries, but it should still work fine on iPhone 4.