Objective C Library and Search Path - objective-c

I created a static library in Objective C (for OSX) for performing some calculations. I then compiled it and included it in another project. Later on I'm not able to use it in my codes.
1> When I wrote
import "Auth.h"
it was giving me a File Not Found error. Why is it so?
2> Then I had to set the search path to the source of the libraries and it got compiled and executed correctly. Does that mean I can't reuse the compiled library with other projects without distributing the source code along with it?
3> I thought if Search path is being specified then the compiled library won't need to be needed. So I deleted the library. But that didn't work. It means source + the library both are required.
What is actually happenning. I just want to distribute libAuth.a with other teams for the project without giving out the source. How can I do that.

You just need to provide the library file (.a) and the header files; the source files can remain private and undistributed.
Be sure to compile the library for all architectures (x86_64 and i386 on OSX) that can possibly use the library, using lipo to create a fat binary .a file.
For example:
xcrun --sdk macosx10.8 clang -arch x86_64 -o file1.o file1.m
xcrun --sdk macosx10.8 clang -arch x86_64 -o file2.o file2.m
xcrun --sdk macosx10.8 libtool -static -arch_only x86_64 -o libmystuff_x86_64.a file1.o file2.o
xcrun --sdk macosx10.8 clang -arch i386 -o file1.o file1.m
xcrun --sdk macosx10.8 clang -arch i386 -o file2.o file2.m
xcrun --sdk macosx10.8 libtool -static -arch_only i386 -o libmystuff_i386.a file1.o file2.o
xcrun --sdk macosx10.8 lipo -arch x86_64 libmystuff_x86_64.a -arch i386 libmystuff_i386.a -create -output libmystuff.a

Try adding the followings in your main project target settings;
”-ObjC” and ”-all_load” to Build Settings > Linking > Other Linker Flags,
”$(TARGET_BUILD_DIR)/usr/local/lib/include” and ”$(OBJROOT)/UninstalledProducts/include” to Build Settings > Search Paths > Header Search Paths,
"$(BUILT_PRODUCTS_DIR)" to Build Settings > User Header Search Paths.

Related

libtool picks up 64-bit library when I tries to build 32-bit program

I have a GNU build system with autoconf-2.69, automake-1.14.1, libtool-2.4.2. I've configured with --host=i686-linux on a x86_64 RHEL6 host OS to build a 32-bit program. The libtool command seems to be:
/bin/sh ../libtool --tag=CXX --mode=link g++ -I/home/STools/RLX/boost/include/boost-1_44 -m32 -g3 -Wall -static -o engine engine-main.o ../components/librlxvm.la /home/STools/RLX/boost/include/boost-1_44/../../lib/libboost_program_options-gcc42-mt-1_44.a -lz -lpthread -ldl -lrt -ldl -lz -lm
But the real command is to search the 64-bit libraries not the 32-bit libraries as shown below:
libtool: link: g++ -I/home/STools/RLX/boost/include/boost-1_44 -m32 -g3 -Wall -o engine engine-main.o -L/home/robert_bu/src/gcc/gcc-4.2.2/build-x86_64/x86_64-unknown-linux-gnu/libstdc++-v3/src -L/home/robert_bu/src/gcc/gcc-4.2.2/build-x86_64/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/home/robert_bu/src/gcc/gcc-4.2.2/build-x86_64/./gcc ../components/.libs/librlxvm.a /home/STools/RLX/boost/include/boost-1_44/../../lib/libboost_program_options-gcc42-mt-1_44.a /home/STools/RLX/gcc-4.2.2-x86_64/lib/../lib64/libstdc++.so -L/lib/../lib64 -L/usr/lib/../lib64 -lc -lgcc_s -lrt -ldl -lz -lm -pthread -Wl,-rpath -Wl,/home/STools/RLX/gcc-4.2.2-x86_64/lib/../lib64 -Wl,-rpath -Wl,/home/STools/RLX/gcc-4.2.2-x86_64/lib/../lib64
The --host config seems to have no effect. Is there anyway to tell libtool that 32-bit libraries are what we want?
It seems that libtool uses "CC", "CXX" to check the library search path. After I set CC to "gcc -m32", and CXX to "g++ -m32", it works. So libtool does not add "-m32" automatically even if I try to build a 32-bit program on a 64-bit system.
You're being hit by the problem of libtool .la files expansion. In particular libstdc++.la is being expanded for you to a full path rather than a simple -lstdc++.
My suggestion is to remove .la file from the SDK you're using (/home/STools). This way libtool can't assume things for you. Usually the ones you have in the system are fine, because the libraries are already in the search path, so it does not need to use -rpath or the full path to the .so file.
Depending on how well the SDK was crafted, this might or might not work correctly, so take it with a grain of salt.

