Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: info needed????????



On Dec 8, 2004, at 4:37 AM, Hemanta Pathak wrote:

I was able to link my dylib with the application successfully.
But while executing the application I am getting this error :

dyld: /Users/hpathak/Trial/test/build/test.app/Contents/MacOS/test can't
open library :
libtest.dylib (No such file or directory,errno =2)

The contents of a dynamic library isn't copied into your app when it's linked. Instead, only the library name is stored in your app, and that name is used to find the library and resolve the symbols in it at run-time.


You need to make the .dylib accessible at run-time. The installation name for the library is recorded in your app, so the method you'll need to use to make is visible at run-time will vary. To view the installation name, use 'otool -D libtest.dylib'.

If the filename alone is used, you can simply install the library in one of the standard locations - /usr/lib, for example.

If the full path is specified, the library will have to be present at that exact location at run-time.

You can also include the library inside your .app bundle, but you'll need to compile the library with a special linker option. If the library is built using Xcode, use the "install path" option. If it's built with a make file, add the '-install_name blah' option to the linker flags. Or, if it has a configure script that creates its make file, run that with "LDFLAGS='-install_name blah' ./configure" to export the appropriate environment variable.

Regardless of how you specify it, the installation name should be something like this:

@executable_path/../Frameworks/libtest.dylib

If you go this route, you'll probably want to add a "copy file" build phase to your app, to copy the library file into the finished .app bundle.

In some situations, you can change the installation name of a library without rebuilding it, by using install_name_tool.

Have a look at this page, too:
<http://qin.laya.com/tech_coding_help/dylib_linking.html>

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Unix-porting mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/unix-porting/email@hidden

This email sent to email@hidden
References: 
 >RE: info needed???????? (From: Hemanta Pathak <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.