Struggling with Xcode 4 - frameworks

I've recently downloaded Xcode 4 and now two of my projects that were working perfectly fine before have started giving me errors. Both errors are effectively to do with linking options, but I can't figure out how to change these options and get rid of the errors.
The first problem is with a project written in C++ using the SDL_ttf and SDL_image frameworks. The project builds correctly, but when I try to run, it gives me the following warnings on the console:
warning: Unable to read symbols for #executable_path/../Frameworks/SDL_ttf.framework/Versions/A/SDL_ttf (file not found).
warning: Unable to read symbols from "SDL_ttf" (not yet mapped into memory).
warning: Unable to read symbols for #executable_path/../Frameworks/SDL_image.framework/Versions/A/SDL_image (file not found).
warning: Unable to read symbols from "SDL_image" (not yet mapped into memory).
Since the files are not being found, the executable cannot load any images making it exit straight away when I try to load images. I think the issue here is that the frameworks are not in the directory above the executable, they are in /Library/Framework/ which worked fine before in Xcode 3.2. How do I resolve this?
The second problem comes when compiling an application I wrote for iOS. Along with giving me a bunch of warnings about depracated code on iOS 5, which I will deal with later, it fails to build due to a linker error which I have no clue how to resolve, it says:
ld: library not found for -lz.1.2.3
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1

I can answer the second question.
-lz.1.2.3
should be
-lz
You might have accidentally added the zlib.1.2.3.dylib to the project's "link binary with libraries" build phase. You should use the standard zlib without any version in its filename, or simply add -lz to the Other Linker Flags under Build Settings and not add zlib in the "link binary with libraries" build phase.
As for the missing frameworks my best guess is that it has to do with the relative path, ie if you can get rid of the /../ part and instead provide an absolute path that might resolve the issue.

Related

Raspberry PI cross compilation linking error - unknown symbol _dl_hwcap