Compile Mach-o arm object file

Im trying to compile a mach-o arm object file to mach-o arm executable using the command line. I have used various commands like these
clang -arch armv7 helloapp.o -o helloapp
clang helloapp.o -o helloapp
gcc helloapp.o -o helloapp
They all return different errors saying compiling for wrong architecture or missing neccessary files. What is the command I need to compile this properly??
The default compilers (the ones in your $PATH) reference the ones that can compile for your local machine. You need a cross-compiler that knows how to create ARM binaries. If you've got Xcode with iOS SDK installed you can use for example:
PATH_TO_Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
or
PATH_TO_Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
For example, on my machine:
ARM_GCC=~/Documents/Xcode4.6.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
IOS_SDK=~/Documents/Xcode4.6.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk
# Compile
$ARM_GCC -arch armv7 -c test.c -o test.o
# Link
$ARM_GCC -arch armv7 -isysroot "$IOS_SDK" test.o -o test
If I then run file test I get:
test: Mach-O executable arm

CLang compilation failed

I faced following error while compiling main.m (Objective-C)
I am using makefile to build this file.
/Volumes/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -Wall -DDEBUG=1 -g -o main.o main.m -mmacosx-version-min=10.8 -F/Volumes/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/
In file included from main.m:9:
In file
included from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:138:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSAppleEventDescriptor.h:7:
/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:64:10: fatal error:
'ImageIO/ImageIO.h' file not found
#include <ImageIO/ImageIO.h>
^
1 error generated.
make: *** [main.o] Error 1
I do not know why this ImageIO/ImageIO.h is not found. What is the reason behind this?
Additionally I would like to know how to make Clang to look into the Frameworks present in /Volumes/Xcode.app/Contents/Developer/ (specified in option -F)?
It sounds like you're trying to build against the OS X 10.8 SDK from the command-line. The compiler invocation you're after will look something like so:
xcrun clang -arch x86_64 -Wall -DDEBUG=1 -g -o main.o main.m -mmacosx-version-min=10.8 -isysroot $(xcodebuild -version -sdk macosx10.8 Path)
The -isysroot argument to clang tells it to treat the given path as the root of the system with respect to the default header and framework search paths.

Appcelerator module with my own sqlite3 build

