Linking a .dylib from OSX


#1

I'm trying to link a .dylib.  I have renamed/put it in /path/to/Demo/libpython3_3.dylib

In IntroJucer -> Config -> XCode (MacOSX) -> "external libraries to link" I add "python3_3"

Now I click "save project and Open in Xcode"

if I attempt to build the project, it fails with linker error:

ld: library not found for -lpython3_3

I can think of several things that might be wrong.

  • For a start, do I need to add this file into IntroJucer -> Files ?
  • Maybe I need to supply a path in IntroJucer -> Config -> XCode (MacOSX) -> Debug -> "extra library search paths"
  • Maybe I can't use dynamic libraries, and I have to use the corresponding static library (.a) -- but wouldn't that be rather ugly and result in bloating the final binary?

What is the right way to do this?

π


#2

I've got it working setting:

IntroJucer -> Config -> XCode (MacOSX) -> "external libraries to link":
    python3_3

IntroJucer -> Config -> XCode (MacOSX) -> Debug -> "extra library search paths":
    /Users/pi/Dev/JUCE/JUCE-master/extras/Demo/python3_3

The actual library is: /Users/pi/Dev/JUCE/JUCE-master/extras/Demo/libpython3_3.dylib


Even better, now I have created a /Libs folder, and moved the library into it):
    /Users/pi/Dev/JUCE/JUCE-master/extras/Demo/Libs/libpython3.3_OSX.dylib

(I also renamed it, remembering that I will have to provide libraries for Linux/Android/Win/iOS in due course)

And I can set a relative path in "extra library search paths"
    ../../Libs

This feels like the right structure.

(Thanks bazrush)