Great. There were talks at some point in the Pd mailing list about making that #define
a run-time variable, but nothing came out of it I think.
Compiling puredata externals
I'm working on a project where some existing externals would come in really handy. I have to confess that I'm struggling a bit trying to work out a method to compile and install based on the above discussion, has anyone got a set of instructions that I could try to follow?
Also seems worth asking: has anyone had any luck with the cyclone objects? I noticed mention of a compatibility issue on another thread https://forum.bela.io/d/374-reading-jpeg-or-video-from-sd-card-to-bela-as-arrays
cmm Also seems worth asking: has anyone had any luck with the cyclone objects?
now we are on Pd 0.48, so cyclone should work now. Also, something else has changed from the earlier part of this thread: the m_pd.h
file needed by the externals now lives in /usr/local/include/libpd
.
cmm to confess that I'm struggling a bit trying to work out a method to compile and install based on the above discussion, has anyone got a set of instructions that I could try to follow?
It really depends on the build method used by the externals that you want to compile. In the case of cyclone, it seems that it is using pd-lib-builder. Looking at the built-in readme it seems that you can simply do:
make PDINCLUDEDIR=/usr/local/include/libpd PDLIBDIR=/root/Bela/projects/pd-externals install
The PDLIBDIR
points to the path where the built externals will be copied (this is one of the paths were our Pd wrapper checks for externals).
However, the above fails, because cyclone
needs some more header files than the ones we ship with libpd
(maybe I should just include them all?). So you will have to grab a copy of our Pd fork here and put it on the board, e.g.: in /root/pure-data
. At that point, change the line above to
make PDINCLUDEDIR=/root/pure-data/src/ PDLIBDIR=/root/Bela/projects/pd-externals install
also make sure your Bela code is updated to the latest version (which will guarantee the header files you get from our pure-data fork will match the version of libpd you have installed)!
Doing the above successfully builds and install cyclone (it takes about 10min). Then I verified that I can create a cyclone object in a Pd patch (e.g.: [cyclone/delay~]
), so it seems to work, but I have not tested functionalities.
hey guys,
just my two cents here.
I m working on a project with Bela and successfully using PD externals compiled with a Raspberry Pi3.
I started from the assumption that if the external was compiled on ARM, then it might work on another ARM based Linux platform and indeed most of them did work (including cyclone).
@giuliomoro : any possible negative consequences by doing this?
Thank you
L
It really depends on the Pd external in question and its dependencies. Only the file m_pd.h
is guaranteed to never change for Pd (or to change in a backwards compatible way). This means that as long as the external was built for an older version of Pd than the one you have and it was only using m_pd.h
, then you are most likely fine, assuming:
- same architecture
- that you have on your system any shared libraries that your external depends on
- that the shared libraries you have are compatible (e.g.: your version is the same or is backwards compatible)
however, if the externals use some more of Pd's .h
files, then in order to have guaranteed working externals, they'd have to be built specifically for the version of Pd you are running on. This means same version, but also same fork. In the case of our fork, the changes are minimal, and you'd probably be fine with something built for the same version of Pd.
cyclone
does use some Pd's internal .h
, so I'd recommend you build it on the board, however you are free to try with the pre-built binaries and check if practically it works ok or not.
- Edited
Ok clear, thanks a lot for the explanation.
I actually compiled with success also libraries with other dependencies (like the brilliant TimbreID by William Brent), always on a RPi3, then copied the binaries in my Bela project folder. But yeah, will definitely try to compile something directly on the Bela next time.
Anyway, for what it matters, I haven't experienced any problems so far with debian pre-built cyclone (although I have used a fraction of the available objects).
My biggest worry was more if that could lead to crashes or any sort of instability?
giuliomoro Thanks. That worked, patching on Bela is going to be so much smoother with these as a former Max-head! Important to note that you need to include the cyclone/ part of the object name..I wouldn't have thought of that.
cmm Important to note that you need to include the cyclone/ part of the object name..I wouldn't have thought of that.
yes I mentioned it up here
giuliomoro (e.g.: [cyclone/delay~]),
This is due to the folder structure of the Cyclone externals: all the externals live as file in the cyclone/
folder. If you want, you can add another line
libpd_add_to_search_path("../pd-externals/cyclone");
to the core/default_libpd_render.cpp
file, https://github.com/BelaPlatform/Bela/blob/master/core/default_libpd_render.cpp#L382-L383, if you want the setting to be applied to all your projects, or provide a custom render.cpp
file with this change if you want it to be applied only to a specific project.
giuliomoro yeah, I would have been lost if you hadn't said that, I was going in circles until I remembered your post. It's not something I've ever needed to do in Pd before.
- Edited
You have to do it also in Pd unless you set up the path in the preferences.
giuliomoro Hi, could you exactly explain how to do that? it doesn't seem to work for me...i have a patch .pd with a external library object; which file should i place inside projects/pd-externals? the .c or the .pd_linux? At the moment neither is working for me...
It's always the .pd_linux
that needs to go in projects/pd-externals
. If you have a library external, then you have to create an object with the name of the library FIRST, then you can create all the objects from the library. For instance:
[zexy]
then
[pack~]
CAVEAT: the main library object ([zexy]
) needs to be created BEFORE you try to create the individual objects. The order in which objects are created is the order in which they are in the plain-text representation of the Pd patch. Basically, there is no way of telling just by looking at the patch, and you cannot arbitrarily move them around in the text file. So the solution is: cut everything except the main library object, then paste everything: the newly pasted objects will be created by Pd after whatever was there.
Alternatively, the proper way of doing it should be: [declare -lib zexy]
, but I have not tested this on Bela.
giuliomoro So if i am using cyclone for example i will need cyclone.pd_linux plus object.pd_linux for each object i need? I tried to compile in the IDE the cyclone_lib.c file and it generated a cyclone_lib.pd_linux but it still prompts the same error: couldn't create...
Would you mind posting the process in steps or something similar?
londonpride I also tried to do it without the library object.
- uploaded the object.c
- uploaded a Makefile specific for the object.
- uploaded the needed headers and run the makefile in the IDE console.
Worked like a charm for some objects but others would still prompt: couldn't create...
londonpride Worked like a charm for some objects but others would still prompt: couldn't create...
What objects fail to create?
londonpride uploaded a Makefile specific for the object.
How did you generate the Makefile?
londonpride Would you mind posting the process in steps or something similar?
Was this not good enough?
giuliomoro i compiled [cyclone/cycle~] using the .c source code and worked perfectly, [cyclone/gate~] on the other hand compiled and created the .pd_linux file but would still fail to generate.
I created the makefile in sublime text and it worked for [cyclone/cycle~]
I am sorry if you misunderstood my asking for the steps, i didn't mean to diminish your explanation or anything is just that i am a bit of a newbie using pd on bela. I've only worked with c++ on bela before.
What is in these Makefile
s? Why don't you use the one that comes with the project?
Hello, I'm having a few issues compiling pd externals. I've worked through this post without success and I eventually found this very helpful guide: https://forum.bela.io/d/580-compiling-pd-externals-a-guide which clears most things up.
However, I'm still getting errors - "make: *** No targets specified and no makefile found. Stop" for [cyclone], [comport] and [list-abs] objects. I read the post above on [cyclone] and have taken the following steps:
- Updated Bela code
- Downloaded the PD fork and copied it into /root/pure-data
- then went back to Bela/projects/pd-externals/externals/cyclone and tried
'make PDINCLUDEDIR=/root/pure-data/src/ PDLIBDIR=/root/Bela/projects/pd-externals install'
But I'm getting "make: *** No rule to make target "install". Stop.
Any ideas?
what is in the folder Bela/projects/pd-externals/externals/cyclone
? You need to run the make ... install
command from within the folder obtained cloning the cyclone repo: https://github.com/porres/pd-cyclone.git
Great, thanks. Managed to successfully compile [cyclone] and [list-abs] objects now.
Having a slight issue with the cyclone -- coll object though. It turns the project window blank (although it doesn't say 'couldn't create' in the console). Not sure what's going on with it.
Also I haven't managed to compile the [comport] object. I can't find a Makefile for it. But in the readme file it says:
compile:
Unix (Linux):
make pd_linux, make pd_irix5, make pd_irix6, make pd_darwin
should produce a comport.pd_linux, ....
this is all new to me so not really sure what to do with that... do I still need a makefile from somewhere?