Maybe it's helpful to look at pd-lib-builder, since it has an option to
build a helper shared library. This makes sense if the same
functionality is used by several classes and the library is not compiled
as a single binary. One example is [iemnet] which contains a helper
library called "libiemnet" (for macOS it is actually named
"libiemnet.pd_darwin.dylib").
On Linux and macOS, we have to add special linker options to the
*external*. This is what pd-lib-builder does:
Linux: -Wl,-rpath,"\$$ORIGIN",--enable-new-dtags
macOS: -install_name @loader_path/$(shared.lib)
On Windows, no such things are needed when building the external,
instead Pd has to call SetDllDirectory, so that LoadLibrary will look
for dependencies in the same folder.
Christof
On 12.12.2020 10:49, Dan Wilcox wrote:
The question is better answered by informing yourself of how dynamic
libraries are found by applications on the platform, in this case macOS.
As far as I know, it basically comes down to:
1. Applications look in ~/lib, /usr/local/lib, and /usr/lib by default.
2. As you've found with Purr Data, an app bundle will also look in
Contents/libs.
3. Applications will also look in other places listed in environment
variables.
4. You can fiddle with the search path used per library when it's
linked using install_name_tool.
See the docs:
https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/UsingDynamicLibraries.html#//apple_ref/doc/uid/TP40002182-SW10
<https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/UsingDynamicLibraries.html#//apple_ref/doc/uid/TP40002182-SW10>
or
https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/RunpathDependentLibraries.html
<https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/RunpathDependentLibraries.html>
or lots of posts on SO like
https://stackoverflow.com/questions/38685581/how-to-set-dylib-search-path-osx
<https://stackoverflow.com/questions/38685581/how-to-set-dylib-search-path-osx>
For distributing a plugin like an external via deken, options 1-3 are
probably out to some degree. Option 4 however is not easy either as
the path set by install_name_tool has to be relatively specific, in my
experience. Getting it to work with the dylib sitting "wherever" on
someone else machine is not so easy, unfortunately.
Gem makes this work, so I would check how they do it for macOS.
The other, simpler alternative is to statically link fluidsynth into
the external. You then have a larger pd_darwin but no dependencies or
dylib search paths. If homebrew installs a statically-built
libfluidsynth.a to /usr/local/lib, you can use that.
On Dec 12, 2020, at 2:29 AM, pd-list-requ...@lists.iem.at
<mailto:pd-list-requ...@lists.iem.at> wrote:
Message: 3
Date: Fri, 11 Dec 2020 22:28:33 -0300
From: Alexandre Torres Porres <por...@gmail.com
<mailto:por...@gmail.com>>
To: Esteban Viveros <emvive...@gmail.com <mailto:emvive...@gmail.com>>
Cc: Jonathan Wilkes <jancs...@yahoo.com <mailto:jancs...@yahoo.com>>,
Pd-List
<pd-list@lists.iem.at <mailto:pd-list@lists.iem.at>>
Subject: Re: [PD] fluid~
Message-ID:
<CAEAsFmh701xsCJ8g95+Tt1=6fe-68khehsjdw3shlffqjlt...@mail.gmail.com
<mailto:CAEAsFmh701xsCJ8g95+Tt1=6fe-68khehsjdw3shlffqjlt...@mail.gmail.com>>
Content-Type: text/plain; charset="utf-8"
my searching app failed me, I found libfluidsynth.2.dylib in Contents/lib
in Purr Data's app!
So yeah, the question still remains, how can we make Pd find this. It
failed to do so if it's just in the same folder. And also if we can build
the external binary that already has libfluidsynth.2.dylib embedded
in it.
cheers
--------
Dan Wilcox
@danomatika <http://twitter.com/danomatika>
danomatika.com <http://danomatika.com>
robotcowboy.com <http://robotcowboy.com>
_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management ->
https://lists.puredata.info/listinfo/pd-list
_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management ->
https://lists.puredata.info/listinfo/pd-list