-
rbd
Thanks! I finally got back to this and found a very clear tutorial about paths and dynamic libraries. In my case, I think the externals are loaded because Pd constructs an explicit full path to them, but they depend on a shared library that I thought would simply load from the same place or maybe the executable directory. But no, a "full path" is needed. I put that in quotes, because, while the error message says you cannot use a relative path, the solution in fact is to use a relative path! The trick is that you have to provide an explicit relative path policy (this is not Apple's terminology and they seem a little confused). Policies include executable-relative, loader-relative, and RPATH-relative. In my case, I needed to write @loader_path/libo2pd.dylib to mean "find libo2pd.dylib relative to the path where the loader found the Pd external." I made things work using the following:
install_name_tool -id @loader_path/libo2pd.dylib libo2pd.dylib install_name_tool -change libo2pd.dylib @loader_path/libo2pd.dylib o2ensemble.pd_darwin install_name_tool -change libo2pd.dylib @loader_path/libo2pd.dylib o2property.pd_darwin install_name_tool -change libo2pd.dylib @loader_path/libo2pd.dylib o2receive.pd_darwin install_name_tool -change libo2pd.dylib @loader_path/libo2pd.dylib o2send.pd_darwin
where the .dylib file is the one loaded and required by the .pd_darwin files. There must be ways to specify all this as linker options, but I haven't gotten there yet.
I hope this might help someone make sense of their dll problems.
-
rbd
I'm running Pd-0.52-2 on MacOS Monterey (12.6) and having trouble with externals that I created. When developing/debugging, everything is fine. I have 4 externals with extensions .pd_darwin, each dependent upon a DLL named libo2pd.dylib. With everything in ~/Documents/Pd/externals/, I can start my locally compiled pd-0.52-2.app, and everything works. But if I run a downloaded /Applications/Pd-052-2.app and try to create one of these external objects, I get the message:
/Users/rbd/Documents/Pd/externals/o2ensemble.pd_darwin: dlopen(/Users/rbd/Documents/Pd/externals/o2ensemble.pd_darwin, 0x000A): Library not loaded: 'libo2pd.dylib' Referenced from: '/Users/rbd/Documents/Pd/externals/o2ensemble.pd_darwin' Reason: tried: 'libo2pd.dylib' (relative path not allowed in hardened program), '/usr/lib/libo2pd.dylib' (no such file) o2ensemble o2global ... couldn't create
I get the same results running from the command line, and running from the directory with the .dylib and externals does not make any difference. Note that /usr/lib is protected even using sudo, so even if I could install libo2pd.dylib there, I don't think it's an acceptable solution.
I suspect this problem stems from Apple security policies, but I don't know how Pd searches for .dylibs and there's a lot of ambiguity in documentation and discussions since "libraries" and "paths" are used in multiple ways. I also tried setting LD_LIBRARY_PATH and running from the command line, but that didn't work.
Does anyone know to set up Pd for an external that depends on a DLL?
-
rbd
Thanks! I'm been traveling and just had a chance to try again. I erased all the pd stuff I had downloaded before and started from scratch. I used http://msp.ucsd.edu/software.html (pd-0.52-2.src.tar.gz) and your commands: ./autogen.sh; ./configure CFLAGS=""; make CFLAGS="" followed by cd mac; ./osx-app.sh 0.52-2; open Pd-0.52-2.app;
It worked! Possibly an earlier update/reinstall of Jack was needed, and I'm not really sure what Jack-related stuff Pd is using now (if any).
I think my earlier problem was thinking "Pd-extended community version" was a better place to start with development and writing an external, and possibly starting fresh cleared some shell variables set in earlier failed attempts. -
rbd
I'd like to follow the steps you actually use. Where do you get Pd source code?
One of the problems I ran into was make not finding Jackmp. How did you install Jack? -
rbd
Thanks for your reply. My question was whether there are any instructions that are tested on macOS 12? That's still a real question. To answer "what about it didn't work", we'd have to identify "it", but there are many sets of instructions. I tried several. I could pick one at random and provide details (the farthest I got was compiling a Pd that seemed to be running but the display was almost completely black), but for starters, what instructions do you recommend? Thanks.
-
rbd
I found lots of instructions on compiling Pd from sources for macOS, but after trying 3, and none actually worked, could someone point me to build-from-source instructions tested on macOS 12 for any Pd version?