Using Sqlite in a dylib in an i386 app in XCode 4
For iOS I needed to add a file namely libsqlite3.0.dylib from directory: /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/usr/lib/
I have a method that obtains and MaxID from a column of an sqlite DB. This works fine in a universal iOS app I made. I want to port this code over to a Mac app i386.
Because I could not find such an dylib for i386, I created one using the download file: sqlite-autoconf-3070500.tar.gz
Following directions I produced 3 files in /usr/local/lib
libsqlite3.a libsqlite3.la libsqlite3.dylib
In XCode I have add '/usr/local/lib' to the Build Setting->Search Paths->Library Search Paths
I have used: export DYLD_LIBRARY_PATH=/usr/local/bin/:$DYLD_LIBRARY_PATH
I get the following build error when I uncomment the sqlite code in AppDelegate.m
Ld /Users/appleuser/Library/Developer/Xcode/DerivedData/iHungryMacNonDoc-dakfnxxiwzxehygtwrboebgysgwc/Build/Products/Debug/iHungryMacNonDoc.app/Contents/MacOS/iHungryMacNonDoc normal i386 cd /Users/appleuser/Cocoa/iHungryMacNonDoc setenv MACOSX_DEPLOYMENT_TARGET 10.6 /Developer/usr/bin/llvm-gcc-4.2 -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk -L/Users/appleuser/Library/Developer/Xcode/DerivedData/iHungryMacNonDoc-dakfnxxiwzxehygtwrboebgysgwc/Build/Products/Debug -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib -L/Users/appleuser/Cocoa/iHungryMacNonDoc/../SqliteLib -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib -F/Users/appleuser/Library/Developer/Xcode/DerivedData/iHungryMacNonDoc-dakfnxxiwzxehygtwrboebgysgwc/Build/Products/Debug -filelist /Users/appleuser/Library/Developer/Xcode/DerivedData/iHungryMacNonDoc-dakfnxxiwzxehygtwrboebgysgwc/Build/Intermediates/iHungryMacNonDoc.build/Debug/iHungryMacNonDoc.build/Objects-normal/i386/iHungryMacNonDoc.LinkFileList -mmacosx-version-min=10.6 -framework Cocoa -lsqlite3.0.8.6 -o /Users/appleuser/Library/Developer/Xcode/DerivedData/iHungryMacNonDoc-dakfnxxiwzxehygtwrboebgysgwc/Build/Products/Debug/iHungryMacNonDoc.app/Contents/MacOS/iHungryMacNonDoc
ld: file not found: /usr/lib/system/libdispatch_sim.dylib for architecture i386 collect2: ld returned 1 exit status Command /Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
AppDelegate.h begins ////////////
import "AppDelegate.h"
import "IngredXML.h"
import "XmlListReader.h"
import "Constants.h"
import
import
import "/usr/include/sqlite3.h"
Thanks so much for reading this. Please advise. Mark