ImageIO linker error? - objective-c

Trying to ready metadata (e.g kCGImagePropertyExifBodySerialNumber or kCGImagePropertyExifLensModel) from images using ImageIO framework.
Unfortunately during the compilation linker has a trouble:
Undefined symbols for architecture x86_64:
"_kCGImagePropertyExifBodySerialNumber", referenced from:
-[AppDelegate applicationDidFinishLaunching:] in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ImageIO/CGImageProperties.h is of corurse imported, and ImageIO.framework is included on the list "Linked Frameworks and Libraries" in target configuration.
It happends only when I'm trying to use kCGImagePropertyExifBodySerialNumber or kCGImagePropertyExifLensModel. It the same project kCGImagePropertyExifFocalLength, kCGImagePropertyExifExposureTime are used without any problems
Any ideas ?

Those constants seem to not be defined in the SDK versions of the ImageIO framework. You can check this yourself with the following command:
nm /Volumes/Applications/Developer\ Tools/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ImageIO.framework/imageio | grep -F kCGImagePropertyExifBodySerialNumber
(Edit the path to Xcode as appropriate.)
I'm on a Lion machine at the moment, and the system version of the same framework does have it:
% nm /System/Library/Frameworks/ApplicationServices.framework/Frameworks/ImageIO.framework/imageio | grep -F kCGImagePropertyExifBodySerialNumber
00000000000e4898 s _kCGImagePropertyExifBodySerialNumber
So, I suggest filing a bug and then, as a workaround, unsetting SDKROOT (“Base SDK”) in your project's build settings. With no SDK set, it should use the frameworks and headers of the system you're building on.
The downside of that workaround is that if you're using anything introduced on Mountain Lion, you won't be able to build on Lion.

Related

iOS manually exporting library causes issues

