From owner-freebsd-current@FreeBSD.ORG  Thu Nov  6 08:45:07 2003
Return-Path: <owner-freebsd-current@FreeBSD.ORG>
Delivered-To: freebsd-current@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E30F416A4CE
	for <freebsd-current@freebsd.org>;
	Thu,  6 Nov 2003 08:45:07 -0800 (PST)
Received: from newtrinity.zeist.de (newtrinity.zeist.de [217.24.217.8])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 30CA043FE5
	for <freebsd-current@freebsd.org>;
	Thu,  6 Nov 2003 08:45:06 -0800 (PST)
	(envelope-from marius@newtrinity.zeist.de)
Received: from newtrinity.zeist.de (localhost [127.0.0.1])
	hA6Gj4fw046302;	Thu, 6 Nov 2003 17:45:04 +0100 (CET)
	(envelope-from marius@newtrinity.zeist.de)
Received: (from marius@localhost)
	by newtrinity.zeist.de (8.12.10/8.12.10/Submit) id hA6Gixql046301;
	Thu, 6 Nov 2003 17:44:59 +0100 (CET)
	(envelope-from marius)
Date: Thu, 6 Nov 2003 17:44:59 +0100
From: Marius Strobl <marius@alchemy.franken.de>
To: Alexander Kabaev <ak03@gte.com>
Message-ID: <20031106174459.A55161@newtrinity.zeist.de>
References: <200311061555.hA6Ft08H051563@www.kukulies.org>
	<20031106112828.7985100a.ak03@gte.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2.5.1i
In-Reply-To: <20031106112828.7985100a.ak03@gte.com>;
	from ak03@gte.com on Thu, Nov 06, 2003 at 11:28:28AM -0500
X-AntiVirus: checked by AntiVir Milter 1.0.6; AVE 6.22.0.1; VDF 6.22.0.30
cc: "C. Kukulies" <kuku@www.kukulies.org>
cc: freebsd-current@freebsd.org
Subject: Re: g++ problem
X-BeenThere: freebsd-current@freebsd.org
X-Mailman-Version: 2.1.1
Precedence: list
List-Id: Discussions about the use of FreeBSD-current
	<freebsd-current.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-current>,
	<mailto:freebsd-current-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-current>
List-Post: <mailto:freebsd-current@freebsd.org>
List-Help: <mailto:freebsd-current-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-current>,
	<mailto:freebsd-current-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 06 Nov 2003 16:45:08 -0000

On Thu, Nov 06, 2003 at 11:28:28AM -0500, Alexander Kabaev wrote:
> On Thu, 6 Nov 2003 16:55:00 +0100 (CET)
> "C. Kukulies" <kuku@www.kukulies.org> wrote:
> 
> > I tried to compile a virus-scanner for Linux that allows for scanning
> > Windoze PCs in a network for all sorts of recent viruses (RPC/DCOM and
> > such).
> > 
> > http://www.enyo.de/fw/software/doscan
> > 
> > Compilation fails with the following:
> > 
> > kukuboo2k# gmake
> > g++ -g -O2 -Wall -I/usr/local/include -I. -I. -I./lib \
> >         -MMD -MF src/doscan.d \
> >         -c -o src/doscan.o src/doscan.cc
> > In file included from src/doscan.cc:28:
> > /usr/local/include/getopt.h:115: error: declaration of C function `int
> > getopt()
> >    ' conflicts with
> > /usr/include/unistd.h:377: error: previous declaration `int
> > getopt(int, char*
> >    const*, const char*)' here
> > gmake: *** [src/doscan.o] Error 1
> > 
> > I wonder where /usr/local/include comes from. If I remove that it
> > compiles smoothly.
> 
> Uhm, from you command line? What _this_ has to do with a compiler?
> 

This happens with g++ 3.x when the devel/libgnugetopt port is installed
and both its getopt.h and the base unistd.h are included. There are
several ports that have workarounds for this issue.
I have a patch for devel/libgnugetopt at
ftp://ftp.zeist.de/pub/patches/devel_libgnugetopt.diff
that should fix this issue by updating to the latest sources.
In my opinion the right thing to do is however to also include
getopt_long_only() in libc and not only getopt_long() so one can get
rid of the devel/libgnugetopt port. I have a patch for this at
ftp://ftp.zeist.de/pub/patches/src_getopt_long_only.diff
When I have time I'll continue testing of both and eventually submit
PRs.