Problem compiling external on Windows
This has been answered on pd-list today
Hopefully this is helpful to others. I never go near Windows myself,
but anyway, post copied verbatim for the benefit of all...
> Iohannes Zmoelnig wrote:
> have you tried any online resources: e.g.
> http://puredata.info/docs/developer lists at least 2 pages that only
> deal with compiling on windows
> (http://puredata.info/docs/developer/mingw which basically deals with
> compiling pd itself on windows; but once you are there, it is simple;
> http://nul.jp/2002/pd_bc deals with compiling externals with the
> borland-compiler).
> i can give you a step-by-step guide for compiling zexy though (but mind
> that this is how i _remember_ it; i will not go and search for a windows
> machine with VC installed just to verify each step).
> - purchase M$ VC6 (elitarism on my side...:-)) and install it
> - get pd
> - download zexy (sources!) for free (e.g.
> ftp://ftp.iem.at/pub/pd/Externals/ZEXY/)
> - extract zexy to you favourite folder
> - double-click on the zexy.dsp (or was it zexy.dsw??) in the zexy/src/
> folder; this should open VC
> - to to the Project->Properties (or however this is called in your
> locale) and change the settings to match your setup (mainly these are
> the paths to find pd's headers and libraries; you should basically go
> through every item in the settings for the "release" and/or "debug"
> builds; the most important stuff is in "compiler->preprocessor",
> "compiler->path" and "linker->path"
> - when you are finished, return to the main project window
> - hit "F7" to start the build.
> - if you encounter any errors, either the settings are not yet correct
> (return to item-6) or the project is a bit out-of-date; the latter
> basically means, that the c-files to be included have not been updated;
> to fix this, just delete all the c-files from the project file browser
> (here this used to be un the left-side of the project-window), then
> right click on the folder in the project file browser that used to
> contain these files and select "add"; in the openpanel choose all
> c-files in zexy/src and hit "OK"
> - return to item-8 until you stop getting errors
> mind, that you must not use the dll while it is created (best close pd)
> if you want step-by-step instructions for vc7, vc2000, vc2006 and
> vc3000, please send them to me and i'll give it a go (dev-elitarism
> again)
> pd comes with some externals (e.g. the foo-stuff, or [fiddle~]) and uses
> makefiles to build these.
> for this to work, you have to setup your environment correctly:
-> first open the makefile (e.g. pd/doc/6.externs/makefile) with your
> favourite text-editor and correct all the paths that are wrong
> - VC6 came with a vc6vars.bat (ok the name is wrong but something along
> these lines; it was a .bat-file which would set your envirnment
> variables when run; more modern incarnations might do without the .bat
> - open the dosbox (the rest will happen within the dosbox)
> - run the vc6vars.bat (or however it is called) if this is needed for
> your compiler-incarnation
> - cd to your path (e.g. pd/doc/6.externs/)
> - run "nmake pd_nt"
> if nmake, cl, link cannot be found, you might want to add the paths to
> them to your PATH variable.
Martin Peach wrote:
> If you're on some kind of MSVC, you set up a project to build a dll, in
> "preprocessor defines" define MSW, in "additional include paths" include
> the path to pd/src/m_pd.h, link with pd.lib from pd/bin, and in the
> linker command line add "/export:yourexternal_setup" to export the setup
> function. All the other functions in your code can be static and don't
> need to be exported. After it builds you take the dll from the release
> folder and put it in your pd/extra folder.
> That should be everything you need, but if it's too cryptic I can go
> into more detail...
> Martin
Problem compiling external on Windows
I'm having trouble getting the helloworld external to compile properly on Windows.
The main resource is apparently this: HOWTO write an External for puredata, and some previous posts on this topic are here: Compiling new external, Max/MSP microtuning externals to convert to pd
Bear with me, because working with the C compiler is still rather mysterious to me, so I may be making some obvious mistakes. I've installed the djgpp compiler, and followed all the instructions as best as I could. I'm working on XP. I put "m_pd.h" (from the pd/src/ folder) and "helloworld.c" in the same folder and from that directory on the command line (in a DOS "Command Prompt" window) typed:
gcc -c helloworld.c -o helloworld.o
As far as I can tell, this successfully produced the "helloworld.o" object file in the same directory as the "helloworld.c" file. Then I typed:
ld -export_dynamic -shared -o helloworld.dll helloworld.o -lc -lm
Which, as I understand, is the "linking" step, and the only difference between this command and the command for linux is that ".pd_linux" is replaced with ".dll". Anyway, the compiler responded with:
c:/progra~1/djgpp/bin/ld.exe: -shared not supported
So, not having any other ideas, I tried omitting the -shared flag:
ld -export_dynamic -o helloworld.dll helloworld.o -lc -lm
That produced this response:
c:/progra~1/djgpp/bin/ld.exe: warning: cannot find entry symbol xport_dynamic; defaulting to 000018d0
helloworld.o:helloworld.c:(.text+0x1e): undefined reference to `post'
helloworld.o:helloworld.c:(.text+0x37): undefined reference to `pd_new'
helloworld.o:helloworld.c:(.text+0x60): undefined reference to `gensym'
helloworld.o:helloworld.c:(.text+0x79): undefined reference to `class_new'
helloworld.o:helloworld.c:(.text+0x96): undefined reference to `class_addbang'
Why is -shared not supported and what can I do to fix that? I tried Microsoft Visual C++ Express Edition, but found the interface bewildering. I don't think I could even find the words "compile" and "link" in any menu...
Then I looked in the "0.README" file located in the pd/doc/6.externs/ directory, and found this line (in reference to the 3 example enternals in that folder):
To compile, type "make pd_linux", "nmake pd_nt", "make pd_irix5" or "make pd_irix6".
If I wanted to compile these, where would I even type this? Is "nmake" an actual command?
Then I tried poking around the GNU info files, and saw some vague information about "binutils" and "dlltool" but it is so beyond me right now that I'm turning here. Could someone please enumerate the steps required to take the C source file "helloworld.c" and make it into a usable object in pd without skipping any steps? I (and I'm sure many others) would greatly appreciate that.
Thanks in advance!
Compiling new external
Hi Leo,
compilation of the external depends, first of all, on the operating system
you use to run PD. For example on Windows you have two ways:
Microsoft VIsual C++ (MSVC) (or Borland C++) offer integrated environments
for writing, compilation and debug;
Cygwin or MSYS on the other hand offer you all the tools you need
in a "unix" style like the compiler gcc, the make utility etc.. (I prefer the latter
solution, I'm old style .
On linux the "native" way is to use the shell and the gcc/makefile tools,
but also there you have integrated environments.
Don't know about Mac OSx.
To make it easy, suppose you have to compile the helloworld.c you find at
the end of the post from the command line (in linux):
First of all copy the file m_pd.h (you should have it somewhere in
your PD distribution) in the directory where you placed helloworld.c. Then
> gcc -c helloworld.c -o helloworld.o
> ld -export_dynamic -shared -o helloworld.pd_linux helloworld.o -lc -lm
congratulations, you've done it!
The first is the compilation step, the second is the link.
At this point copy the file helloworld.pd_linux in a directory that
PD can find (the /extra directory could be a good place). Start PD,
open new patch, create the object [helloworld] ad it should be ok!
(it should create without errors..)
good luck!
Alberto
--------------------------- helloworld.c -----------------------------------
#include "m_pd.h"
static t_class *helloworld_class;
typedef struct _helloworld {
t_object x_obj;
} t_helloworld;
void helloworld_bang(t_helloworld *x)
{
post("Hello world !!");
}
void *helloworld_new(void)
{
t_helloworld *x = (t_helloworld *)pd_new(helloworld_class);
return (void *)x;
}
void helloworld_setup(void) {
helloworld_class = class_new(gensym("helloworld"),
(t_newmethod)helloworld_new,
0, sizeof(t_helloworld),
CLASS_DEFAULT, 0);
class_addbang(helloworld_class, helloworld_bang);
}
-------------------end helloworld.c-------------------------
Has anyone used readanysf~
has anyone used this
You seem to have to compile and install 'flext' so that you can use that to compile 'readanysf~'.
I'm having crap loads of problems compiling and installing flext. I just can't do it.
I'm using pd-extended 0.38.4 and realise that you have to have the pd source code to compile 'flext', for some reason, so I downloaded the source code for 0.38.4 and transplanted it into the contents of the pd-extended.app. Is thisa wrong.
any tips would be loved with the intensity usually attributted to small warm furry creatures.
please
thanks
Iain
Need help with PD externals
SUBJECT: Need help with PD externals
Hi,
-
I have written some code in C/C++. I would now like to create a pd external and be able to run my C/C++ code in pd (windows environment). I would like my PD object to have say 3-4 inlets and 2-3 outlets.
Furthermore at least one of the inlets would contain compound data, something like an array of 10-15 floats.
Thus my external would be a bit more complex than the 'very basic one', which has a single float as inlet, & a single float as outlet. -
I work in the windows environment (currently my operating environment has pentium machines with windows operating systems installed on them (windows XP, or windows 2000 Professional).
I am using a the free DevCPP or DevC++ compiler (version 4.9.9.2) the IDE, (which uses the gnu C compiler MinGW at its base). Furthermore, I am using: Pd version 0.38.4-extended-RC8 (windows platform). I wonder if someone has already developed externals in a same (or similar, i.e. Windows) environment.
- If someone has, can you please mail me a simple compilable code that you might have had prepared, and guide me through the exact steps which one must follow to make a pd external.
- I wish to know, if in the Windows/DevCPP compiler environment, whether it is possbile to create a PD external without creating a dll in windows, or is it always necessary to first create a dll, even in the simplest case?
- Last, but not the least, I must mention here that I don't have "a lot" of experience in pd, so I will appreciate if someone could explain things in an easy to understand style.
But in any case, I will ask again, in case I don't understand something.
I hope that should work.
Thanks and regards,
ps:
The following should actually have been posted as a separate thread, but since its related to the topic above, i continue to write it here:
In addition to what I have asked for above, I would also like some feedback on the following...
SUBJECT2: Creating/Compiling PD externals
My previous unsucessful attempts at creating/understanding the PD external:
I had tried to read through, and tried to implement the sample code in the tutorial, named:
"How to write an External for puredata" available at the iem site...
But I am facing a few problems, and here are some specific queries related to that:
A.) While in the windows environment, must one always need to create a dll first, or is it possible to create a PD external in any other way as well?
B.) If one must do it by first creating a dll, then the code as mentioned in the tutorial would need to be modified and can't just be copy+pasted & compiled directly. I.e.
One needs to paste the data declaration part in the header;
ii) Also one must declare all the subroutine (i.e. procedures/methods) names in the header file as well, while their definition or implementation goes in another main file, which must include our earlier created header file; and finally
iii) One must insert a special prefix before all the methods when are required for the dll...
Am I right about the 3 above mentioned points?
Thanks yet again,
Audio port control and tempo recognition
Hello,
I've compiled and tried it last year on Fedora core 4 on a 32bit system, it worked fine.
I am just starting compilation on windows yet.
I will try to make a dll as soon as possible, this does not mean that I am able to do it.
If you want to try, I invite you to follow the HC's instruction for compiling with mingw.
or,
Get linux and compile it from cvs:
http://pure-data.cvs.sourceforge.net/pure-data/externals/rhythm_estimator/
oh sorry I've made a typo on this external name, it's because I didn't use it since last year, my bad.
Patco.
Gridflow windows version ???
In fact that is not a joke:
http://gridflow.ca/gallery/gridflow_win32.png
Some instructions for making it running good:
<carmen> patco: ive compiled it twice on 2 difft machines with 2 diff versions of ruby and 2 diff versions of mingw/GCC
<carmen> patco: works fine, mostly. a few patches have a tendency to lock up the SDL window ithik it was due to the cpu usage and shitty windows scheduler
<carmen> patco: any fixes (mostly related to the STACK_BASE) should be commtied to CVS
<carmen> patco: im pretty sure ive run it with 1.8 and 1.9... you could try downloading the dependent ruby dll's but who knows what version i compiled against, better to compile fresh if youre serious about running gf on windows..
[ven jan 20 2006] [07:35:07] <patco> Oh, I was sure that a ruby dll was necessary... I will post all your instructions into the forum to be sure that I've not ommited anything, thanks.
[ven jan 20 2006] [07:35:32] <carmen> yep
[ven jan 20 2006] [07:35:34] <carmen> the dll isnt enough
[ven jan 20 2006] [07:35:37] <carmen> you really need the whole thing
[ven jan 20 2006] [07:35:45] <carmen> ruby dirs, libs, .rb files, gridflow.so, etc
[ven jan 20 2006] [07:35:54] <carmen> and libjpeg etc
[ven jan 20 2006] [07:36:02] <carmen> its best to just install minGW and then compile
[ven jan 20 2006] [07:36:17] <carmen> otherwise you will likely never recreate the exact combination of working files
[ven jan 20 2006] [07:36:33] <patco> Oh even gridflow.so?! I think I'd rather use mingw, yeah
[ven jan 20 2006] [07:37:29] <carmen> yah
[ven jan 20 2006] [07:37:32] <carmen> i had a rar up a few times
[ven jan 20 2006] [07:37:37] <carmen> i think chikun tried it and it didnt work
[ven jan 20 2006] [07:38:06] <carmen> the preferred OS for gridflow is linux, or anything with nice X windows support
[ven jan 20 2006] [07:38:17] <carmen> anything that supports sdl and ruby and GCC should work though
patco
Gridflow on agnula demudi ?
arrrrrgggg:
This is the GridFlow 0.8.0 configurator within Ruby version 1.8.2
[fast] Compile for speed (and not debuggability): enabled
[gcc3] GNU C++ Compiler 3: missing (undefined method `<' for nil:NilClass)
[stl] C++ Standard Template Library: missing (gcc compilation error)
[gcc64] GNU C++ in 64-bit mode: missing (gcc compilation error)
[libruby] Ruby as a dynamic library: missing (gcc compilation error)
[librubystatic] Ruby as a static library: missing (gcc compilation error)
[pentium] Pentium-compatible CPU: missing (gcc compilation error)
[mmx] MMX-compatible CPU (using NASM): disabled (would need pentium)
[simd] SIMD (MMX/SSE/Altivec) (using GCC): disabled (would need pentium)
[profiler] profiler (speed measurements): disabled (would need pentium)
[usb] USB Library: missing (where is usb.h ?)
[ieee1394] IEEE1394 Libraries for Linux (raw1394/dc1394): disabled (by author)
[x11] X11 Display Protocol: missing (where is X11/Xlib.h ?)
[x11_shm] X11 acceleration through shared memory: disabled (would need x11)
[sdl] Simple Directmedia Layer (experimental support): missing (where is SDL/SDL.h ?)
[objcpp] GNU/Apple ObjectiveC++ Compiler: missing (where is objc/Object.h ?)
[quartz] Apple Quartz/Cocoa Display: disabled (would need objcpp)
[aalib] Ascii Art Library: missing (where is aalib.h ?)
[jpeg] JPEG Library: missing (where is jpeglib.h ?)
[png] PNG Library <libpng12/png.h>: missing (where is libpng12/png.h ?)
[png] PNG Library <png.h>: missing (where is png.h ?)
[videodev] Video4linux Digitizer Driver Interface: missing (gcc compilation error)
[mpeg3] HeroineWarrior LibMPEG3 <libmpeg3/libmpeg3.h>: missing (where is libmpeg3/libmpeg3.h ?)
[mpeg3] HeroineWarrior LibMPEG3 <libmpeg3.h>: missing (where is libmpeg3.h ?)
[quicktimeapple] Apple's QuickTime: missing (gcc compilation error)
[quicktimehw] HeroineWarrior QuickTime4Linux (or LibQuickTime) (try #1): missing (gcc compilation error)
[quicktimehw] HeroineWarrior QuickTime4Linux (or LibQuickTime) (try #2): missing (gcc compilation error)
[xine] Xine movie decoder: disabled (by author)
[puredata] Miller Puckette's Pure Data: disabled (would need libruby or librubystatic)
generating ./config.make
generating config.h
creating Makefile
humm.... it will probably compile but seem will could do not much without jpeg png video4linux X11 etc....
will wait a .deb package...
Installing CVS - I don't understand
pencilina - CVS isn't difficult, once you get the hang of it. The easiest way is to type commands in a terminal/console window - "cvs checkout" downloads modules from CVS, and "cvs update" synchronises your local copy of the source tree with the one on the CVS server (much quicker than downloading the whole lot again). Brief guide to CVS is here: [url=http://pure-data.sourceforge.net/developer.php
]http://pure-data.sourceforge.net/developer.php
Compiling is a little harder than getting the sources, you need to have a working development environment - compiler, make tools, system headers, etc. Once you have that set up, in a terminal window at the directory containing the "Makefile", type "make" and it will compile, and then "make install" and it will install what you have just compiled.
There are OSX and Windows installers here: http://puredata.info/Members/hans/downloads/installers/