NetBSD Problem Report #38240

From martin@duskware.de  Fri Mar 14 16:49:00 2008
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 123A063B842
	for <gnats-bugs@gnats.netbsd.org>; Fri, 14 Mar 2008 16:49:00 +0000 (UTC)
Message-Id: <20080314164747.B943A63B842@narn.NetBSD.org>
Date: Fri, 14 Mar 2008 16:47:47 +0000 (UTC)
From: srcshelton@gmail.com
Reply-To: srcshelton@gmail.com
To: netbsd-bugs-owner@NetBSD.org
Subject: pkgtools/pkg_install-20080313 fails to compile - missing getopt?
X-Send-Pr-Version: www-1.0

>Number:         38240
>Category:       pkg
>Synopsis:       pkgtools/pkg_install-20080313 fails to compile - missing getopt?
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    joerg
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 14 16:50:00 +0000 2008
>Closed-Date:    Tue Sep 16 13:40:42 +0000 2008
>Last-Modified:  Tue Sep 16 13:40:42 +0000 2008
>Originator:     Stuart Shelton
>Release:        pkgsrc latest from CVS
>Organization:
>Environment:
IRIX64 octane 6.5 07202013 IP30; IRIX 6.5.30; MIPSpro Compilers: Version 7.4.4m
>Description:
cc -DHAVE_CONFIG_H -I/usr/bsd/include -D__inline__=inline -D_LARGEFILE_SOURCE -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -DDEF_UMASK=022 -I/usr/bsd/var/tmp/pkgtools/pkg_install/work/bzip2 -I/usr/bsd/var/tmp/pkgtools/pkg_install/work/libarchive/libarchive -DHAVE_NBCOMPAT_H=1 -I/usr/bsd/var/tmp/pkgtools/pkg_install/work/libnbcompat -I. -I. -I../lib  -DSYSCONFDIR=\"/usr/bsd/etc\" -c99 -O2 -n32 -mips4 -r14000 -float_const -use_readonly_const -TARG:isa=mips4:platform=ip35:processor=r14000 -TENV:zeroinit_in_bss=ON -OPT:fast_io=ON:Olimit=8192:reorg_common=ON:swp=ON -LNO:auto_dist=ON:fusion_peeling_limit=8:gather_scatter=2 -woff 1174,1183,1185,1552,3970,3968 -n32 -c audit.c
cc-1020 cc: ERROR File = audit.c, Line = 82
  The identifier "optreset" is undefined.

        optreset = 1;
        ^

