Xcode 4, dylib & install_name_tool

I am trying to get dylib working in my OSX project.

I read a few samples, this is specific: Xcode 4 adds dylib

But I still can't get it to work.

Here are the steps I followed:

  • Copied test.1.dylib to my Xcode project folder.
  • Ran sudo install_name_tool -id @executable_path/../Frameworks/testing.1.dylib testing.1.dylib
  • Ran: otool -L testing.1.dyliband got the following:

    testing.1.dylib:
        @executable_path /../ Frameworks / testing.1.dylib (compatibility version 2.0.0, current version 2.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

  • Added testing.1.dylibas a basis for the project. (Using a set of links with a library option).

  • At this moment, when I compile test1.dylib, it is not copied to .App / Framework, as I expected, so I manually create the Framework path and copy test.1.dylib: a) mkdir -p testing.app/Contents/ Frameworks b) cp testing.1.dylib testing.app/Contents/Frameworks
  • In Xcode, I update Runtime Search Pathsfor BOTH Target and Project: @executable_path /../ Frameworks.

Now I copy test.app to a separate computer that has just been installed and try to start it. As a result, I get the following error:

dyld: library not loaded: /user/local/lib/testing1.dylib Link: /Users/me/testing.app/MacOS /./ testing Reason: image not found

Something is missing me, but I'm not sure what? Can someone point me in the right direction?

Notes. When running install_name_tool I need to use sudo or I get the following errors:

install_name_tool: : testing.1.dylib (Permission denied) install_name_tool: lseek : 0 : testing.1.dylib (Bad file descriptor) install_name_tool: : testing.1.dylib( Bad ) install_name_tool: : testing.1.dylib( )

+3
2

.

sudo . ? , "sudo make install" - ? . , , link.

, , . Copy Files .

Runpath, @rpath.

, Xcode , 1, , , . ? 1? /usr/lib /usr/local/lib, Xcode, , .

+1

"XCode 4 add dylib", , , , " ". , dylib. > > > . dylib Navigator Framework.

dylib , dylib .

+1

All Articles