Subject: pkg/37487: Samba 3.0.26a won't compile on Netbsd 1.6.2
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <from_netbsd6@frear.com>
List: pkgsrc-bugs
Date: 12/06/2007 13:05:02
>Number:         37487
>Category:       pkg
>Synopsis:       Samba 3.0.26a won't compile on Netbsd 1.6.2
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 06 13:05:01 +0000 2007
>Originator:     John Frear
>Release:        1.6.2
>Organization:
>Environment:
NetBSD mymachine 1.6.2 NetBSD 1.6.2 (mykernel) #0: Mon Jun 13 22:20:02 CDT 2005     myuser@mymachine:/sys/src/sys/arch/i386/compile/mykernel i386
>Description:
I'm not able to compile Samba 3.0.26a from the net/samba directory in pkgsrc.  My main Makefile has cvs version 1.177.

The output of the pkgsrc make command was:

Compiling smbd/trans2.c
In file included from /usr/include/termios.h:305,
                 from lib/replace/system/terminal.h:33,
                 from include/includes.h:115,
                 from /usr/pkgsrc/net/samba/work/samba-3.0.26a/source/smbd/trans2.c:27:
/usr/include/sys/ttydefaults.h:61: warning: `CTRL' redefined
/usr/pkgsrc/net/samba/work/.buildlink/include/readline/chardefs.h:64: warning: this is the location of the previous definition
/usr/pkgsrc/net/samba/work/samba-3.0.26a/source/smbd/trans2.c: In function `set_ea':
/usr/pkgsrc/net/samba/work/samba-3.0.26a/source/smbd/trans2.c:368: `ENODATA' undeclared (first use in this function)
/usr/pkgsrc/net/samba/work/samba-3.0.26a/source/smbd/trans2.c:368: (Each undeclared identifier is reported only once
/usr/pkgsrc/net/samba/work/samba-3.0.26a/source/smbd/trans2.c:368: for each function it appears in.)
The following command failed:
cc -I. -I/usr/pkgsrc/net/samba/work/samba-3.0.26a/source  -O2 -I/usr/pkg/include -D_SAMBA_BUILD_=3 -I/usr/pkgsrc/net/samba/work/samba-3.0.26a/source/popt -I/usr/pkgsrc/net/samba/work/samba-3.0.26a/source/iniparser/src -Iinclude -I./include  -I. -I. -I./lib/replace -I./lib/talloc -I./tdb/include -I./libaddns -I./librpc -DHAVE_CONFIG_H  -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include    -I/usr/pkgsrc/net/samba/work/samba-3.0.26a/source/lib -D_SAMBA_BUILD_=3 -fPIC -DPIC -c /usr/pkgsrc/net/samba/work/samba-3.0.26a/source/smbd/trans2.c -o smbd/trans2.o
*** Error code 1

I looked into this problem and have resolved it on my own system.  The problem is due to samba's includes/include.h file declaring:

#ifndef ENOATTR
#define ENOATTR ENODATA
#endif

I also found a discussion at the following website useful:

http://www.nabble.com/bug-in-samba-3.0.25c-includes.h-t4314063.html

I created a patch for the pkgsrc system and it has resolved the problem for me.  The contents of my patch are:

--- include/includes.h.orig	Mon Aug 20 08:04:51 2007
+++ include/includes.h	Wed Dec  5 14:27:33 2007
@@ -225,6 +225,10 @@
 #include <sys/attributes.h>
 #endif
 
+#if !defined(ENOATTR) && !defined(ENODATA)
+#define ENOATTR EAGAIN
+#endif
+
 #ifndef ENOATTR
 #define ENOATTR ENODATA
 #endif

I looked in netbsd's cvsweb at /usr/include/sys/errno.h and the most current version at this time (rev 1.9) doesn't define either ENOATTR or ENODATA, so I believe this compile issue may affect all netbsd systems.  Anyhow, I hope my choice of mapping the error to EAGAIN was the right way to go.

Thanks for providing a great system everyone!
>How-To-Repeat:

>Fix:
Fix described above under 'full description' section.