Subject: pkg/29206: cad/geda build failure on MacOS X 10.[12].x
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <jdbaker@mylinuxisp.com>
List: pkgsrc-bugs
Date: 02/02/2005 23:53:00
>Number:         29206
>Category:       pkg
>Synopsis:       cad/geda build failure on MacOS X 10.[12].x
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 02 23:53:00 +0000 2005
>Originator:     John D. Baker
>Release:        MacOS X 10.2.8
>Organization:
>Environment:
Darwin ed.technoskunk.fur 6.8 Darwin Kernel Version 6.8: Wed Sep 10 15:20:55 PDT 2003; root:xnu/xnu-344.49.obj~2/RELEASE_PPC  Power Macintosh powerpc

>Description:
building cad/geda on MacOS X 10.2.8 (and probably 10.1.x as well)
fails compilation as follows:

[...]
if gcc -pipe -DPACKAGE_LOCALE_DIR=\"/usr/pkg/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/pkg/include/gtk-2.0 -I/usr/pkg/lib/gtk-2.0/include -I/usr/pkg/include -I/usr/X11R6/include -I/usr/pkg/include/atk-1.0 -I/usr/pkg/include/pango-1.0 -I/usr/pkg/include/freetype2 -I/usr/pkg/include/glib/glib-2.0 -I/usr/pkg/lib/glib-2.0/include    -I/usr/X11R6/include -I./ -I../intl   -no-cpp-precomp -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -Wall -Wimplicit -Wreturn-type -Wunused -Wswitch -Wcomment -Wuninitialized -Wparentheses -Wpointer-arith -Wmissing-prototypes -O1 -g -O2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -MT doc.o -MD -MP -MF ".deps/doc.Tpo"  -c -o doc.o `test -f 'doc.c' || echo './'`doc.c;  then mv -f ".deps/doc.Tpo" ".deps/doc.Po";  else rm -f ".deps/doc.Tpo"; exit 1;  fi
doc.c:22:20: malloc.h: No such file or directory
doc.c: In function `DocCreate':
doc.c:94: warning: implicit declaration of function `malloc'
doc.c: In function `DocDestroy':
doc.c:155: warning: implicit declaration of function `free'
doc.c: In function `DocLoad':
doc.c:483: warning: assignment makes pointer from integer without a cast
doc.c:485: warning: assignment makes pointer from integer without a cast
*** Error code 1

Stop.
bmake: stopped in /Volumes/NetBSD/pkgsrc/cad/geda/work/geda-20041228/src

[...]

if gcc -pipe -DPACKAGE_LOCALE_DIR=\"/usr/pkg/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/pkg/include/gtk-2.0 -I/usr/pkg/lib/gtk-2.0/include -I/usr/pkg/include -I/usr/X11R6/include -I/usr/pkg/include/atk-1.0 -I/usr/pkg/include/pango-1.0 -I/usr/pkg/include/freetype2 -I/usr/pkg/include/glib/glib-2.0 -I/usr/pkg/lib/glib-2.0/include    -I/usr/X11R6/include -I./ -I../intl   -no-cpp-precomp -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -Wall -Wimplicit -Wreturn-type -Wunused -Wswitch -Wcomment -Wuninitialized -Wparentheses -Wpointer-arith -Wmissing-prototypes -O1 -g -O2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -MT m_file.o -MD -MP -MF ".deps/m_file.Tpo"  -c -o m_file.o `test -f 'm_file.c' || echo './'`m_file.c;  then mv -f ".deps/m_file.Tpo" ".deps/m_file.Po";  else rm -f ".deps/m_file.Tpo"; exit 1;  fi
m_file.c:23:20: malloc.h: No such file or directory
m_file.c: In function `FileNewCreate':
m_file.c:251: warning: implicit declaration of function `malloc'
m_file.c:262: warning: implicit declaration of function `free'
m_file.c: In function `FileNewComplete':
m_file.c:289: warning: assignment discards qualifiers from pointer target type
m_file.c:316: warning: assignment discards qualifiers from pointer target type
*** Error code 1

Stop.
bmake: stopped in /Volumes/NetBSD/pkgsrc/cad/geda/work/geda-20041228/src
[...]

>How-To-Repeat:
bootstrap pkgsrc on MacOS X 10.[12].x
cd .../pkgsrc/cad/geda
bmake
>Fix:
MacOS X does not have <malloc.h>.  It has <sys/malloc.h>, but this is
not the correct file to include as it does not contain the prototypes
for malloc() and free().

Instead, <stdlib.h> contains these prototypes and should be included
instead of <malloc.h>.

Patch the two affected files as follows:

--- work/geda-20041228/src/doc.c.orig2  Wed Feb  2 17:32:24 2005
+++ work/geda-20041228/src/doc.c        Wed Feb  2 17:33:10 2005
@@ -21,3 +21,3 @@
 
-#include <malloc.h>
+#include <stdlib.h>
 #include <stdio.h>


--- work/geda-20041228/src/m_file.c.orig        Wed Feb  2 17:35:54 2005
+++ work/geda-20041228/src/m_file.c     Wed Feb  2 17:36:12 2005
@@ -22,3 +22,3 @@
 #include <gtk/gtk.h>
-#include <malloc.h>
+#include <stdlib.h>
 #include <stdio.h>