[PD-dev] Patch for FreeBSD 6.0 (almost) (attempt two)

mal content artifact.one at googlemail.com
Thu Jun 1 15:22:18 CEST 2006


(Sent again, I think the first message was rejected on the list
due to it having an attachment. The patch is now included inline)

Hi.

I've nearly managed to get pd-0.40-test2 from CVS to compile
on FreeBSD 6.0.

I'm having some trouble though.

The work is mostly based on these patches:

http://www.freebsd.org/cgi/cvsweb.cgi/ports/audio/pd/files/

However, they aren't all relevant and they are for a version of
pd released a LONG time ago.

I am getting this linker error on the last stage of compilation:

cd ../obj;  cc -L/usr/local/lib  -o ../bin/pd g_canvas.o g_graph.o
g_text.o g_rtext.o g_array.o g_template.o g_io.o g_scalar.o
g_traversal.o g_guiconnect.o g_readwrite.o g_editor.o g_all_guis.o
g_bang.o g_hdial.o g_hslider.o g_mycanvas.o g_numbox.o g_toggle.o
g_vdial.o g_vslider.o g_vumeter.o m_pd.o m_class.o m_obj.o m_atom.o
m_memory.o m_binbuf.o m_conf.o m_glob.o m_sched.o s_main.o s_inter.o
s_file.o s_print.o s_loader.o s_path.o s_entry.o s_audio.o s_midi.o
d_ugen.o d_ctl.o d_arithmetic.o d_osc.o d_filter.o d_dac.o d_misc.o
d_math.o d_fft.o d_mayer_fft.o d_fftroutine.o d_array.o d_global.o
d_delay.o d_resample.o x_arithmetic.o x_connective.o x_interface.o
x_midi.o x_misc.o x_time.o x_acoustics.o x_net.o x_qlist.o x_gui.o
x_list.o d_soundfile.o s_audio_oss.o  \
-lm -lpthread
m_glob.o(.text+0x476): In function `glob_init':
/home/aone/cvs/external/pd/src/m_glob.c:117: undefined reference to
`glob_watchdog'
s_inter.o(.text+0x5be): In function `sys_bail':
/home/aone/cvs/external/pd/src/s_inter.c:1270: undefined reference to
`sys_close_midi'
s_midi.o(.text+0x18b): In function `sys_putnext':
/home/aone/cvs/external/pd/src/s_midi.c:117: undefined reference to
`sys_putmidibyte'
s_midi.o(.text+0x1c6):/home/aone/cvs/external/pd/src/s_midi.c:118:
undefined reference to `sys_putmidimess'
s_midi.o(.text+0x923): In function `sys_pollmidiqueue':
/home/aone/cvs/external/pd/src/s_midi.c:464: undefined reference to
`sys_poll_midi'
s_midi.o(.text+0x9ff): In function `sys_open_midi':
/home/aone/cvs/external/pd/src/s_midi.c:531: undefined reference to
`midi_oss_init'
s_midi.o(.text+0xa64):/home/aone/cvs/external/pd/src/s_midi.c:539:
undefined reference to `sys_do_open_midi'
s_midi.o(.text+0xafd): In function `sys_listmididevs':
/home/aone/cvs/external/pd/src/s_midi.c:572: undefined reference to
`midi_getdevs'
s_midi.o(.text+0xc4b): In function `glob_midi_properties':
/home/aone/cvs/external/pd/src/s_midi.c:656: undefined reference to
`midi_getdevs'
s_midi.o(.text+0x1001): In function `glob_midi_setapi':
/home/aone/cvs/external/pd/src/s_midi.c:619: undefined reference to
`sys_close_midi'
s_midi.o(.text+0x10f1): In function `glob_midi_dialog':
/home/aone/cvs/external/pd/src/s_midi.c:761: undefined reference to
`sys_close_midi'
s_midi.o(.text+0x1046): In function `glob_midi_setapi':
/home/aone/cvs/external/pd/src/s_midi.c:632: undefined reference to
`sys_close_midi'
x_midi.o(.text+0xf84): In function `midiout_float':
/home/aone/cvs/external/pd/src/x_midi.c:681: undefined reference to
`sys_putmidibyte'
gmake: *** [../bin/pd] Error 1

I believe the original patches above just disabled midi in order to avoid
this error, but that's hardly correct now, is it?

Here is my current patch, which adds a few #ifdefs here and there
and includes a new section in configure.in. I'd be obliged if somebody
could help me work out why I'm seeing the above linker errors.

--- configure.in.orig	Thu Jun  1 11:29:43 2006
+++ configure.in	Thu Jun  1 12:39:18 2006
@@ -81,6 +81,15 @@

 dnl look for tcl 8.x... do I really have to go through all this!?

