Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Nov 2003 18:10:19 +0100 (CET)
From:      Harti Brandt <brandt@fokus.fraunhofer.de>
To:        Marius Strobl <marius@alchemy.franken.de>
Cc:        freebsd-current@freebsd.org
Subject:   Re: g++ problem
Message-ID:  <20031106180326.V27968@beagle.fokus.fraunhofer.de>
In-Reply-To: <20031106174459.A55161@newtrinity.zeist.de>
References:  <200311061555.hA6Ft08H051563@www.kukulies.org> <20031106174459.A55161@newtrinity.zeist.de>

next in thread | previous in thread | raw e-mail | index | archive | help

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" <kuku@www.kukulies.org> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031106180326.V27968>