0

I have compiled a C library and created a custom framework with proper architecture. Now I include it in my project it compiles fine but when running on device it throws the error that it can't find in /Library/Frameworks/Custom.framework. I guess its looking onto the device and won't find it there. How to resolve this issue? Following is the error I get, I am compiling ghostscript for iOS: GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Fri Sep 16 06:56:50 UTC 2011)

Copyright 2004 Free Software Foundation, Inc.

GDB is free software, covered by the GNU General Public License, and you are

welcome to change it and/or distribute copies of it under certain conditions.

Type "show copying" to see the conditions.

There is absolutely no warranty for GDB. Type "show warranty" for details.

This GDB was configured as "--host=i386-apple-darwin --target=arm-apple-darwin".tty /dev/ttys003

warning: Unable to read symbols for /Library/Frameworks/Ghostscript.framework/Ghostscript (file not found).

warning: Unable to read symbols from "Ghostscript" (not yet mapped into memory).

target remote-mobile /tmp/.XcodeGDBRemote-150-78

Switching to remote-macosx protocol

mem 0x1000 0x3fffffff cache

mem 0x40000000 0xffffffff none

mem 0x00000000 0x0fff none

[Switching to process 7171 thread 0x1c03]

[Switching to process 7171 thread 0x1c03]

warning: No copy of found locally, reading from memory on remote device. This may slow down the debug session.

warning: No copy of found locally, reading from memory on remote device. This may slow down the debug session.

sharedlibrary apply-load-rules all

warning: No copy of found locally, reading from memory on remote device. This may slow down the debug session.

warning: No copy of found locally, reading from memory on remote device. This may slow down the debug session.

dyld: Library not loaded: /Library/Frameworks/Ghostscript.framework/Ghostscript

Referenced from: /var/mobile/Applications/92492A22-0DA9-49F7-98B6-D517B6E43726/App.app/app

Reason: image not found

kill

Salil
  • 375
  • 1
  • 5
  • 14
  • Did you drag the framework project into your workspace, or just add the lib? – CodaFi Mar 23 '12 at 23:46
  • I added the framework in Build Phases in "Link Binary with Libraries" section. – Salil Mar 24 '12 at 01:48
  • OK, drag in your framework project from the finder and then try linking it. – CodaFi Mar 24 '12 at 02:30
  • Error didn't change. I updated the error in the original question. It seems like its trying to find Ghostscript file which is not there. When I include my framework it doesn't get included either. – Salil Mar 24 '12 at 16:05

1 Answers1

0

You can't use dynamic libraries in iOS on the phone. You can only use the Apple libraries already on the phone dynamically. For your Ghost library, you must statically link the library so it becomes "merged" with the monolithic executable. That way, the library code is no longer external and does not need to be dynamically loaded as it is deployed "inside" your primary program.

Here's another SO answer that tells you the procedure for statically linking: Linking a static library to an iOS project in XCode 4

Community
  • 1
  • 1
x0n
  • 51,312
  • 7
  • 89
  • 111
  • Yeah I read the same thing but I also read that its possible to create custom framework. That aside the Ghostscript doesn't make a static library inherently and I don't know how to change configure or Makefile to force it to. May be I am missing something. I have a separate question here for that: http://stackoverflow.com/questions/9853419/how-to-combine-object-files-o-to-create-static-library-a-for-ios as I wanted to keep dynamic and static lib questions separate. Thanks a ton for help! – Salil Mar 24 '12 at 17:12