Ticket #330 (closed defect: fixed)

Opened 4 months ago

Last modified 4 months ago

tm_gmtoff not available on Solaris when compiling with libdbi

Reported by: human Owned by: oetiker
Priority: major Milestone:
Component: misc Version: 1.4.6
Keywords: solaris Cc:

Description

I am trying to compile the latest RRDtool 1.4.6 on Solaris 10 Sparc with Sun Studio 12 and get the following compilation error:

  CC     pngsize.lo
"rrd.h", line 128: warning: modification of typedef with "int" ignored
  CC     rrd_fetch_libdbi.lo
"rrd.h", line 128: warning: modification of typedef with "int" ignored
"rrd_fetch_libdbi.c", line 467: undefined struct/union member: tm_gmtoff
cc: acomp failed for rrd_fetch_libdbi.c
gmake[2]: *** [rrd_fetch_libdbi.lo] Error 1

There is a similar issue reported here:

The suggestion there is to shield the usage with a conditional for Solaris, but probably an autoconf detection of the struct component would be better. This tiny patch fixed the issue:

---
 src/rrd_fetch_libdbi.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/rrd_fetch_libdbi.c b/src/rrd_fetch_libdbi.c
index 21fbc08..9d437aa 100644
--- a/src/rrd_fetch_libdbi.c
+++ b/src/rrd_fetch_libdbi.c
@@ -464,7 +464,9 @@ rrd_fetch_fn_libdbi(
     struct tm tm;
     time_t t=time(NULL);
     localtime_r(&t,&tm);
+#if !defined(__sun) && !defined(__sun__)
     gmt_offset=tm.tm_gmtoff;
+#endif
     isunixtime=0; table_help.timestamp++;
   }
   /* hex-unescape the value */
-- 

Change History

comment:1 Changed 4 months ago by oetiker

  • Status changed from new to closed
  • Resolution set to fixed

thanks, added autoconf based fix in r2265

comment:2 Changed 4 months ago by oetiker

oops broke it ... need r2266 too

Note: See TracTickets for help on using tickets.

NOTE: The content of this website is accessible with any browser. The graphical design though relies completely on CSS2 styles. If you see this text, this means that your browser does not support CSS2. Consider upgrading to a standard conformant browser like Mozilla Firefox or Opera but also Apple's Safari or KDE's Konqueror for example. It may also be that you are looking at a mirror page which did not copy the CSS for this page. Or if some pictu res are missing, then the mirror may not have picked up the contents of the inc directory.