I made a library and I want to test it in a dummy project I made. Both projects are made in Objective-C. When I build my library I get a Successful Build message and three files under the Product directory:
FooIOS.bundle
libFooIOS.a
include
I place these three files at the root level of my dummy project and when I open my myDummyProject.xcworkspace file I see them in my project hierarchy. However, when I build my project I get the following error:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_FooSelectedPageViewController", referenced from:
objc-class-ref in libFooIOS.a(FooViewController.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I did away with some of the obvious checks:
Made sure to reference my external library
I also made sure that both my library and project architectures are set as armv7 arm64
I don't know what else to do. I may be missing another configuration step or it may even be the way I declared something in my library that doesn't conform with my dummy project. Or a discrepancy between projects, perhaps? Any hints or leads would be a great help. Thanks.

Xcode 6.4 Framework

I cannot seem to find the solution to this problem. I created a new custom framework in Objective-C and when I included it in a sample project, I am getting the following messages/errors on compilation:
ld: warning: ignoring file /Users/location/CustomFrameworkAPI.framework/CustomFrameworkAPI, missing required architecture x86_64 in file /Users/location/CustomFrameworkAPI.framework/CustomFrameworkAPI (2 slices)
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_CustomFrameworkAPI", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
When I checked the architecture of the framework, I'm seeing that x86_64 is part of the custom framework that I have built. Can someone tell me what the problem is?
MacBook-Pro:CustomFrameworkAPI.framework user$ file CustomFrameworkAPI
CustomFrameworkAPI: Mach-O universal binary with 2 architectures
CustomFrameworkAPI (for architecture armv7): Mach-O dynamically linked shared library arm
CustomFrameworkAPI (for architecture arm64): Mach-O 64-bit dynamically linked shared library
I believe the error that you posted says that the framework you are using CustomFrameworkAPI referred in ViewController is not built in such a way that it supports 64-bit environment.
Kindly check your framework's architecture on which it is built upon.
Use lipo command to check the architecture of the framework.
This might not be the exact solution or answer to your problem.
Thanks.

Undefined symbols for architecture armv7s dealing with Appboy iOS integration

I am trying to integrate appboy into my Xcode 5.1.1 project. I have followed all the steps on their SDK integration page found here: http://documentation.appboy.com/SDK_Integration/iOS. I was able to successfully install the pods, but when I try to compile and run my project I get the following errors:
Undefined symbols for architecture armv7s:
"_OBJC_CLASS_$_Appboy", referenced from:
objc-class-ref in CAppDelegate.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The code causing this issue it the code to upgrade the app delegate found in CAppDelegate.m under the method application:didFinishLaunchingWithOptions:
[Appboy startWithApiKey:#"(I PUT MY API KEY HERE)"
inApplication:application
withLaunchOptions:launchOptions];
Make sure that your app target includes "$(inherited)" if it is overriding any of the settings of Pods.xcconfig. You can check this under Build Settings >> Your App Target >> Other Linker Flags.
If you need any additional support on this issue, feel free to contact support#appboy.com.

ObjC Lbrary Usage: Undefined symbols for architecture armv7

I have XCode library I wrote which I use inside Unity3D application.
The library works and now I need to make a change in the implementation, not the interface.
The problem is that in the XCode project created from Unity3D, when I use my library .a file I get this error (I've remove the specific class names).
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_ABNUnityativeController", referenced from:
_OBJC_CLASS_$_ABUnityNativeController in libABSDK_Unity_NativeController_iOS.a(ABUnityNativeController.o)
"_OBJC_METACLASS_$_ABNativeController", referenced from:
_OBJC_METACLASS_$_ABUnityNativeController in libABSDK_Unity_NativeController_iOS.a(ABUnityNativeController.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm pretty sure the problem is how I compile my library.
I find that my project settings were bad.
When I choose the main project (I also have sub XCode project in it) inside Build Phases -> Link Binary With Libraries I had to add my sub-project which was listed under Workspace directory.

Compiling libjpeg for iOS

I am trying to compile a project for iOS 6 in XCode, and I am using the following headers, which include the functionality I need:
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
#include "transupp.h" /* Support routines for jpegtran */
Those are straight out of jpegtran utility sources. I have installed the jpeg library before, and there is libjpeg.a in my /usr/local/lib/.
However when I try to compile, I am getting an error "Undefined symbols for architecture i386" or "Undefined symbols for architecture armv7", depending on whether target is an iPhone simulator or not.
Here are the keywords it can't find symbols for:
"_jpeg_stdio_src"
"_jpeg_finish_compress"
"_jcopy_markers_execute"
"_jpeg_copy_critical_parameters"
"_jtransform_adjust_parameters"
"_jpeg_destroy_compress"
"_jtransform_execute_transform"
"_jpeg_finish_decompress"
"_jpeg_read_header"
"_jtransform_request_workspace"
"_jpeg_write_coefficients"
"_jpeg_read_coefficients"
"_jpeg_destroy_decompress"
"_jpeg_stdio_dest"
"_jcopy_markers_setup"
I have encountered the missing symbol errors before, and always ended giving up on using 3rd party libraries, but in that particular case there's no way around.
What am I doing wrong here?
EDIT: I have added libjpeg.a to project settings and it did go further, but stopped now at:
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: i386-apple-darwin12.2.0
Thread model: posix
"lots-of-debug-paths"
ld: library not found for -ljpeg
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I recently needed libjpeg for iOS too (as a dependency of another third party library)
I ended up simply using the libjpeg-turbo, which comes with a precompiled fat binary
Architectures in the fat file: libjpeg.dylib are: i386 x86_64 armv6 armv7 armv7s arm64
I dunno how you compiled it. But you need to change the make install in order to compile it in i386 and armv7. I'm pretty sure you just run the make, so it compiled it for you mac, which is certainly a x84_64 arch, and this is certainly not what you want
You can check with
lipo -info /usr/local/lib/libjpeg.a // if libjpeg.a is at this path
or
file /usr/local/lib/libjpeg.a