[PD-dev] compile pd with cygwin

Patrice Colet pat at mamalala.org
Mon Dec 3 07:29:35 CET 2007

Martin Peach a écrit :
> Patrice Colet wrote:
>> Hello!
>>   I've added -mno-cygwin and -I/cygdrive/c/Mingw/include 
>> -L/cygdrive/c/Mingw/lib because:
>> 1° The __WIN32 flag doesn't work with cygwin
>> 2° there is a cruel conflict with errno.h cygwin version.
>> So it's not possible to compile with cygwin without mingw, unless using 
>>   voodoo...
> Well it seems like the Windows API that mingw provides is essential for 
> the audio and midi interfaces, unless you have a precompiled portmidi 
> and portaudio. The rest could be done in cygwin's pseudo-unix, probably 
> not GEM though. I think if there was a tcl/tk for cygwin it would be 
> even more compatible with the unix version.

  I'm trying right now the voodoo solution, because magiks are so 

cc -g -O2 -DPD  -Wall -W -Wstrict-prototypes -Wno-unused 
-Wno-parentheses -Wno-s
taudio/pa_common -I../portaudio/pablio  -I../portaudio/pa_asio 
_common -I../portmidi/porttime  -I../portmidi/pm_win -I../portmidi/pm_win_ds
  -mms-bitfields  -M g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c 
.c g_io.c g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c 
g_editor.c g_all
_guis.c g_bang.c g_hdial.c g_hslider.c g_mycanvas.c g_numbox.c 
g_toggle.c g_vdia
l.c g_vslider.c g_vumeter.c m_pd.c m_class.c m_obj.c m_atom.c m_memory.c 
f.c m_conf.c m_glob.c m_sched.c s_main.c s_inter.c s_file.c s_print.c 
  s_path.c s_entry.c s_audio.c s_midi.c d_ugen.c d_ctl.c d_arithmetic.c 
d_osc.c d
_filter.c d_dac.c d_misc.c d_math.c d_fft.c d_array.c d_global.c 
d_delay.c d_res
ample.c x_arithmetic.c x_connective.c x_interface.c x_midi.c x_misc.c 
x_time.c x
_acoustics.c x_net.c x_qlist.c x_gui.c x_list.c d_soundfile.c 
s_midi_pm.c      s
_audio_pa.c s_audio_pablio.c s_audio_paring.c 
allocation.c          ../portaudio/pa_common/pa_converters.c 
io/pa_common/pa_cpuload.c             ../portaudio/pa_common/pa_dither.c
process.c             ../portaudio/pa_common/pa_skeleton.c 
io/pa_common/pa_stream.c              ../portaudio/pa_common/pa_trace.c
_hostapis.c           ../portaudio/pa_win_wmme/pa_win_wmme.c 
pm_common/portmidi.c                ../portmidi/pm_win/pmdll.c
                     ../portmidi/porttime/ptwinmm.c d_fft_mayer.c 
 > makefile.dependencies
cc -g -O2 -DPD  -Wall -W -Wstrict-prototypes -Wno-unused 
-Wno-parentheses -Wno-s
taudio/pa_common -I../portaudio/pablio  -I../portaudio/pa_asio 
_common -I../portmidi/porttime  -I../portmidi/pm_win -I../portmidi/pm_win_ds
  -mms-bitfields  -DINSTALL_PREFIX=\"/usr/local\"  -c -o 
../obj/m_binbuf.o m_binb
m_binbuf.c: In function `binbuf_read':
m_binbuf.c:733: attention : d'eclaration implicite de la fonction << 
lseek >>
m_binbuf.c:738: attention : d'eclaration implicite de la fonction << 
close >>
m_binbuf.c:741: attention : d'eclaration implicite de la fonction << read >>
cd ../obj;  cc   -o ../bin/pd g_canvas.o g_graph.o g_text.o g_rtext.o 
g_template.o g_io.o g_scalar.o g_traversal.o g_guiconnect.o 
g_readwrite.o g_edit
or.o g_all_guis.o g_bang.o g_hdial.o g_hslider.o g_mycanvas.o g_numbox.o 
e.o g_vdial.o g_vslider.o g_vumeter.o m_pd.o m_class.o m_obj.o m_atom.o 
.o m_binbuf.o m_conf.o m_glob.o m_sched.o s_main.o s_inter.o s_file.o 
s_loader.o s_path.o s_entry.o s_audio.o s_midi.o d_ugen.o d_ctl.o 
  d_osc.o d_filter.o d_dac.o d_misc.o d_math.o d_fft.o d_array.o 
d_global.o d_del
ay.o d_resample.o x_arithmetic.o x_connective.o x_interface.o x_midi.o 
x_time.o x_acoustics.o x_net.o x_qlist.o x_gui.o x_list.o d_soundfile.o 
m.o s_audio_pa.o s_audio_pablio.o s_audio_paring.o 
ocation.o ../portaudio/pa_common/pa_converters.o 
ad.o ../portaudio/pa_common/pa_dither.o 
../portaudio/pa_common/pa_front.o ../por
taudio/pa_common/pa_process.o ../portaudio/pa_common/pa_skeleton.o 
pa_common/pa_stream.o ../portaudio/pa_common/pa_trace.o 
in_util.o ../portaudio/pa_win/pa_win_hostapis.o 
wmme.o ../portaudio/pa_win_ds/pa_win_ds.o 
o ../portmidi/pm_common/pmutil.o ../portmidi/pm_common/portmidi.o 
_win/pmdll.o ../portmidi/pm_win/pmwin.o ../portmidi/pm_win/pmwinmm.o 
/porttime/ptwinmm.o d_fft_mayer.o d_fftroutine.o  \
         -ldl -lm -lpthreadGC2 -lwsock32 -lwinmm -lole32 -lstdc++
m_binbuf.o: dans la fonction << binbuf_read >>:
ind'efinie vers << __imp___iob >>
ind'efinie vers << __imp___iob >>
ind'efinie vers << __imp___iob >>
m_binbuf.o: dans la fonction << binbuf_write >>:
ind'efinie vers << __imp___iob >>
s_main.o: dans la fonction << sys_argparse >>:
r'ef'erence in
d'efinie vers << __imp___iob >>
e plus de r'ef'erences ind'efinies suivent vers << __imp___iob >>
collect2: ld a retourn'e 1 code d''etat d'ex'ecution
make: *** [../bin/pd] Erreur 1

The source code modification is a little bit more complicated because 
cygwin uses headers from both msw and unix.

pa and pm seems to be built :), but I'm stuck on this last error caused 
by stdio.h, cygwin provides mingw headers, and the _imp____iob stuff is 
into /usr/include/mingw/stdio.h:

in /usr/include/mingw/stdio.h line 146


extern FILE (*_imp___iob)[];	/* A pointer to an array of FILE */

#define _iob	(*_imp___iob)	/* An array of FILE */

so I've included it like this:

#ifdef __CYGWIN__
#include <mingw/stdio.h>
#include <stdio.h>

This code seems to work for other files (I've tried it on g_canvas.c), 
but only if I put, like a Sorcerer's Apprentice, _mingw.h into 
/usr/include. Well, mingw seems not well implemented in cygwin.

I've also tried a turn by removing #ifndef __DECLSPEC_SUPPORTED just to 
see if it is related, but no luck...

This issue remains mysterious.

  Also I'm still optimistic about Gem because ogl and some other graphic 
stuff are implemented by cygwin.

More information about the Pd-dev mailing list