[rrd-developers] Trouble compiling (yesterdays) svn snapshot under OpenBSD 4.2-current

Andreas Maus a.maus at science-computing.de
Thu Aug 23 16:02:30 CEST 2007


Hi!

Yesterday I decided to go "bleeding edge" and tried the svn snapshot (revision1193)
of the new rrdtool 1.3 on my OpenBSD system (running 4.2-current).

Runninng ./configure without any arguments succeeded.

But the compilation fails. The first errror was:

rrd_getopt.c: In function `_getopt_initialize':
rrd_getopt.c:377: error: assignment of read-only variable `ordering'
rrd_getopt.c:380: error: assignment of read-only variable `ordering'
rrd_getopt.c:383: error: assignment of read-only variable `ordering'
rrd_getopt.c:385: error: assignment of read-only variable `ordering'
rrd_getopt.c:360: warning: unused parameter `argc'
rrd_getopt.c:361: warning: unused parameter `argv'
*** Error code 1

Stop in /home/maus/devel/rrdtool/trunk/program/src.
*** Error code 1

Stop in /home/maus/devel/rrdtool/trunk/program (line 344 of Makefile).
*** Error code 1

Stop in /home/maus/devel/rrdtool/trunk/program (line 251 of Makefile).

This was not too hard to solve. The error occurs because orderstring is
declared as const:

static const enum {
    REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
} ordering;

But the code assigns values to this const, e.g.:

    if (optstring[0] == '-') {
        ordering = RETURN_IN_ORDER;
        ++optstring;
    } else if (optstring[0] == '+') {
        ordering = REQUIRE_ORDER;
        ++optstring;
    } else if (posixly_correct != NULL)
        ordering = REQUIRE_ORDER;
    else
        ordering = PERMUTE;

Removing the const declaration solves this problem. svn diff:

maus at schizo:~/devel/rrdtool $ svn diff
Index: trunk/program/src/rrd_getopt.c
===================================================================
--- trunk/program/src/rrd_getopt.c      (revision 1193)
+++ trunk/program/src/rrd_getopt.c      (working copy)
@@ -190,7 +190,7 @@
    of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
    `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
 
-static const enum {
+static enum {
     REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
 } ordering;
 
After fixing this the next error occurs. It seems that fdatasync 

/usr/local/lib/libglib-2.0.so.1200.12: warning: vsprintf() is often misused, please use vsnprintf()
./.libs/librrd.so.2.10: warning: strcpy() is almost always misused, please use strlcpy()
./.libs/librrd.so.2.10: warning: sprintf() is often misused, please use snprintf()
/usr/X11R6/lib/libX11.so.10.0: warning: strcat() is almost always misused, please use strlcat()
./.libs/librrd.so.2.10: undefined reference to `isfinite'
./.libs/librrd.so.2.10: undefined reference to `fdatasync'
collect2: ld returned 1 exit status
*** Error code 1

Stop in /home/maus/devel/rrdtool/trunk/program/src (line 511 of Makefile).
*** Error code 1

Stop in /home/maus/devel/rrdtool/trunk/program (line 344 of Makefile).
*** Error code 1

Stop in /home/maus/devel/rrdtool/trunk/program (line 251 of Makefile).

At first fdatasync is not defined in OpenBSD (Linux only ?). But according
to the man page is is available where _POSIX_SYNCHRONIZED_IO is defined in
unistd.h (which is not in OpenBSD). So I guess it is a good advice to
check this declaration inside configure.

Shouldn't the call to isfinite be replaced with finite on *BSD.
At least the comment in configure.ac suggest this:

dnl finite is BSD, isfinite is C99, so prefer the latter

configure only checks for a broken isfinte:

checking whether isfinite is broken... no

O.K. there is no isfinite, so it can't be broken ;)

configure then sets HAVE_ISFINITE

/* Define to 1 if you have the `isfinite' function. */
#define HAVE_ISFINITE 1

So I guess the check for finite or isfinite is broken.

I'm not soo fit with autoconf so I do not provide a diff here ;)

So long,

Andreas Maus.

P.S.: rrd_config.h and config.log are attached to this message.
P.P.S.: Used gcc was:

maus at schizo:~/devel/rrdtool/trunk/program $ gcc --version
gcc (GCC) 3.3.5 (propolice)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

-- 
Dipl.-Ing. Andreas Maus             science+computing ag
System Administration               Hagellocher Weg 73
tel.: +49 7071 9457 671             72070 Tuebingen, Germany
fax: +49 7071 9457 411              www.science-computing.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rrd_config.h.gz
Type: application/x-gunzip
Size: 2978 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20070823/5d34a5cd/attachment-0003.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.log.gz
Type: application/x-gunzip
Size: 15701 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20070823/5d34a5cd/attachment-0004.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20070823/5d34a5cd/attachment-0005.bin 


More information about the rrd-developers mailing list