-
afsacp
@rxc, my apologies for the months-long wait in replying. I've always compiled the externals using the Build action in XCode (rather than running Makefile).
I don't know if this might make a difference, but can you try doing that and then loading the external in the debug scheme?
There may be a bit of config to do to make the XCode project build the external correctly. This includes using the correct architecture, and also some options that can be found in the link that I had posted at the very top of this thread:
http://cooperbaker.com/home/code/pd xcode/xcode 3.2.2 pd tutorial/
Also, I am not using XCode 13 (still on 12, really dreading the upgrade, as I know this will break many things on my other projects), but I suspect that the configurations for a dynamic library will be very similar and should therefore work using the same guidelines (this has been my experience when migrating my projects from XCode 9 through 12, and even making the jump from 32- to 64-bit--the build settings are pretty much the same).
Let me know if this helps!
-
afsacp
For anyone interested, I was able to figure out how to do it using the original guide for earlier Xcode versions. The mistake I was making was to attach the full package of Pure Data to the debugging scheme as the executable. The correct way of doing it is to link the actual executable file as described below.
In Xcode (this is v 12.3):
- Create a new debugging scheme
- Edit the new scheme:
- In the Executable drop-down menu, select Other...
- Find the executable for pd (e.g. /Applications/Pd-0.51-3.app/Contents/Resources/bin/pd)
The settings for the scheme should look like this (notice the setting for Launch - Automatically)
- Build and run the external. This will start Pd. The actual debugging will begin when you instantiate the external object inside a patch.
In my case, I added a breakpoint inside the bang() method. Upon receiving the bang, the breakpoint is reached:
- Create a new debugging scheme
-
afsacp
I'm wondering if anyone knows a way to use Xcode 12 to debug an external with e.g. breakpoints while the external runs in PD?
I've only been able to find guides like the one below, which reference earlier Xcode versions:
http://cooperbaker.com/home/code/pd xcode/xcode 3.2.2 pd tutorial/My version of Xcode is 12.3. I am using PD Vanilla 0.51.3.
-
afsacp
Great to hear, @me-andmymonkey! Make sure to share the externals. Best luck,
afsacp
-
afsacp
Hey @me-andmymonkey, I found another option, which should work. Follow these steps (try first with the 32bit, tell me what happens):
- In Finder, go to Applications folder.
- Right- or control-click on Pd-extended
- Click on "show package contents"
- Navigate to Contents -> Resources -> extra
- Create a folder with the exact name of the external (impact_modalb~)
- Put the file impact_modalb~.pd_darwin in that folder.
- Open Pd (close first if open), then load the same example file you tried earlier.
I did all the above and it worked.
afsacp
-
afsacp
@me-andmymonkey, check the folder again. A subfolder now contains the 64bit version. It should be noted that building this version raised a lot of flags regarding data type conversion. I'm frankly a bit fuzzy on this, but the idea is that different data types require different sizes, and the compiler builds it according to that and to the architecture selected, so that an integer in 32bit arch should be 4 bytes, but in 64bit should be 8bytes, and so on. So this could raise issues with precision, rounding off errors, etc. Like I said, fuzzy.
In any case, try to work with the 32bit version first, attempting to find a suitable location for the externals. I'll keep looking through my references.
-
afsacp
OK. I'll try rebuilding at 64bit. However... the message you get is typical of Pd not being able to find the object. If the architecture was wrong, like if the external was built for x86-64 instead of the i386 (which is 32bit), Pd would complain:
/Library/Pd/impact_modalb~.pd_darwin: dlopen(/Library/Pd/impact_modalb~.pd_darwin, 10): no suitable image found. Did find:
/Library/Pd/impact_modalb~.pd_darwin: mach-o, but wrong architecturePerhaps some other members can pitch in with regards to potential location of the externals. The location I suggested has worked for me from first try. Good luck!
-
afsacp
@niku & @me-andmymonkey, I can point you to some of the documents to create working dynamic libraries in Xcode for use as externals:
http://puredata.info/docs/developer/PdExternalsInXcode
The link below has become the reference for writing externals in C.
http://pdstatic.iem.at/externals-HOWTO/
The actual compiling is relatively easy if you've done some of it already. But the solution might be relatively simple (I hope!), and it might be that Pd can't see the external yet. Which is why learning the behavior of Pd upon attempting to instantiate the external is so crucial. Let me know!
-
afsacp
@me-andmymonkey, it might be helpful to know the following:
- What OSX version you're using
- What kind of error message you get when trying to instantiate the external in Pd
- What version of Pd you are using