+dnl need to modify CFLAGS and LDFLAGS on FreeBSD in order to search
+dnl /usr/local/*
+
+if test `uname -s` = FreeBSD;
+then
+  CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+  LDFLAGS="$LDFLAGS -L/usr/local/lib"
+fi
+
 foundit=no
 if test $foundit == "no";
 then
@@ -122,22 +131,39 @@
     exit -1
 fi

+dnl FreeBSD has libtcl8X.so, not libtcl8.X.so
+
 AC_CHECK_LIB(tcl8.7, main,,
+AC_CHECK_LIB(tcl87, main,,
     AC_CHECK_LIB(tcl8.6, main,,
+  AC_CHECK_LIB(tcl86, main,,
 	AC_CHECK_LIB(tcl8.5, main,,
+    AC_CHECK_LIB(tcl85, main,,
 	    AC_CHECK_LIB(tcl8.4, main,,
+      AC_CHECK_LIB(tcl84, main,,
 		AC_CHECK_LIB(tcl8.3, main,,
+        AC_CHECK_LIB(tcl83, main,,
 		    AC_CHECK_LIB(tcl8.2, main,,
-        		AC_CHECK_LIB(tcl8.0, main,,echo no tcl library found || exit 1)))))))
+          AC_CHECK_LIB(tcl82, main,,
+            AC_CHECK_LIB(tcl8.0, main,,
+            AC_CHECK_LIB(tcl80, main,,echo no tcl library found ||
exit 1))))))))))))))
+
+dnl FreeBSD has libtk8X.so, not libtk8.X.so

 AC_CHECK_LIB(tk8.7, main,,
+AC_CHECK_LIB(tk87, main,,
     AC_CHECK_LIB(tk8.6, main,,
+  AC_CHECK_LIB(tk86, main,,
 	AC_CHECK_LIB(tk8.5, main,,
+    AC_CHECK_LIB(tk85, main,,
 	    AC_CHECK_LIB(tk8.4, main,,
+      AC_CHECK_LIB(tk84, main,,
 		AC_CHECK_LIB(tk8.3, main,,
+        AC_CHECK_LIB(tk83, main,,
 		    AC_CHECK_LIB(tk8.2, main,,
-        		AC_CHECK_LIB(tk8.0, main,,echo no tk library found || exit 1)))))))
-
+          AC_CHECK_LIB(tk82, main,,
+            AC_CHECK_LIB(tk8.0, main,,
+            AC_CHECK_LIB(tk80, main,, echo no tk library found ||
exit 1))))))))))))))

 if test `uname -s` = Linux;
 then
@@ -322,6 +348,38 @@
     then
         LDFLAGS=$LDFLAGS" -weak_framework Jack"
     fi
+fi
+
+if test `uname -s` = FreeBSD;
+then
+    EXT=pd_freebsd
+    MORECFLAGS="-DPA_USE_OSS -DPA_LITTLE_ENDIAN -DUNIX -DUNISTD\
+      -DUSEAPI_OSS \
+        -I../portaudio/pa_common \
+        -I../portaudio/pablio -I../portaudio/portmidi-macosx \
+        -Werror -fno-strict-aliasing"
+    SYSSRC="s_audio_oss.c"
+    if test x$portaudio == "xyes";
+    then
+     MORECFLAGS="-DUSEAPI_PORTAUDIO "$MORECFLAGS
+ SYSSRC="s_audio_pa.c \
+ ../portaudio/pa_common/pa_allocation.c  \
+ ../portaudio/pa_common/pa_converters.c  \
+ ../portaudio/pa_common/pa_cpuload.c     \
+ ../portaudio/pa_common/pa_dither.c      \
+ ../portaudio/pa_common/pa_front.c       \
+ ../portaudio/pa_common/pa_process.c     \
+ ../portaudio/pa_common/pa_skeleton.c    \
+ ../portaudio/pa_common/pa_stream.c      \
+ ../portaudio/pa_common/pa_trace.c       \
+ ../portaudio/pablio/pablio_pd.c         \
+ ../portaudio/pablio/ringbuffer_pd.c     \
+ ../portaudio/pa_unix/pa_unix_hostapis.c \
+ ../portaudio/pa_unix/pa_unix_util.c     \
+ ../portaudio/pa_unix_oss/pa_unix_oss.c "$SYSSRC
+    fi
+    GUINAME="pd-gui"
+    OSNUMBER=0
 fi

 # support for jack, on either linux or darwin:
--- d_osc.c.orig	Thu Jun  1 12:42:15 2006
+++ d_osc.c	Thu Jun  1 12:48:12 2006
@@ -30,6 +30,11 @@
 #include <machine/endian.h>
 #endif

+#if defined(__FreeBSD__)
+#define __BYTE_ORDER _BYTE_ORDER
+#define __LITTLE_ENDIAN _LITTLE_ENDIAN
+#endif
+
 #ifdef __APPLE__
 #define __BYTE_ORDER BYTE_ORDER
 #define __LITTLE_ENDIAN LITTLE_ENDIAN
--- s_audio_oss.c.orig	Thu Jun  1 12:22:20 2006
+++ s_audio_oss.c	Thu Jun  1 12:49:23 2006
@@ -5,7 +5,12 @@

 /* this file inputs and outputs audio using the OSS API available on linux. */

+/* OSS != Linux */
+#if defined(__FreeBSD__)
+#include <sys/soundcard.h>
+#else
 #include <linux/soundcard.h>
+#endif

 #include "m_pd.h"
 #include "s_stuff.h"
--- s_stuff.h.orig	Thu Jun  1 12:26:28 2006
+++ s_stuff.h	Thu Jun  1 12:49:56 2006
@@ -174,6 +174,10 @@
 #define API_DEFAULT API_OSS
 #define API_DEFSTRING "OSS"
 #endif
+#ifdef __FreeBSD__
+#define API_DEFAULT API_OSS
+#define API_DEFSTRING "OSS"
+#endif
 #ifdef MSW
 #define API_DEFAULT API_MMIO
 #define API_DEFSTRING "MMIO"
--- x_list.c.orig	Thu Jun  1 12:40:36 2006
+++ x_list.c	Thu Jun  1 12:51:26 2006
@@ -4,10 +4,16 @@

 #include "m_pd.h"
 /* #include <string.h> */
+
 #ifdef MSW
 #include <malloc.h>
 #else
+/* stuff in malloc.h and alloca.h is in stdlib.h on FreeBSD */
+#if defined(__FreeBSD__)
+#include <stdlib.h>
+#else
 #include <alloca.h>
+#endif
 #endif

 extern t_pd *newest;

cheers,
MC




More information about the Pd-dev mailing list