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
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:
or
or lots of posts on SO like
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-request@lists.iem.at wrote:
Message: 3
Date: Fri, 11 Dec 2020 22:28:33 -0300
From: Alexandre Torres Porres <porres@gmail.com>
To: Esteban Viveros <emviveros@gmail.com>
Cc: Jonathan Wilkes <jancsika@yahoo.com>, Pd-List
<pd-list@lists.iem.at>
Subject: Re: [PD] fluid~
Message-ID:
<CAEAsFmh701xsCJ8g95+Tt1=6FE-68kHeHsjdw3shLffQJLT75Q@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
_______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list