Ticket #330 (closed defect: fixed)
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 */
--



thanks, added autoconf based fix in r2265