[Nagiosplug-devel] [ nagiosplug-Bugs-1891183 ] 1.4.11 doesn't compile (2x)
SourceForge.net
noreply at sourceforge.net
Tue Feb 12 09:26:38 CET 2008
Bugs item #1891183, was opened at 2008-02-11 15:56
Message generated for change (Comment added) made by henry78
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1891183&group_id=29880
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Henry78 (henry78)
Assigned to: Nobody/Anonymous (nobody)
Summary: 1.4.11 doesn't compile (2x)
Initial Comment:
I got this complie error, during 'makeing' nagios-plugins-1.4.11 on RHEL4:
----------8<----------
basename.c: In function `char* base_name(const char*)':
basename.c:95: error: invalid conversion from `void*' to `char*'
make[3]: *** [basename.o] Error 1
---------->8----------
'cause i didn't need it, i removed the part for rewriting windows(?) paths from basename.c.
distclean, configure, make and a similar error occured:
----------8<----------
dirname.c: In function `char* dir_name(const char*)':
dirname.c:79: error: invalid conversion from `void*' to `char*'
make[3]: *** [dirname.o] Error 1
---------->8----------
It's a rewrite of a filename/path there too, but I'm not sure why it throws an Error. The corresponding line 79 from dirname.c:
----------8<----------
char *dir = xmalloc (length + append_dot + 1);
---------->8----------
----------------------------------------------------------------------
>Comment By: Henry78 (henry78)
Date: 2008-02-12 09:26
Message:
Logged In: YES
user_id=885432
Originator: YES
Works perfektly now. What ever was borked has been fixed by the upgrade.
Thanks for your help, bug may be closed.
----------------------------------------------------------------------
Comment By: Holger Weiss (hweiss)
Date: 2008-02-11 22:21
Message:
Logged In: YES
user_id=759506
Originator: NO
The new error again looks like your GCC installation is somehow borked.
GCC 3.4.5 should be just fine, but an upgrade is probably a good idea, just
in order to replace the old stuff. I'd be interested in whether that fixes
it.
By the way, my example doesn't use K&R style, it's plain ANSI C. The
thing your compiler refused to do (in the plugins code and in my example)
was an implicit conversion of a pointer to void to a pointer to char, which
is just fine in C (both C89 and C99), but is not allowed in C++ (where an
explicit cast would be required to convert a pointer to void). "-x c"
forces gcc and g++ to expect C input. Without "-x", gcc chooses the
language based on the file name suffix (see "man gcc"), while g++ expects
C++ unless you use "-x" (which is how your gcc behaves for some reason).
----------------------------------------------------------------------
Comment By: Henry78 (henry78)
Date: 2008-02-11 18:43
Message:
Logged In: YES
user_id=885432
Originator: YES
I got a 'C-Guru' to my desk for some minutes. He explained that your
test.c code is valid K&R C, but I need to set the gcc-switch "-x c" to
compile it. And ist complied fine. Even a hello-world-like line was printed
after adding that to test.c
The pity is: C-Guru is gone, and the compilation fails with other errors:
-----8<-----
gcc -x c -o check_apt check_apt.o utils.o runcmd.o
-L/root/nagios/nagios-plugins-1.4.11/plugins ../lib/libnagiosplug.a ../gl
/libgnu.a
check_apt.o:1: error: stray '\127' in program
----->8-----
I'll update to the latest available gcc for RHEL4 (that's 3.4.6), and
report back.
----------------------------------------------------------------------
Comment By: Holger Weiss (hweiss)
Date: 2008-02-11 17:14
Message:
Logged In: YES
user_id=759506
Originator: NO
Then there's something seriously broken with your gcc installation, my
example is perfectly valid C code.
Maybe try to re-install your GCC package(s)? Other than that, I have no
idea, sorry.
----------------------------------------------------------------------
Comment By: Henry78 (henry78)
Date: 2008-02-11 17:05
Message:
Logged In: YES
user_id=885432
Originator: YES
No, the test.c doesn't complile. It throws an error:
-----8<-----
test.c:2: error: invalid conversion from `void*' to `char*'
----->8-----
It works if I (double)quote the 'v'.
gcc -v
gcc version 3.4.5 20051201 (Red Hat 3.4.5-2)
----------------------------------------------------------------------
Comment By: Holger Weiss (hweiss)
Date: 2008-02-11 16:57
Message:
Logged In: YES
user_id=759506
Originator: NO
Odd. Does compiling the following code using "gcc -o test test.c" work?
/* test.c */
int main(void) { void *v; char *c = v; return 0; }
----------------------------------------------------------------------
Comment By: Henry78 (henry78)
Date: 2008-02-11 16:12
Message:
Logged In: YES
user_id=885432
Originator: YES
----------8<----------
if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../intl -g -O2 -MT dirname.o -MD
-MP -MF ".deps/dirname.Tpo" -c -o dirname.o dirname.c; \
then mv -f ".deps/dirname.Tpo" ".deps/dirname.Po"; else rm -f
".deps/dirname.Tpo"; exit 1; fi
---------->8----------
That's the corresponding compiler command line. I'm pretty sure it uses
gcc...
----------------------------------------------------------------------
Comment By: Holger Weiss (hweiss)
Date: 2008-02-11 16:07
Message:
Logged In: YES
user_id=759506
Originator: NO
You didn't post the compiler command line which threw the error, but it
seems as if you're using g++ instead of gcc for some reason. Is the
environment variable CC set to "g++" or something like that?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1891183&group_id=29880
More information about the Devel
mailing list