cc-1196 cc: WARNING File = audit.c, Line = 405
  The indicated function is declared implicitly.

        fd[0] = open(pkg_vulnerabilities_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
                ^

1 error detected in the compilation of "audit.c".
*** Error code 2

Stop.
bmake: stopped in /usr/bsd/var/tmp/pkgtools/pkg_install/work/pkg_install-20080313/admin
*** Error code 1

Stop.
bmake: stopped in /usr/bsd/var/tmp/pkgtools/pkg_install/work/pkg_install-20080313
*** Error code 1

Stop.
bmake: stopped in /usr/bsd/src/pkgtools/pkg_install
*** Error code 1

Stop.
bmake: stopped in /usr/bsd/src/pkgtools/pkg_install

>How-To-Repeat:

(Out of interest, other warnings generated whilst building pkg_install are:

cc-1188 cc: WARNING File = fexec.c, Line = 90
  The indicated type qualifier is meaningless on cast type.

                (void)execvp(file, (char ** const)argv);
                                    ^

cc-1196 cc: WARNING File = ftpio.c, Line = 332
  The indicated function is declared implicitly.

                setenv(PKG_FTPIO_COMMAND, buf, 1);
                ^

cc-1196 cc: WARNING File = ftpio.c, Line = 409
  The indicated function is declared implicitly.

        unsetenv(PKG_FTPIO_COMMAND); 
        ^

cc-1196 cc: WARNING File = ftpio.c, Line = 461
  The indicated function is declared implicitly.

        setenv(PKG_FTPIO_CURRENTHOST, newHost, 1); /* need to update this in the environment */
        ^

cc-1196 cc: WARNING File = ftpio.c, Line = 1141
  The indicated function is declared implicitly.

                setenv("PKG_PATH", pkg_path, 1);
                ^

cc-3604 cc: WARNING File = iterate.c, Line = 403
  missing return statement at end of non-void function "match_best_file"

  }
  ^

cc-1196 cc: WARNING File = path.c, Line = 205
  The indicated function is declared implicitly.

        if (setenv(envname, env0, 1) != 0)
            ^

cc-1196 cc: WARNING File = perform.c, Line = 621
  The indicated function is declared implicitly.

        setenv(PKG_PREFIX_VNAME, (p = find_plist(&Plist, PLIST_CWD)) ? p->name : ".", 1);
        ^


... so it looks as if an alternative (un)setenv() function should be provided (by nbcompat?) for OS which don't have it natively (I've seen an #ifdef'd alternative to setenv in another package, and it was used for a number of different platforms, so there's more than just IRIX not supporting (un)setenv()...
>Fix:

It looks as if audit.c is using getopt() variables and function calls, without including the (nbcompat, in this case) getopt headers

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->irix-pkg-people
Responsible-Changed-By: snj@NetBSD.org
Responsible-Changed-When: Sat, 15 Mar 2008 00:05:21 +0000
Responsible-Changed-Why:
IRIX problem.


Responsible-Changed-From-To: irix-pkg-people->joerg
Responsible-Changed-By: joerg@NetBSD.org
Responsible-Changed-When: Sat, 15 Mar 2008 14:01:57 +0000
Responsible-Changed-Why:
libnbcompat issue


From: Rob Q <sd4dfg2@hotmail.com>
To: <gnats-bugs@netbsd.org>
Cc: 
Subject: RE: pkg/38240: pkgtools/pkg_install-20080313 fails to compile -
 missing getopt?
Date: Wed, 19 Mar 2008 11:22:51 -0400

  I have the same problems on Solaris:

 gcc -DHAVE_CONFIG_H -D_LARGEFILE_SOURCE -D_LARGE_FILES -D_FILE_OFFSET_BITS=
 =3D64 -DDEF_UMASK=3D022 -I/usr/obj/pkg/pkgtools/pkg_install/work/libarchive=
 /libarchive -DHAVE_NBCOMPAT_H=3D1 -I/usr/obj/pkg/pkgtools/pkg_install/work/=
 libnbcompat -I. -I. -I../lib  -DSYSCONFDIR=3D\"/usr/pkg/etc\" -O -mv8 -pipe=
  -c audit.c
 audit.c: In function `parse_options':
 audit.c:85: error: `optreset' undeclared (first use in this function)
 audit.c:85: error: (Each undeclared identifier is reported only once
 audit.c:85: error: for each function it appears in.)
 audit.c: In function `fetch_pkg_vulnerabilities':
 audit.c:408: error: `O_WRONLY' undeclared (first use in this function)
 audit.c:408: error: `O_CREAT' undeclared (first use in this function)
 audit.c:408: error: `O_TRUNC' undeclared (first use in this function)
 *** Error code 1


 _________________________________________________________________
 Helping your favorite cause is as easy as instant messaging.=A0You IM, we g=
 ive.
 http://im.live.com/Messenger/IM/Home/?source=3Dtext_hotmail_join=

From: Joerg Sonnenberger <joerg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/38240 CVS commit: pkgsrc/pkgtools/pkg_install/files/admin
Date: Wed, 19 Mar 2008 15:33:12 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	joerg
 Date:		Wed Mar 19 15:33:12 UTC 2008

 Modified Files:
 	pkgsrc/pkgtools/pkg_install/files/admin: audit.c

 Log Message:
 Explicitly include fcntl.h for Solaris. From PR 38240.


 To generate a diff of this commit:
 cvs rdiff -r1.2 -r1.3 pkgsrc/pkgtools/pkg_install/files/admin/audit.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: srcshelton@gmail.com
Subject: Re: pkg/38240: pkgtools/pkg_install-20080313 fails to compile -
	missing getopt?
Date: Wed, 19 Mar 2008 17:15:46 +0100

 --PEIAKu/WMn1b1Hv9
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 On Wed, Mar 19, 2008 at 03:25:01PM +0000, Rob Q wrote:
 >  gcc -DHAVE_CONFIG_H -D_LARGEFILE_SOURCE -D_LARGE_FILES -D_FILE_OFFSET_BITS=
 >  =3D64 -DDEF_UMASK=3D022 -I/usr/obj/pkg/pkgtools/pkg_install/work/libarchive=
 >  /libarchive -DHAVE_NBCOMPAT_H=3D1 -I/usr/obj/pkg/pkgtools/pkg_install/work/=
 >  libnbcompat -I. -I. -I../lib  -DSYSCONFDIR=3D\"/usr/pkg/etc\" -O -mv8 -pipe=
 >   -c audit.c
 >  audit.c: In function `parse_options':
 >  audit.c:85: error: `optreset' undeclared (first use in this function)
 >  audit.c:85: error: (Each undeclared identifier is reported only once
 >  audit.c:85: error: for each function it appears in.)

 Please try the attached patch for this part of the problem. The other
 one should be fixed.

 Joerg

 --PEIAKu/WMn1b1Hv9
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="getopt.diff"

 Index: libnbcompat/files/nbcompat/unistd.h
 ===================================================================
 RCS file: /cvsroot/pkgsrc/pkgtools/libnbcompat/files/nbcompat/unistd.h,v
 retrieving revision 1.2
 diff -u -p -r1.2 unistd.h
 --- libnbcompat/files/nbcompat/unistd.h	23 Aug 2004 03:32:13 -0000	1.2
 +++ libnbcompat/files/nbcompat/unistd.h	19 Mar 2008 15:40:00 -0000
 @@ -47,14 +47,18 @@
   * Declare functions and macros that may be missing in <unistd.h>.
   */

 -#if !HAVE_OPTARG_D
 +#if !HAVE_DECL_OPTARG
  extern char	*optarg;
  #endif

 -#if !HAVE_OPTIND_D
 +#if !HAVE_DECL_OPTIND
  extern int	optind;
  #endif

 +#if !HAVE_DECL_OPTRESET
 +extern int	optreset;
 +#endif
 +
  #if !HAVE_GETPASS_D
  char	*getpass(const char *);
  #endif
 Index: pkg_install/files/admin/audit.c
 ===================================================================
 RCS file: /cvsroot/pkgsrc/pkgtools/pkg_install/files/admin/audit.c,v
 retrieving revision 1.3
 diff -u -p -r1.3 audit.c
 --- pkg_install/files/admin/audit.c	19 Mar 2008 15:33:12 -0000	1.3
 +++ pkg_install/files/admin/audit.c	19 Mar 2008 15:40:00 -0000
 @@ -67,8 +67,10 @@ __RCSID("$NetBSD: audit.c,v 1.3 2008/03/
  #if HAVE_STRING_H
  #include <string.h>
  #endif
 -#if HAVE_UNISTD_H
 +#ifdef NETBSD
  #include <unistd.h>
 +#else
 +#include <nbcompat/unistd.h>
  #endif

  #include "admin.h"

 --PEIAKu/WMn1b1Hv9--

From: Rob Q <sd4dfg2@hotmail.com>
To: <gnats-bugs@netbsd.org>
Cc: 
Subject: RE: pkg/38240: pkgtools/pkg_install-20080313 fails to compile -
 missing getopt?
Date: Wed, 19 Mar 2008 13:47:34 -0400

 I'm still getting:

 gcc -L/usr/obj/pkg/pkgtools/pkg_install/work/libarchive/.libs -L/usr/obj/pk=
 g/pkgtools/pkg_install/work/libnbcompat -Wl,-R/usr/pkg/lib -L../lib -o pkg_=
 admin audit.o check.o config.o main.o -linstall -lbz2 -lz -ltermcap -lnbcom=
 pat
 Undefined                       first referenced
  symbol                             in file
 optreset                            audit.o
 ld: fatal: Symbol referencing errors. No output written to pkg_admin
 collect2: ld returned 1 exit status
 *** Error code 1

 _________________________________________________________________
 Climb to the top of the charts!=A0Play the word scramble challenge with sta=
 r power.
 http://club.live.com/star_shuffle.aspx?icid=3Dstarshuffle_wlmailtextlink_ja=
 n=

From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/38240: pkgtools/pkg_install-20080313 fails to compile -
	missing getopt?
Date: Sat, 22 Mar 2008 00:29:03 +0100

 On Wed, Mar 19, 2008 at 05:50:01PM +0000, Rob Q wrote:
 >  I'm still getting:

 OK, problem was that Solaris has only a GNUish getopt.
 Please run cvs up and try again, it should be fixed now.

 Joerg

State-Changed-From-To: open->feedback
State-Changed-By: joerg@NetBSD.org
State-Changed-When: Wed, 21 May 2008 22:36:33 +0000
State-Changed-Why:
Does it still fail?


From: "Stuart Shelton" <srcshelton@gmail.com>
To: gnats-bugs@netbsd.org
Cc: joerg@netbsd.org, pkgsrc-bugs@netbsd.org, gnats-admin@netbsd.org
Subject: Re: pkg/38240 (pkgtools/pkg_install-20080313 fails to compile - missing getopt?)
Date: Fri, 23 May 2008 16:07:38 +0100

 Unfortuantely, the build still fails - but it looks as if the cause is
 different now:


 cc -DHAVE_CONFIG_H -DDEF_LOG_DIR=\"/usr/bsd/var/db/pkg\"
 -DTAR_CMD=\"/usr/bsd/bin/gnu-tar\" -DFTP_CMD=\"/usr/bsd/bin/ftp\"
 -I/usr/bsd/include -D__inline__=inline -D_LARGEFILE_SOURCE
 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -DDEF_UMASK=022
 -I/usr/bsd/var/tmp/pkgtools/pkg_install/work/bzip2
 -I/usr/bsd/var/tmp/pkgtools/pkg_install/work/libarchive/libarchive
 -I/usr/bsd/var/tmp/pkgtools/pkg_install/work/libfetch
 -DHAVE_NBCOMPAT_H=1
 -I/usr/bsd/var/tmp/pkgtools/pkg_install/work/libnbcompat -I. -I. -c99
 -O2 -n32 -mips4 -r14000 -float_const -use_readonly_const
 -TARG:isa=mips4:platform=ip35:processor=r14000
 -TENV:zeroinit_in_bss=ON
 -OPT:fast_io=ON:Olimit=8192:reorg_common=ON:swp=ON
 -LNO:auto_dist=ON:fusion_peeling_limit=8:gather_scatter=2 -woff
 1174,1183,1185,1552,3970,3968 -n32 -c plist.c
 cc-1196 cc: WARNING File = plist.c, Line = 562
   The indicated function is declared implicitly.

                                                 if ((cp = MD5File(tmp,
 buf)) != NULL) {
                                                           ^

 cc-1515 cc: ERROR File = plist.c, Line = 562
   A value of type "int" cannot be assigned to an entity of type "char *".

                                                 if ((cp = MD5File(tmp,
 buf)) != NULL) {
                                                         ^

 1 error detected in the compilation of "plist.c".
 *** Error code 2

 Stop.
 bmake: stopped in
 /usr/bsd/var/tmp/pkgtools/pkg_install/work/pkg_install-20080423/lib
 *** Error code 1

 Stop.
 bmake: stopped in
 /usr/bsd/var/tmp/pkgtools/pkg_install/work/pkg_install-20080423
 *** Error code 1

 Stop.
 bmake: stopped in /usr/bsd/src/pkgtools/pkg_install
 *** Error code 1

 Stop.
 bmake: stopped in /usr/bsd/src/pkgtools/pkg_install



 On 21/05/2008, joerg@netbsd.org <joerg@netbsd.org> wrote:
 > Synopsis: pkgtools/pkg_install-20080313 fails to compile - missing getopt?
 >
 >
 > State-Changed-From-To: open->feedback
 >  State-Changed-By: joerg@NetBSD.org
 >  State-Changed-When: Wed, 21 May 2008 22:36:33 +0000
 >  State-Changed-Why:
 >  Does it still fail?
 >
 >
 >
 >

From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/38240 (pkgtools/pkg_install-20080313 fails to compile -
	missing getopt?)
Date: Fri, 23 May 2008 17:51:53 +0200

 On Fri, May 23, 2008 at 03:10:04PM +0000, Stuart Shelton wrote:
 >  Unfortuantely, the build still fails - but it looks as if the cause is
 >  different now:

 OK, can you check that the last commit for the pkg_install-renovation
 branch fixed this?

 Joerg

From: "Stuart Shelton" <srcshelton@gmail.com>
To: gnats-bugs@netbsd.org
Cc: joerg@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/38240 (pkgtools/pkg_install-20080313 fails to compile - missing getopt?)
Date: Fri, 30 May 2008 17:22:03 +0100

 It looks as if the code from the pkg_install-renovation branch does
 work... at least, it builds successfully during bootstrap, which the
 current pkg_install doesn't.


 On 23/05/2008, Joerg Sonnenberger <joerg@britannica.bec.de> wrote:
 > The following reply was made to PR pkg/38240; it has been noted by GNATS.
 >
 >
 > From: Joerg Sonnenberger <joerg@britannica.bec.de>
 >  To: gnats-bugs@NetBSD.org
 >  Cc:
 >
 > Subject: Re: pkg/38240 (pkgtools/pkg_install-20080313 fails to compile -
 >         missing getopt?)
 >
 > Date: Fri, 23 May 2008 17:51:53 +0200
 >
 >
 >   On Fri, May 23, 2008 at 03:10:04PM +0000, Stuart Shelton wrote:
 >   >  Unfortuantely, the build still fails - but it looks as if the cause is
 >   >  different now:
 >
 >
 >  OK, can you check that the last commit for the pkg_install-renovation
 >   branch fixed this?
 >
 >
 >   Joerg
 >
 >

From: "Stuart Shelton" <srcshelton@gmail.com>
To: gnats-bugs@netbsd.org
Cc: joerg@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/38240 (pkgtools/pkg_install-20080313 fails to compile - missing getopt?)
Date: Fri, 30 May 2008 19:24:07 +0100

 Tell a lie - I'm also hitting the libarchive problem from pkg/38674 :(


 On 30/05/2008, Stuart Shelton <srcshelton@gmail.com> wrote:
 > It looks as if the code from the pkg_install-renovation branch does
 >  work... at least, it builds successfully during bootstrap, which the
 >  current pkg_install doesn't.
 >
 >
 >
 >  On 23/05/2008, Joerg Sonnenberger <joerg@britannica.bec.de> wrote:
 >  > The following reply was made to PR pkg/38240; it has been noted by GNATS.
 >  >
 >  >
 >  > From: Joerg Sonnenberger <joerg@britannica.bec.de>
 >  >  To: gnats-bugs@NetBSD.org
 >  >  Cc:
 >  >
 >  > Subject: Re: pkg/38240 (pkgtools/pkg_install-20080313 fails to compile -
 >  >         missing getopt?)
 >  >
 >  > Date: Fri, 23 May 2008 17:51:53 +0200
 >  >
 >  >
 >  >   On Fri, May 23, 2008 at 03:10:04PM +0000, Stuart Shelton wrote:
 >  >   >  Unfortuantely, the build still fails - but it looks as if the cause is
 >  >   >  different now:
 >  >
 >  >
 >  >  OK, can you check that the last commit for the pkg_install-renovation
 >  >   branch fixed this?
 >  >
 >  >
 >  >   Joerg
 >  >
 >  >
 >

State-Changed-From-To: feedback->closed
State-Changed-By: joerg@NetBSD.org
State-Changed-When: Tue, 16 Sep 2008 13:40:42 +0000
State-Changed-Why:
Last merges from the renovation should have fixed this.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.