I have successfully set up a cross-complation environment for my RPI under 64 Bit ubuntu. I can compile and run a personal project using gstreamer just fine.
Due to performance-issues with gstreamer, I want to work on a fork of omxplayer. I adapted it to my environment, and compilation of ffmpeg and omxplayer themselves work just fine.
However, linking an actual executable (ffmpeg, or omxplayer.bin) yields a linking error I have been unable to resolve.
You find the full output of the last failing linking-step with verbose flags here:
https://gist.github.com/deets/3bba7c94017405d28f81
The error message is
ffmpeg_compiled/usr/local/lib/libavcodec.so: undefined reference to `_dl_hwcap'
collect2: error: ld returned 1 exit status
The missing symbol to me suggests something with dynamic loading. Maybe the libc or libdl are botched? But how come these are working just fine if compiling another project?
Found the culprit. When setting up the crosscompilation-environment, make sure your copy of the RPI's libraries are correct. I had unresolved symbolic library links that needed fixing in my rsync'ed copy of the RPI's file-system.

Correct way to use a private library in objective c?

I downloaded a collection of private libraries from this link. When I click download I get all frameworks. So these are only header files not the .framework files that are available in Xcode. So I linked them by the usual method of going to build phases, in it I go to link binary with libraries click on + and choose the header files from a framework (preferences framework in my case). After these files are added to my project I try to make an object from one of the libraries and try to call their instance methods. When I try to execute this program I get this error. I get this whether I run it on the device or simulator.
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_DevicePINController", referenced from:
objc-class-ref in UAViewController.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1
(use -v to see invocation)
DevicePinController is a part of a private framework preferences.h.I am trying to make an object of it UA
EDIT: I tried using other framework headers such as bluetooth and I get this error in all.
EDIT: I tried adding the entire framework to the project instead of adding individual header files.Now the error is
d: framework not found BluetoothManager
clang: error: linker command failed with exit code 1 (use -v to see invocation)
You'll need to actually build the framework. You can't just link against a header file; that doesn't make sense.
Try adding all the .m files in the Preferences folder as Compile Sources, and remove the header file from Link Binary with Libraries.
Added: I realize now this answer is incorrect. The files OP is trying to use are not a library, but header files from Apple's private frameworks. Here's a related answer: https://stackoverflow.com/a/13388225/893113

Error running Simulator: duplicate symbol for architecture i386

I added ShareKit framework to try and here is the error running it in Simulator:
duplicate symbol _LFHRReadStreamClientCallBack in
.../Xcode/DerivedData/....build/Objects-normal/i386/LFHTTPRequest-8C6F35228BA446B9.o
and
.../Xcode/DerivedData/....build/Objects-normal/i386/LFHTTPRequest-8ACF920D803FDCA6.o
for architecture i386
I looked at previous posts Build Error - missing required architecture i386 in file and tried to edit project.pbxproj commenting FRAMEWORK_SEARCH_PATHS lines out as well as looking for .framework files accidently added to my project but with no luck.
What else can I try?
You've included LFHTTPRequest in your project twice. It's possible that another library (such as sharekit) included it for you, doublecheck the files sharekit includes and remove one copy of LFHTTPRequest and things should compile.
This can also happen if you move coredata-generated classes into a group, like "Models" and then regenerate the NSManagedObjectModel subclasses. The generated files will be placed in the project root and added into the build twice.
I got the same error when working with TessBaseAPI. I had two c++ files and both had the following declaration:
namespace tesseract {
class TessBaseAPI;
};
tesseract::TessBaseAPI *tesseract1;
uint32_t *pixels;
The I read the full error message. I got a line there:
duplicate symbol _tesseract1 in
And later, which files contains the duplicate also included (the file name).
So, I changed the instance name as follows:
namespace tesseract {
class TessBaseAPI;
};
tesseract::TessBaseAPI *tesseractNew;
uint32_t *pixelsNew;
That solved my problem.

mpglib_interface.c 'interface.h' file not found

I an trying to compile the WunderRadio app source code available here http://dev.wunderground.com/support/wunderradio/wunderradio.1.9lgpl.zip. After making all the modifications to the project to compile on iOS5 i get the following error:
Lexical or Preprocessor Issue 'interface.h' file not found.
Of course i tried getting the interface.h from the lame library that i previously downloaded, and added it to the project with no luck. Apparently its not the right file.
What am i missing ?
I found this file at:
http://code.google.com/p/live-converter/source/browse/trunk/include/interface.h?r=13

ACE TAO Corba Ubuntu 10.4 undefined reference to CORBA::Object::_refcount_value()

I am having a few problems getting the example programs that come with the libTao provided in the package manager. I have used ace tao in the past with windows so have some experience with it already.
So far I have all the environment variables set, created a new projects for the "Simple Client" example. I can compile the .idl fine. When I then try to compile the client I get a linker error ...
Building target: CorbaTest
Invoking: GCC C++ Linker
g++ -Xlinker -Map -Xlinker txt.txt -Xlinker --cref -o"CorbaTest" ./src/EchoC.o ./src/EchoS.o ./src/Echo_Client_i.o ./src/Echo_I.o ./src/client.o -lACE -lTAO -lTAO_AnyTypeCode -lTAO_BiDirGIOP -lTAO_CodecFactory -lTAO_CosNaming -lTAO_DynamicAny -lTAO_EndpointPolicy -lTAO_DynamicInterface -lTAO_IFR_Client -lTAO_ImR_Client -lTAO_IORInterceptor -lTAO_IORTable -lTAO_Messaging -lTAO_ObjRefTemplate -lTAO_PI -lTAO_RTCORBA -lTAO_RTPortableServer -lTAO_PortableServer -lTAO_SmartProxies -lTAO_Strategies -lTAO_TypeCodeFactory -lTAO_Utils -lTAO_Valuetype -lTAO_CSD_ThreadPool -lTAO_TC -lTAO_TC_IIOP -lTAO_Compression -lTAO_ZlibCompressor
./src/EchoC.o:(.rodata._ZTV4Echo[vtable for Echo]+0xe0): undefined reference to `CORBA::Object::_refcount_value() const'
collect2: ld returned 1 exit status
make: *** [CorbaTest] Error 1
I cannot find anything online with regards to CORBA::OBbject_refcount_value() to point me in the direction of a library I might be missing. I have included all the recomended libraries from here http://www.dre.vanderbilt.edu/~schmi...libraries.html and still get the same error. This is example code that should compile and link against the supplied Tao distribution. Any ideas what I am missing? Oh and im using eclipse if it makes any difference.
Thanks :)
It's possible your linker is having trouble with the library order. You've got libACE first, followed by libTAO, etc. With some linkers if libA depends on libB, then libA should some before (i.e., to the left of) libB in the link. So, since TAO depends on ACE, try putting libTAO to the left of libACE. In fact, you might try reversing the order of the libraries in your link, since all of the libTAO_* libraries you have listed depend on libTAO.
Better yet, you might want to check out the free MPC tool that comes with ACE+TAO. It can generate trouble-free ACE+TAO Makefiles for most platforms. It lives in the $ACE_ROOT/bin directory and is well documented. See http://www.ociweb.com/products/mpc for info. I don't know how well it will work with Eclipse, but it might be worth a shot. Maybe you can edit code in Eclipse and compile from the command line.