Re: g++ problem

From: Harti Brandt <brandt_at_fokus.fraunhofer.de>
Date: Thu, 6 Nov 2003 18:10:19 +0100 (CET)
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_at_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_at_fokus.fraunhofer.de, harti_at_freebsd.org
Received on Thu Nov 06 2003 - 08:10:43 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:27 UTC