Subject: pkg/36847: sysutils/gamin make fails : gamin.c:9:20: error: Python.h: No such file or directory
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <cfuhrman@pobox.com>
List: pkgsrc-bugs
Date: 08/26/2007 19:05:01
>Number:         36847
>Category:       pkg
>Synopsis:       sysutils/gamin make fails : gamin.c:9:20: error: Python.h: No such file or directory
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 26 19:05:00 +0000 2007
>Originator:     Chris Fuhrman
>Release:        4.0_BETA2
>Organization:
>Environment:
NetBSD hiromi.den.fuhrbear.com 4.0_BETA2 NetBSD 4.0_BETA2 (GENERIC) #10: Fri Jul 27 13:23:23 EDT 2007  root@hiromi.den.fuhrbear.com:/usr/src/sys/arch/i386/compile/GENERIC i386

>Description:
sysutils/gamin fails to compile after a make when lang/python24 is installed:

...
 cc -DHAVE_CONFIG_H -I. -I.. -I/export0/pkgsrc/sysutils/gamin/work/.buildlink/include/python2.4 -I../libgamin -I../lib -I/export0/pkgsrc/sysutils/gamin/work/.buildlink/include -O2 -MT gamin.lo -MD -MP -MF .deps/gamin.Tpo -c gamin.c  -fPIC -DPIC -o .libs/gamin.o
gamin.c:9:20: error: Python.h: No such file or directory
gamin.c:20: error: 'NULL' undeclared here (not in a function)
gamin.c: In function 'get_connection':
gamin.c:34: warning: incompatible implicit declaration of built-in function 'malloc'
gamin.c:40: warning: incompatible implicit declaration of built-in function 'memset'
gamin.c:52: warning: incompatible implicit declaration of built-in function 'memset'
gamin.c:57: warning: incompatible implicit declaration of built-in function 'malloc'
gamin.c: In function 'get_request':
gamin.c:89: warning: incompatible implicit declaration of built-in function 'malloc'
gamin.c:95: warning: incompatible implicit declaration of built-in function 'memset'
gamin.c:107: warning: incompatible implicit declaration of built-in function 'memset'
gamin.c:112: warning: incompatible implicit declaration of built-in function 'malloc'
gamin.c: At top level:
gamin.c:157: error: expected ')' before '*' token
gamin.c:175: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
gamin.c:180: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
gamin.c:191: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
gamin.c:206: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
gamin.c:218: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
gamin.c:242: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
gamin.c:274: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
gamin.c:289: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
gamin.c:304: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
gamin.c:336: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
gamin.c:368: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
gamin.c:431: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gaminMethods'
gamin.c: In function 'init_gamin':
gamin.c:458: error: 'gaminMethods' undeclared (first use in this function)
gamin.c:458: error: (Each undeclared identifier is reported only once
gamin.c:458: error: for each function it appears in.)
*** Error code 1

Stop.
make: stopped in /export0/pkgsrc/sysutils/gamin/work/gamin-0.1.5/python
*** Error code 1

Stop.
make: stopped in /export0/pkgsrc/sysutils/gamin/work/gamin-0.1.5/python
*** Error code 1

Stop.
make: stopped in /export0/pkgsrc/sysutils/gamin/work/gamin-0.1.5
*** Error code 1

Stop.
make: stopped in /export0/pkgsrc/sysutils/gamin/work/gamin-0.1.5
*** Error code 1

Stop.
make: stopped in /export0/pkgsrc/sysutils/gamin
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/sysutils/gamin

The error output above was from the pkgsrc-2007Q2 branch.  Please note this affects HEAD as well.

The problem appears to be that the pkgsrc toolchain finds python okay but as it isn't listed as a dependency, Python.h cannot be found.  From  GNU AutoTools output:

checking abstract socket namespace... no
checking for python... /usr/pkg/bin/python
Found Python version 2.4
configure: creating ./config.status

>How-To-Repeat:
1) check out pkgsrc-2007Q2 or HEAD

2) Install lang/python24 (other versions of python may possibly trigger 
   this bug as well)

3) cd sysutils/gamin

4) make

>Fix:
A comprehensive solution is to make the enabling of python bindings optional.  The following patch does the following:

1) Adds an options.mk file containing a python PKG_OPTION.  When
   python is specified as an option, the appropriate buildlink is
   included along with the appropriate GNU Configure option.

2) .include the options file in the Makefile

NOTE: This diff is based off the pkgsrc-2007Q2 branch.  This will need to be applied to HEAD as well. 

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/gamin/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- Makefile    13 Apr 2006 18:27:24 -0000      1.9
+++ Makefile    26 Aug 2007 15:04:37 -0000
@@ -19,6 +19,8 @@
 CONFIGURE_ARGS+=       --without-threads
 CONFIGURE_ARGS+=       --with-html-dir=${DOCDIR:Q}
 
+.include "./options.mk"
+
 PKG_SYSCONFSUBDIR=     gamin
 DOCDIR=                        ${PREFIX}/share/doc/gamin
 
Index: options.mk
===================================================================
RCS file: options.mk
diff -N options.mk
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ options.mk  26 Aug 2007 15:04:37 -0000
@@ -0,0 +1,14 @@
+# $NetBSD$
+
+PKG_OPTIONS_VAR=        PKG_OPTIONS.gamin
+PKG_SUPPORTED_OPTIONS= python
+
+.include "../../mk/bsd.options.mk"
+
+.if empty(PKG_OPTIONS:Mpython)
+CONFIGURE_ARGS+=        --without-python
+.else
+.include "../../lang/python24/buildlink3.mk"
+.endif
+
+