I am writing an appcelerator module to use my own sqlite3 build. The problem that I am facing is that the default system sqlite code seems to get linked regardless.
I have tried a number of things, but I would have throught that placing all the sqlite code in my .m file would result in that code being called.
MySqlite.m
#import "sqlite3.h"
#import "sqlite3.c"
#pragma Public APIs
-(NSString *)getSqliteVersion:(id)args
{
return [NSString stringWithFormat:#"%s", sqlite3_libversion()];
}
The getSqliteVersion member still returns version number of the iOS standard sqlite library
So does anyone know how to alter the linker to pick up my own sqlite code or is there a way to "wrap" the sqlite in a namespace or such like?
EDIT 10/10/12:
Sorry, bit more info that is relevant. The build process is two steps.
The part I am doing is to build the module which is a packaged static library, i.e. a .a file
This .a file is distributed to other users and then they build their application with this module. So that is why I can't control the second linking step and remove any .dylib sqlite references.
Some how I think I need to get my sqlite lib into a private "namespace". I use namespace conceptually, I know C doesn't have them
Not sure if it helps, but the Ti build commands for the module build seem to be:
Build settings from command line:
SDKROOT = iphonesimulator5.0
=== BUILD NATIVE TARGET tisqlite_crypt_ios OF PROJECT tisqlite_crypt_ios WITH CONFIGURATION Release ===
Check dependencies
CompileC build/tisqlite_crypt_ios.build/Release-iphonesimulator/tisqlite_crypt_ios.build/Objects-normal/i386/UkCoClinicalsoftwaresolutionsTisqlite_crypt_iosModule.o Classes/UkCoClinicalsoftwaresolutionsTisqlite_crypt_iosModule.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /TitaniumStudioWorkspace/tisqlite_crypt_ios
setenv LANG en_US.US-ASCII
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -x objective-c -arch i386 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -std=c99 -Wno-trigraphs -fpascal-strings -Os -Wno-return-type -Wno-parentheses -Wswitch -Wunused-function -Wno-unused-parameter -Wno-unused-variable -Wno-unused-value -Wno-shorten-64-to-32 -DTI_VERSION= -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -fexceptions -fasm-blocks -mmacosx-version-min=10.6 -gdwarf-2 -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -D__IPHONE_OS_VERSION_MIN_REQUIRED=40000 -iquote /TitaniumStudioWorkspace/tisqlite_crypt_ios/build/tisqlite_crypt_ios.build/Release-iphonesimulator/tisqlite_crypt_ios.build/UkCoClinicalsoftwaresolutionsTisqlite_crypt_ios-generated-files.hmap -I/TitaniumStudioWorkspace/tisqlite_crypt_ios/build/tisqlite_crypt_ios.build/Release-iphonesimulator/tisqlite_crypt_ios.build/UkCoClinicalsoftwaresolutionsTisqlite_crypt_ios-own-target-headers.hmap -I/TitaniumStudioWorkspace/tisqlite_crypt_ios/build/tisqlite_crypt_ios.build/Release-iphonesimulator/tisqlite_crypt_ios.build/UkCoClinicalsoftwaresolutionsTisqlite_crypt_ios-all-target-headers.hmap -iquote /TitaniumStudioWorkspace/tisqlite_crypt_ios/build/tisqlite_crypt_ios.build/Release-iphonesimulator/tisqlite_crypt_ios.build/UkCoClinicalsoftwaresolutionsTisqlite_crypt_ios-project-headers.hmap -I/TitaniumStudioWorkspace/tisqlite_crypt_ios/build/Release-iphonesimulator/include "-I/Library/Application Support/Titanium/mobilesdk/osx/2.1.3.GA/iphone/include" "-I/Library/Application Support/Titanium/mobilesdk/osx/2.1.3.GA/iphone/include/TiCore" -I/TitaniumStudioWorkspace/tisqlite_crypt_ios/build/tisqlite_crypt_ios.build/Release-iphonesimulator/tisqlite_crypt_ios.build/DerivedSources/i386 -I/TitaniumStudioWorkspace/tisqlite_crypt_ios/build/tisqlite_crypt_ios.build/Release-iphonesimulator/tisqlite_crypt_ios.build/DerivedSources -F/TitaniumStudioWorkspace/tisqlite_crypt_ios/build/Release-iphonesimulator -DTI_POST_1_2 -include /var/folders/LP/LPsQmql2FfCGO9YCrCUKUU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/UkCoClinicalsoftwaresolutionsTisqlite_crypt_ios_Prefix-hbaweqhgijjnfpfynapljpziqmjk/UkCoClinicalsoftwaresolutionsTisqlite_crypt_ios_Prefix.pch -MMD -MT dependencies -MF /TitaniumStudioWorkspace/tisqlite_crypt_ios/build/tisqlite_crypt_ios.build/Release-iphonesimulator/tisqlite_crypt_ios.build/Objects-normal/i386/UkCoClinicalsoftwaresolutionsTisqlite_crypt_iosModule.d -c /TitaniumStudioWorkspace/tisqlite_crypt_ios/Classes/UkCoClinicalsoftwaresolutionsTisqlite_crypt_iosModule.m -o /TitaniumStudioWorkspace/tisqlite_crypt_ios/build/tisqlite_crypt_ios.build/Release-iphonesimulator/tisqlite_crypt_ios.build/Objects-normal/i386/UkCoClinicalsoftwaresolutionsTisqlite_crypt_iosModule.o
In file included from /TitaniumStudioWorkspace/tisqlite_crypt_ios/Classes/UkCoClinicalsoftwaresolutionsTisqlite_crypt_iosModule.m:14:
/TitaniumStudioWorkspace/tisqlite_crypt_ios/Classes/sqlite3.c:27620:32:{27620:32-27620:45}{27620:30-27620:31}: warning: implicit conversion from 'long long' to 'long' changes value from 9223372036854775807 to -1 [-Wconstant-conversion,3]
mask = (sizeof(long)==8) ? LARGEST_INT64 : 0x7fffffff;
~ ^~~~~~~~~~~~~
/TitaniumStudioWorkspace/tisqlite_crypt_ios/Classes/sqlite3.c:7946:25: note: instantiated from:
#define LARGEST_INT64 (0xffffffff|(((i64)0x7fffffff)<<32))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
Libtool build/Release-iphonesimulator/libUkCoClinicalsoftwaresolutionsTisqlite_crypt_ios.a normal i386
cd /TitaniumStudioWorkspace/tisqlite_crypt_ios
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/libtool -static -arch_only i386 -syslibroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/TitaniumStudioWorkspace/tisqlite_crypt_ios/build/Release-iphonesimulator -filelist /TitaniumStudioWorkspace/tisqlite_crypt_ios/build/tisqlite_crypt_ios.build/Release-iphonesimulator/tisqlite_crypt_ios.build/Objects-normal/i386/UkCoClinicalsoftwaresolutionsTisqlite_crypt_ios.LinkFileList -ObjC -framework Foundation -o /TitaniumStudioWorkspace/tisqlite_crypt_ios/build/Release-iphonesimulator/libUkCoClinicalsoftwaresolutionsTisqlite_crypt_ios.a
** BUILD SUCCEEDED **

Including an embedded framework using a cross-project-reference: Header no such file or directory

I'm trying to create a Cocoa framework by using a cross-project reference in Xcode.
I have 2 projects: one for the framework; one for the application that will use the framework.
This framework is not intended to be stored within the system; it is an embedded framework that lives within the application bundle.
I have successfully made the cross-project reference, marked the framework as being a dependency of my target, added a Copy Files build phase that puts the framework in Contents/Frameworks/ and added the framework to the linker phase (I checked the little "Target" checkbox; I've also done it manually by dragging the framework into the linker phase).
My framework's install directory is correctly set to #executable_path/../Frameworks.
However, when I try to build my app it:
a) Correctly builds the framework first
b) Correctly copies the framework
c) Errors because it cannot find the master header file in my framework
I have verified that the header is there. I can see it in the app product that is partially built.
ls build/Debug/CioccolataTest.webapp/Contents/Frameworks/Cioccolata.framework/Headers/Cioccolata.h
build/Debug/CioccolataTest.webapp/Contents/Frameworks/Cioccolata.framework/Headers/Cioccolata.h
I have been able to successfully build the app by copying my framework into /Library/Frameworks (I can then delete it again after the successful build), but this is a workaround, I'm looking to find it out why Xcode doesn't find the framework's master header file without it being copied to a system directory. Is copying it to the app bundle during the build not sufficient?
Here's the full build transcript if it's any help (it's just a Hello World app right now, so not much going on here):
Build Cioccolata of project Cioccolata with configuration Debug
SymLink /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework/Versions/Current A
cd /Users/chris/Projects/Mac/Cioccolata
/bin/ln -sf A /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework/Versions/Current
SymLink /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework/Resources Versions/Current/Resources
cd /Users/chris/Projects/Mac/Cioccolata
/bin/ln -sf Versions/Current/Resources /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework/Resources
SymLink /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework/Headers Versions/Current/Headers
cd /Users/chris/Projects/Mac/Cioccolata
/bin/ln -sf Versions/Current/Headers /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework/Headers
SymLink /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework/Cioccolata Versions/Current/Cioccolata
cd /Users/chris/Projects/Mac/Cioccolata
/bin/ln -sf Versions/Current/Cioccolata /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework/Cioccolata
ProcessInfoPlistFile /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework/Versions/A/Resources/Info.plist Info.plist
cd /Users/chris/Projects/Mac/Cioccolata
builtin-infoPlistUtility Info.plist -expandbuildsettings -platform macosx -o /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework/Versions/A/Resources/Info.plist
CpHeader build/Debug/Cioccolata.framework/Versions/A/Headers/CWHelloWorld.h CWHelloWorld.h
cd /Users/chris/Projects/Mac/Cioccolata
/Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp -exclude .DS_Store -exclude CVS -exclude .svn -resolve-src-symlinks /Users/chris/Projects/Mac/Cioccolata/CWHelloWorld.h /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework/Versions/A/Headers
CpHeader build/Debug/Cioccolata.framework/Versions/A/Headers/Cioccolata.h Cioccolata.h
cd /Users/chris/Projects/Mac/Cioccolata
/Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp -exclude .DS_Store -exclude CVS -exclude .svn -resolve-src-symlinks /Users/chris/Projects/Mac/Cioccolata/Cioccolata.h /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework/Versions/A/Headers
CopyStringsFile /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework/Versions/A/Resources/English.lproj/InfoPlist.strings English.lproj/InfoPlist.strings
cd /Users/chris/Projects/Mac/Cioccolata
setenv ICONV /usr/bin/iconv
/Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copystrings --validate --inputencoding utf-8 --outputencoding UTF-16 English.lproj/InfoPlist.strings --outdir /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework/Versions/A/Resources/English.lproj
ProcessPCH /var/folders/Xy/Xy-bvnxtFpiYBQPED0dK1++++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Cioccolata_Prefix-dololiigmwjzkgenggebqtpvbauu/Cioccolata_Prefix.pch.gch Cioccolata_Prefix.pch normal i386 objective-c com.apple.compilers.gcc.4_2
cd /Users/chris/Projects/Mac/Cioccolata
setenv LANG en_US.US-ASCII
/Developer/usr/bin/gcc-4.2 -x objective-c-header -arch i386 -fmessage-length=0 -pipe -std=gnu99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -isysroot /Developer/SDKs/MacOSX10.5.sdk -mfix-and-continue -mmacosx-version-min=10.5 -gdwarf-2 -iquote /Users/chris/Projects/Mac/Cioccolata/build/Cioccolata.build/Debug/Cioccolata.build/Cioccolata-generated-files.hmap -I/Users/chris/Projects/Mac/Cioccolata/build/Cioccolata.build/Debug/Cioccolata.build/Cioccolata-own-target-headers.hmap -I/Users/chris/Projects/Mac/Cioccolata/build/Cioccolata.build/Debug/Cioccolata.build/Cioccolata-all-target-headers.hmap -iquote /Users/chris/Projects/Mac/Cioccolata/build/Cioccolata.build/Debug/Cioccolata.build/Cioccolata-project-headers.hmap -F/Users/chris/Projects/Mac/Cioccolata/build/Debug -I/Users/chris/Projects/Mac/Cioccolata/build/Debug/include -I/Users/chris/Projects/Mac/Cioccolata/build/Cioccolata.build/Debug/Cioccolata.build/DerivedSources/i386 -I/Users/chris/Projects/Mac/Cioccolata/build/Cioccolata.build/Debug/Cioccolata.build/DerivedSources -c /Users/chris/Projects/Mac/Cioccolata/Cioccolata_Prefix.pch -o /var/folders/Xy/Xy-bvnxtFpiYBQPED0dK1++++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Cioccolata_Prefix-dololiigmwjzkgenggebqtpvbauu/Cioccolata_Prefix.pch.gch
CompileC build/Cioccolata.build/Debug/Cioccolata.build/Objects-normal/i386/CWHelloWorld.o /Users/chris/Projects/Mac/Cioccolata/CWHelloWorld.m normal i386 objective-c com.apple.compilers.gcc.4_2
cd /Users/chris/Projects/Mac/Cioccolata
setenv LANG en_US.US-ASCII
/Developer/usr/bin/gcc-4.2 -x objective-c -arch i386 -fmessage-length=0 -pipe -std=gnu99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -isysroot /Developer/SDKs/MacOSX10.5.sdk -mfix-and-continue -mmacosx-version-min=10.5 -gdwarf-2 -iquote /Users/chris/Projects/Mac/Cioccolata/build/Cioccolata.build/Debug/Cioccolata.build/Cioccolata-generated-files.hmap -I/Users/chris/Projects/Mac/Cioccolata/build/Cioccolata.build/Debug/Cioccolata.build/Cioccolata-own-target-headers.hmap -I/Users/chris/Projects/Mac/Cioccolata/build/Cioccolata.build/Debug/Cioccolata.build/Cioccolata-all-target-headers.hmap -iquote /Users/chris/Projects/Mac/Cioccolata/build/Cioccolata.build/Debug/Cioccolata.build/Cioccolata-project-headers.hmap -F/Users/chris/Projects/Mac/Cioccolata/build/Debug -I/Users/chris/Projects/Mac/Cioccolata/build/Debug/include -I/Users/chris/Projects/Mac/Cioccolata/build/Cioccolata.build/Debug/Cioccolata.build/DerivedSources/i386 -I/Users/chris/Projects/Mac/Cioccolata/build/Cioccolata.build/Debug/Cioccolata.build/DerivedSources -include /var/folders/Xy/Xy-bvnxtFpiYBQPED0dK1++++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Cioccolata_Prefix-dololiigmwjzkgenggebqtpvbauu/Cioccolata_Prefix.pch -c /Users/chris/Projects/Mac/Cioccolata/CWHelloWorld.m -o /Users/chris/Projects/Mac/Cioccolata/build/Cioccolata.build/Debug/Cioccolata.build/Objects-normal/i386/CWHelloWorld.o
Ld /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework/Versions/A/Cioccolata normal i386
cd /Users/chris/Projects/Mac/Cioccolata
setenv MACOSX_DEPLOYMENT_TARGET 10.5
/Developer/usr/bin/gcc-4.2 -arch i386 -dynamiclib -isysroot /Developer/SDKs/MacOSX10.5.sdk -L/Users/chris/Projects/Mac/Cioccolata/build/Debug -F/Users/chris/Projects/Mac/Cioccolata/build/Debug -filelist /Users/chris/Projects/Mac/Cioccolata/build/Cioccolata.build/Debug/Cioccolata.build/Objects-normal/i386/Cioccolata.LinkFileList -install_name #executable_path/../Frameworks/Cioccolata.framework/Versions/A/Cioccolata -mmacosx-version-min=10.5 -framework Foundation -single_module -compatibility_version 1 -current_version 1 -o /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework/Versions/A/Cioccolata
Touch /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework
cd /Users/chris/Projects/Mac/Cioccolata
/usr/bin/touch -c /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework
Build CioccolataTest of project CioccolataTest with configuration Debug
ProcessInfoPlistFile /Users/chris/Projects/Mac/CioccolataTest/build/Debug/CioccolataTest.webapp/Contents/Info.plist Info.plist
cd /Users/chris/Projects/Mac/CioccolataTest
builtin-infoPlistUtility Info.plist -expandbuildsettings -platform macosx -o /Users/chris/Projects/Mac/CioccolataTest/build/Debug/CioccolataTest.webapp/Contents/Info.plist
PBXCp build/Debug/CioccolataTest.webapp/Contents/Frameworks/Cioccolata.framework /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework
cd /Users/chris/Projects/Mac/CioccolataTest
/Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp -exclude .DS_Store -exclude CVS -exclude .svn -resolve-src-symlinks /Users/chris/Projects/Mac/Cioccolata/build/Debug/Cioccolata.framework /Users/chris/Projects/Mac/CioccolataTest/build/Debug/CioccolataTest.webapp/Contents/Frameworks
CopyStringsFile /Users/chris/Projects/Mac/CioccolataTest/build/Debug/CioccolataTest.webapp/Contents/Resources/English.lproj/InfoPlist.strings English.lproj/InfoPlist.strings
cd /Users/chris/Projects/Mac/CioccolataTest
setenv ICONV /usr/bin/iconv
/Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copystrings --validate --inputencoding utf-8 --outputencoding UTF-16 English.lproj/InfoPlist.strings --outdir /Users/chris/Projects/Mac/CioccolataTest/build/Debug/CioccolataTest.webapp/Contents/Resources/English.lproj
CompileC build/CioccolataTest.build/Debug/CioccolataTest.build/Objects-normal/i386/main.o main.m normal i386 objective-c com.apple.compilers.gcc.4_2
cd /Users/chris/Projects/Mac/CioccolataTest
setenv LANG en_US.US-ASCII
/Developer/usr/bin/gcc-4.2 -x objective-c -arch i386 -fmessage-length=0 -pipe -std=gnu99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -isysroot /Developer/SDKs/MacOSX10.5.sdk -mfix-and-continue -mmacosx-version-min=10.5 -gdwarf-2 -iquote /Users/chris/Projects/Mac/CioccolataTest/build/CioccolataTest.build/Debug/CioccolataTest.build/CioccolataTest-generated-files.hmap -I/Users/chris/Projects/Mac/CioccolataTest/build/CioccolataTest.build/Debug/CioccolataTest.build/CioccolataTest-own-target-headers.hmap -I/Users/chris/Projects/Mac/CioccolataTest/build/CioccolataTest.build/Debug/CioccolataTest.build/CioccolataTest-all-target-headers.hmap -iquote /Users/chris/Projects/Mac/CioccolataTest/build/CioccolataTest.build/Debug/CioccolataTest.build/CioccolataTest-project-headers.hmap -F/Users/chris/Projects/Mac/CioccolataTest/build/Debug -I/Users/chris/Projects/Mac/CioccolataTest/build/Debug/include -I/Users/chris/Projects/Mac/CioccolataTest/build/CioccolataTest.build/Debug/CioccolataTest.build/DerivedSources/i386 -I/Users/chris/Projects/Mac/CioccolataTest/build/CioccolataTest.build/Debug/CioccolataTest.build/DerivedSources -include /Users/chris/Projects/Mac/CioccolataTest/prefix.pch -c /Users/chris/Projects/Mac/CioccolataTest/main.m -o /Users/chris/Projects/Mac/CioccolataTest/build/CioccolataTest.build/Debug/CioccolataTest.build/Objects-normal/i386/main.o
In file included from <command-line>:0:
/Users/chris/Projects/Mac/CioccolataTest/prefix.pch:13:35: error: Cioccolata/Cioccolata.h: No such file or directory
/Users/chris/Projects/Mac/CioccolataTest/main.m: In function 'main':
/Users/chris/Projects/Mac/CioccolataTest/main.m:13: error: 'CWHelloWorld' undeclared (first use in this function)
/Users/chris/Projects/Mac/CioccolataTest/main.m:13: error: (Each undeclared identifier is reported only once
/Users/chris/Projects/Mac/CioccolataTest/main.m:13: error: for each function it appears in.)
/Users/chris/Projects/Mac/CioccolataTest/main.m:13: error: 'hello' undeclared (first use in this function)
I know this post is old now, but I'm working on another project and have just had the displeasure of setting up another cross-project reference for an embedded framework that must be built from a separate project before building this project.
I came up with a much more elegant fix (and probably the "correct" fix) this time, basically because what I did last time wasn't working (Xcode kept complaining that it couldn't find the framework's main header file).
The solution. I've just tested it on a number of projects from scratch just to be sure...
Add the other (dependency) project to your main project by doing "Project -> Add to project"
Double click on your target that requires products from the other project.
In the general tab, add the required products as direct dependencies (top panel). Close this settings panel.
Drag the product from the cross-project reference into the Link Binary with Libraries build phase of your target.
Add a new "Copy Files" build phase, selecting "Products" as the destination directory (!!!). Rename this build phase to "Copy Cross-Project Products".
Drag your cross-project product(s) into this new build phase and make sure that it's the first build phase in your target.
Add one final "Copy Files" build phase to your target, selecting "Frameworks" as the destination.
Drag your cross-project product(s) into this new build phase.
While it looks long-winded, most of it is pretty normal and exactly what you'd do if the dependency target was in the same project. The crucial first build phase however needs to copy the built products from the other project into the current project's build directory.
Obviously Xcode is smart enough to get the other project to perform the build, but not smart enough to think to look there when it starts compiling your sources that depend on it.
Does your 'Framework Search Paths' build setting include the path to the framework?