1

I have an error in project, but I d'nt know were is the problem. this is my error after compilation.

ld warning:

in /install/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/lib/libsqlite3.dylib, file is not of required architecture

ld warning:

in /install/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/lib/libsqlite3.0.dylib, file is not of required architecture Undefined symbols:"_sqlite3_open", referenced from: -[LiteSqlViewController openDB] in LiteSqlViewController.o "_sqlite3_close", referenced from: -[LiteSqlViewController openDB] in LiteSqlViewController.o

ld:

symbol(s) not found collect2: ld returned 1 exit status _sqlite3_open", referenced from:-[LiteSqlViewController openDB] in LiteSqlViewController.o "_sqlite3_close", referenced from:-[LiteSqlViewController openDB] in LiteSqlViewController.o

ld:

symbol(s) not found collect2: ld returned 1 exit status Build failed (2 errors)

I use OSX 10.5.8 xcode 3.1.2 iphone simulator 2.2.1 Architecture PPC

the result of command:

file /usr/lib/libsqlite3.dylib : /usr/lib/libsqlite3.dylib: Mach-O universal binary with 4 architectures /usr/lib/libsqlite3.dylib (for architecture ppc7400): Mach-O dynamically linked shared library ppc /usr/lib/libsqlite3.dylib (for architecture ppc64): Mach-O 64-bit dynamically linked shared library ppc64 /usr/lib/libsqlite3.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/libsqlite3.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64.

Justin Boo
  • 10,132
  • 8
  • 50
  • 71
pauljean
  • 31
  • 1
  • 2
  • 5

2 Answers2

9

It doesn't seem to be too straightforward to use the iPhone Simulator on PPC Macs. Issue the command file with the path in the first error you get (right after the first ld warning:). Check out this related question, maybe these steps help.


Old answer:

Did you link libsqlite3.dylib in your project?

In Xcode 4 this can be done like shown in the screenshot: Press the plus sign and add libsqlite3.dylib. Afterwards, you can drag the library into the Linked Frameworks folder. (The screenshot shows a Mac OS X application, it's the same for iOS applications.)

Xcode 4 Screenshot

Community
  • 1
  • 1
Pascal
  • 16,846
  • 4
  • 60
  • 69
  • yes I added this framework libsqlite3.dylib and #import "sqlite3.h" I just make a mistake in the title of my topic. I use Osx 10.5.8, xcode 3.1.2 and iphone simulator 2.2.1. thank a lot for your answer – pauljean Mar 22 '11 at 15:22
  • Your error tells that the wrong libsqlite architecture (!) has been included in the project. If you remove it and add it again, does this solve the problem? What are the build settings when you get the error, which architecture are you building for? Add this information to the question, maybe someone can help. – Pascal Mar 22 '11 at 21:36
  • pascal thank a lot,for your help. I do like you said but it does not run. my iphone simulator is 2.2.1 architecture ppc. – pauljean Mar 23 '11 at 08:40
  • Oh, PPC? Are you running on a PowerPC Mac? Hmm, actually, my library is also available as PPC library. What do you get from this command: `file /usr/lib/libsqlite3.dylib`? Does it say `ppc7400` somewhere? – Pascal Mar 23 '11 at 16:49
  • hi pascal. here's my version of mac. I would also say that I'm new to this platform. – pauljean Mar 24 '11 at 08:15
  • hi pascal. this the result of command: file /usr/lib/libsqlite3.dylib : /usr/lib/libsqlite3.dylib: Mach-O universal binary with 4 architectures /usr/lib/libsqlite3.dylib (for architecture ppc7400): Mach-O dynamically linked shared library ppc /usr/lib/libsqlite3.dylib (for architecture ppc64): Mach-O 64-bit dynamically linked shared library ppc64 /usr/lib/libsqlite3.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/libsqlite3.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64. thank. – pauljean Mar 24 '11 at 08:31
  • Ah, shoot, it doesn't use that library, it uses the one from the SDK. Check whether the dylib from the SDK can run on ppc: `file /install/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/lib/libsqlite3.dylib` – Pascal Mar 24 '11 at 10:50
  • I do, but it still does not work. thank a lot pascal for your help – pauljean Mar 24 '11 at 11:12
  • this the result when i enter the commande: /install/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sd­k/usr/lib/libsqlite3.dylib: cannot open `/install/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sd­k/usr/lib/libsqlite3.dylib' (No such file or directory) – pauljean Mar 24 '11 at 11:41
  • hi Pascal, let me first apologize for answering so late. I do like the link indicated and had two fingers working, but there were still only other mistake. I uninstalled the SDK, which was apparently not properly installed, now I want an older version of SDK to run on my machine as sdk2.2.1. thank. – pauljean Mar 25 '11 at 15:28
1

Xcode 4 does not build PPC architecture (nor does it work for any OS prior to 10.6).

You'll need to make sure that your program and the libsqlite3.dylib library are built for the same architecture. I suspect the library is built for x86.

As others have said use the "file" command to determine what architectures a file was built for.

wadesworld
  • 13,535
  • 14
  • 60
  • 93
  • I use Osx10.5.8 xcode 3.1.2 iphone simulator 2.2.1 Architecture PPC, thank a lot for your answer, I update the topic. – pauljean Mar 25 '11 at 15:36