From owner-freebsd-current@FreeBSD.ORG Thu Nov 6 09:10:43 2003 Return-Path: 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 D7D3D16A4CE for ; Thu, 6 Nov 2003 09:10:43 -0800 (PST) Received: from mailhub.fokus.fraunhofer.de (mailhub.fokus.fraunhofer.de [193.174.154.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 35D8343FE5 for ; Thu, 6 Nov 2003 09:10:40 -0800 (PST) (envelope-from brandt@fokus.fraunhofer.de) Received: from beagle (beagle [193.175.132.100])hA6HAK619291; Thu, 6 Nov 2003 18:10:20 +0100 (MET) Date: Thu, 6 Nov 2003 18:10:19 +0100 (CET) From: Harti Brandt To: Marius Strobl In-Reply-To: <20031106174459.A55161@newtrinity.zeist.de> Message-ID: <20031106180326.V27968@beagle.fokus.fraunhofer.de> References: <200311061555.hA6Ft08H051563@www.kukulies.org> <20031106174459.A55161@newtrinity.zeist.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: "C. Kukulies" 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Nov 2003 17:10:44 -0000 On Thu, 6 Nov 2003, Marius Strobl wrote: MS>On Thu, Nov 06, 2003 at 11:28:28AM -0500, Alexander Kabaev wrote: MS>> On Thu, 6 Nov 2003 16:55:00 +0100 (CET) MS>> "C. Kukulies" wrote: MS>> MS>> > I tried to compile a virus-scanner for Linux that allows for scanning MS>> > Windoze PCs in a network for all sorts of recent viruses (RPC/DCOM and MS>> > such). MS>> > MS>> > http://www.enyo.de/fw/software/doscan MS>> > MS>> > Compilation fails with the following: MS>> > MS>> > kukuboo2k# gmake MS>> > g++ -g -O2 -Wall -I/usr/local/include -I. -I. -I./lib \ MS>> > -MMD -MF src/doscan.d \ MS>> > -c -o src/doscan.o src/doscan.cc MS>> > In file included from src/doscan.cc:28: MS>> > /usr/local/include/getopt.h:115: error: declaration of C function `int MS>> > getopt() MS>> > ' conflicts with MS>> > /usr/include/unistd.h:377: error: previous declaration `int MS>> > getopt(int, char* MS>> > const*, const char*)' here MS>> > gmake: *** [src/doscan.o] Error 1 MS>> > MS>> > I wonder where /usr/local/include comes from. If I remove that it MS>> > compiles smoothly. MS>> MS>> Uhm, from you command line? What _this_ has to do with a compiler? MS>> MS> MS>This happens with g++ 3.x when the devel/libgnugetopt port is installed MS>and both its getopt.h and the base unistd.h are included. There are MS>several ports that have workarounds for this issue. MS>I have a patch for devel/libgnugetopt at MS>ftp://ftp.zeist.de/pub/patches/devel_libgnugetopt.diff MS>that should fix this issue by updating to the latest sources. MS>In my opinion the right thing to do is however to also include MS>getopt_long_only() in libc and not only getopt_long() so one can get MS>rid of the devel/libgnugetopt port. I have a patch for this at MS>ftp://ftp.zeist.de/pub/patches/src_getopt_long_only.diff MS>When I have time I'll continue testing of both and eventually submit MS>PRs. getopt.h is broken. It should not define a Posix reserved name or the application should not use any of the interfaces in unistd.h. You cannot have both. harti -- harti brandt, http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private brandt@fokus.fraunhofer.de, harti@freebsd.org