Building rrdtool v1.3.8 on win32

View: New views
15 Messages — Rating Filter:   Alert me  

Building rrdtool v1.3.8 on win32

by Barrie0482 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I am working on writing a "rrdtool build howto" for win32. My motive for this
is to be able to use the ruby  rrdtool bindings on a windows  platform. My
aim is for this process to be easily repeatable for others to follow as new
versions of rrdtool are released.

Using the WIN32-BUILD-TIPS.txt included with the rrdtool source, I have been
able compile and run rrdtool v1.3.5 using Visual C++ 2008 Express edition. I
needed to modify the code for a couple of the source files. My C programming
skills are limited, so I'm not sure if what I did was best practice. I was
also able to compile the code for the ruby bindings.

The rrdtool executable seemed to work OK with the limited tests I ran. The
ruby bindings worked OK for some of the functions, but I had some  problems
with other functions. Some of the forum information seemed to point to fixes
in later releases.

Tobi sugessted that I should always use the latest release. So I have
started with rrdtool v1.3.8

I followed the instructions WIN32-BUILD-TIPS.txt using using Visual C++ 2008
Express edition.

I received the following error when I tried to build rrdlib.

1>------ Build started: Project: rrdlib, Configuration: Debug Win32 ------
1>Compiling...
1>rrd_restore.c
1>..\src\rrd_restore.c(917) : error C2664: 'get_long_from_node' : cannot
convert parameter 3 from 'time_t *' to 'long *'
1>        Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
1>Build log was saved at
"file://d:\projects\rrdtool\rrdtool-1.3.8\win32\Debug\BuildLog.htm"
1>rrdlib - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Any help appreciated. My apologies if this is a noob question.

Thanks.

Cheers, Barrie

--
View this message in context: http://n2.nabble.com/Building-rrdtool-v1.3.8-on-win32-tp3169370p3169370.html
Sent from the RRDtool Developers Mailinglist mailing list archive at Nabble.com.

_______________________________________________
rrd-developers mailing list
rrd-developers@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Re: Building rrdtool v1.3.8 on win32

by Barrie0482 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Barrie0482 wrote:

>
>
> I received the following error when I tried to build rrdlib.
>
> 1>------ Build started: Project: rrdlib, Configuration: Debug Win32 ------
> 1>Compiling...
> 1>rrd_restore.c
> 1>..\src\rrd_restore.c(917) : error C2664: 'get_long_from_node' : cannot
> convert parameter 3 from 'time_t *' to 'long *'
> 1>        Types pointed to are unrelated; conversion requires
> reinterpret_cast, C-style cast or function-style
> casthttp://oss.oetiker.ch/rrdtool/forum.en.html#nabble-td3169370%7Ca3169370
> 1>Build log was saved at
> "file://d:\projects\rrdtool\rrdtool-1.3.8\win32\Debug\BuildLog.htm"
> 1>rrdlib - 1 error(s), 0 warning(s)
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
> ==========
>


OK, I have found a fix for this error. I have added the patch file below.

--- D:\rrdtool\src\rrd_restore_orig.c
+++ D:\rrdtool\src\rrd_restore.c
@@ -48,6 +48,7 @@
 #define ARRAY_LENGTH(a) (sizeof (a) / sizeof ((a)[0]))
 static int opt_range_check = 0;
 static int opt_force_overwrite = 0;
+long * timet2long;
 
 /*
  * Auxiliary functions
@@ -897,12 +898,11 @@
                 rrd->stat_head->version,
                 sizeof (rrd->stat_head->version));
         else if (xmlStrcmp(child->name, (const xmlChar *) "step") == 0)
-            status = get_ulong_from_node(doc, child,
-                &rrd->stat_head->pdp_step);
-        else if (xmlStrcmp(child->name, (const xmlChar *) "lastupdate") ==
0)
-            status = get_long_from_node(doc, child,
-                &rrd->live_head->last_up);
-        else if (xmlStrcmp(child->name, (const xmlChar *) "ds") == 0)
+            status = get_ulong_from_node(doc, child,
&rrd->stat_head->pdp_step);
+        else if (xmlStrcmp(child->name, (const xmlChar *) "lastupdate") ==
0) {
+            timet2long = (long *) & rrd->live_head->last_up;
+            status = get_long_from_node(doc, child, timet2long);
+        } else if (xmlStrcmp(child->name, (const xmlChar *) "ds") == 0)
             status = parse_tag_ds(doc, child, rrd);
         else if (xmlStrcmp(child->name, (const xmlChar *) "rra") == 0)
             status = parse_tag_rra(doc, child, rrd);

I'm not sure if this is the best way to fix the problem I had, but it
worked. I have been able to compile and run rrdtool v1.3.8 on Windows XP. I
am going to do some testing and try to compile the ruby gem on this build.

Cheers, Barrie
--
View this message in context: http://n2.nabble.com/Building-rrdtool-v1.3.8-on-win32-tp3169370p3204387.html
Sent from the RRDtool Developers Mailinglist mailing list archive at Nabble.com.

_______________________________________________
rrd-developers mailing list
rrd-developers@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Re: Building rrdtool v1.3.8 on win32

by Tobias Oetiker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Barrie,

would the following patch work for you too:

Index: rrd_restore.c
===================================================================
--- rrd_restore.c       (revision 1801)
+++ rrd_restore.c       (working copy)
@@ -151,6 +151,36 @@
     return (0);
 }                       /* int get_ulong_from_node */

+static int get_long_long_from_node(
+    xmlDoc * doc,
+    xmlNode * node,
+    long long *value)
+{
+    long long       temp;
+    char     *str_ptr;
+    char     *end_ptr;
+
+    str_ptr = (char *) xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
+    if (str_ptr == NULL) {
+        rrd_set_error("get_ulong_from_node: xmlNodeListGetString failed.");
+        return (-1);
+    }
+
+    end_ptr = NULL;
+    temp = strtoll(str_ptr, &end_ptr, 0);
+    xmlFree(str_ptr);
+
+    if (str_ptr == end_ptr) {
+        rrd_set_error("get_long_long_from_node: Cannot parse buffer as unsigned long long: %s",
+                      str_ptr);
+        return (-1);
+    }
+
+    *value = temp;
+
+    return (0);
+}                       /* int get_ulong_from_node */
+
 static int get_double_from_node(
     xmlDoc * doc,
     xmlNode * node,
@@ -918,8 +948,12 @@
             status = get_ulong_from_node(doc, child,
                                         &rrd->stat_head->pdp_step);
         else if (xmlStrcmp(child->name, (const xmlChar *) "lastupdate") == 0)
-            status = get_long_from_node(doc, child,
-                                        &rrd->live_head->last_up);
+            if (sizeof(time_t) == sizeof(long)) {
+                    status = get_long_from_node(doc, child, (long *)&rrd->live_head->last_up);
+            }
+            else if (sizeof(time_t) == sizeof(long long)) {
+                    status = get_long_long_from_node(doc, child, (long long *)&rrd->live_head->last_up);
+            }
         else if (xmlStrcmp(child->name, (const xmlChar *) "ds") == 0)
             status = parse_tag_ds(doc, child, rrd);
         else if (xmlStrcmp(child->name, (const xmlChar *) "rra") == 0)

Yesterday Barrie0482 wrote:

>
>
> Barrie0482 wrote:
> >
> >
> > I received the following error when I tried to build rrdlib.
> >
> > 1>------ Build started: Project: rrdlib, Configuration: Debug Win32 ------
> > 1>Compiling...
> > 1>rrd_restore.c
> > 1>..\src\rrd_restore.c(917) : error C2664: 'get_long_from_node' : cannot
> > convert parameter 3 from 'time_t *' to 'long *'
> > 1>        Types pointed to are unrelated; conversion requires
> > reinterpret_cast, C-style cast or function-style
> > casthttp://oss.oetiker.ch/rrdtool/forum.en.html#nabble-td3169370%7Ca3169370
> > 1>Build log was saved at
> > "file://d:\projects\rrdtool\rrdtool-1.3.8\win32\Debug\BuildLog.htm"
> > 1>rrdlib - 1 error(s), 0 warning(s)
> > ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
> > ==========
> >
>
>
> OK, I have found a fix for this error. I have added the patch file below.
>
> --- D:\rrdtool\src\rrd_restore_orig.c
> +++ D:\rrdtool\src\rrd_restore.c
> @@ -48,6 +48,7 @@
>  #define ARRAY_LENGTH(a) (sizeof (a) / sizeof ((a)[0]))
>  static int opt_range_check = 0;
>  static int opt_force_overwrite = 0;
> +long * timet2long;
>
>  /*
>   * Auxiliary functions
> @@ -897,12 +898,11 @@
>                  rrd->stat_head->version,
>                  sizeof (rrd->stat_head->version));
>          else if (xmlStrcmp(child->name, (const xmlChar *) "step") == 0)
> -            status = get_ulong_from_node(doc, child,
> -                &rrd->stat_head->pdp_step);
> -        else if (xmlStrcmp(child->name, (const xmlChar *) "lastupdate") ==
> 0)
> -            status = get_long_from_node(doc, child,
> -                &rrd->live_head->last_up);
> -        else if (xmlStrcmp(child->name, (const xmlChar *) "ds") == 0)
> +            status = get_ulong_from_node(doc, child,
> &rrd->stat_head->pdp_step);
> +        else if (xmlStrcmp(child->name, (const xmlChar *) "lastupdate") ==
> 0) {
> +            timet2long = (long *) & rrd->live_head->last_up;
> +            status = get_long_from_node(doc, child, timet2long);
> +        } else if (xmlStrcmp(child->name, (const xmlChar *) "ds") == 0)
>              status = parse_tag_ds(doc, child, rrd);
>          else if (xmlStrcmp(child->name, (const xmlChar *) "rra") == 0)
>              status = parse_tag_rra(doc, child, rrd);
>
> I'm not sure if this is the best way to fix the problem I had, but it
> worked. I have been able to compile and run rrdtool v1.3.8 on Windows XP. I
> am going to do some testing and try to compile the ruby gem on this build.
>
> Cheers, Barrie
>

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi@... ++41 62 775 9902 / sb: -9900

_______________________________________________
rrd-developers mailing list
rrd-developers@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Re: Building rrdtool v1.3.8 on win32

by Barrie0482 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Tobi,

I am using Microsoft's Visual C++ 2008 Express edition. I doesn't seem to
support strtoll.

1>..\src\rrd_restore.c(136) : error C3861: 'strtoll': identifier not found

I'm looking to see if I can find a workaround.

Cheers, Barrie




oetiker wrote:

>
>
> would the following patch work for you too:
>
> Index: rrd_restore.c
> ===================================================================
> --- rrd_restore.c       (revision 1801)
> +++ rrd_restore.c       (working copy)
>
>

--
View this message in context: http://n2.nabble.com/Building-rrdtool-v1.3.8-on-win32-tp3169370p3208022.html
Sent from the RRDtool Developers Mailinglist mailing list archive at Nabble.com.

_______________________________________________
rrd-developers mailing list
rrd-developers@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Re: Building rrdtool v1.3.8 on win32

by Tobias Oetiker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Today Barrie0482 wrote:

I found this

#ifdef WIN32
/* Gross Hack Alert */
#if _MSC_VER < 1300
#define strtoll(p, e, b) ((*(e) = (char*)(p) + (((b) == 10) ? strspn((p), "0123456789") : 0)), _atoi64(p))
#else
#define strtoll(p, e, b) _strtoi64(p, e, b)
#endif

cheers
tobi

> Hi Tobi,
>
> I am using Microsoft's Visual C++ 2008 Express edition. I doesn't seem to
> support strtoll.
>
> 1>..\src\rrd_restore.c(136) : error C3861: 'strtoll': identifier not found
>
> I'm looking to see if I can find a workaround.
>
> Cheers, Barrie
>
>
>
>
> oetiker wrote:
> >
> >
> > would the following patch work for you too:
> >
> > Index: rrd_restore.c
> > ===================================================================
> > --- rrd_restore.c       (revision 1801)
> > +++ rrd_restore.c       (working copy)
> >
> >
>
>

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi@... ++41 62 775 9902 / sb: -9900

_______________________________________________
rrd-developers mailing list
rrd-developers@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Re: Building rrdtool v1.3.8 on win32

by Barrie0482 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Tobi,

Thanks. I have added the following to the top of rrd_restore.c. Looks
like it worked OK. It compiled with no errors. Lots of warnings though.
I'll do some testing and let you know how I go.

#ifdef WIN32
/* Gross Hack Alert */
#if _MSC_VER < 1300
#define strtoll(p, e, b) ((*(e) = (char*)(p) + (((b) == 10) ?
strspn((p), "0123456789") : 0)), _atoi64(p))
#else
#define strtoll(p, e, b) _strtoi64(p, e, b)
#endif
#endif

Cheers, Barrie

Tobias Oetiker wrote:
> Today Barrie0482 wrote:
>
> I found this
>  

_______________________________________________
rrd-developers mailing list
rrd-developers@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Re: Building rrdtool v1.3.8 on win32

by Barrie0482 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Tobi,

I have a script that does the following.

  * creates and populates the RRD with test data - works OK
 * produces a png graph - works OK
 * extracts the RRD data to an xml file - works OK
 * creates a new RRD from the XML - works OK
 * produces a png graph from the new RRD - works OK
 * fetches a number of data points from the RRD - works OK
 * returns the date of the first data sample in RRD and the new RRD -
fails with an error like ERROR: 'test.rrd' is too small (should be 5676
bytes)
 * returns the date of the last data sample in RRD and the new RRD -
fails with an error like ERROR: 'test.rrd' is too small (should be 5676
bytes)
 * extract header information from the RRD - fails with an error like
ERROR: 'test.rrd' is too small (should be 5676 bytes)

This is not a comprehensive test. It just tests the functions I use. I
have seen these errors in the forums, but I haven't looked to deep as yet.

Next I'll try and get the ruby bindings to compile and document the
win32 build steps.

Cheers, Barrie



Tobias Oetiker wrote:

> Today Barrie0482 wrote:
>
> I found this
>
> #ifdef WIN32
> /* Gross Hack Alert */
> #if _MSC_VER < 1300
> #define strtoll(p, e, b) ((*(e) = (char*)(p) + (((b) == 10) ? strspn((p), "0123456789") : 0)), _atoi64(p))
> #else
> #define strtoll(p, e, b) _strtoi64(p, e, b)
> #endif
>
> cheers
> tobi
>
>  
>> Hi Tobi,
>>
>> I am using Microsoft's Visual C++ 2008 Express edition. I doesn't seem to
>> support strtoll.
>>
>> 1>..\src\rrd_restore.c(136) : error C3861: 'strtoll': identifier not found
>>
>> I'm looking to see if I can find a workaround.
>>
>> Cheers, Barrie
>>
>>
>>
>>
>> oetiker wrote:
>>    
>>> would the following patch work for you too:
>>>
>>> Index: rrd_restore.c
>>> ===================================================================
>>> --- rrd_restore.c       (revision 1801)
>>> +++ rrd_restore.c       (working copy)
>>>
>>>
>>>      
>>    
>
>  
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.375 / Virus Database: 270.13.3/2217 - Release Date: 07/03/09 18:11:00
>
>  

_______________________________________________
rrd-developers mailing list
rrd-developers@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Re: Building rrdtool v1.3.8 on win32

by Tobias Oetiker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Barrie,

Today Barrie wrote:

> Hi Tobi,
>
> I have a script that does the following.
>
>  * creates and populates the RRD with test data - works OK
> * produces a png graph - works OK
> * extracts the RRD data to an xml file - works OK
> * creates a new RRD from the XML - works OK
> * produces a png graph from the new RRD - works OK
> * fetches a number of data points from the RRD - works OK

do the errors only occure on the rrds created by rrd_restore ? this
would indicate that there is still a problem with rrd_restore on
windows ...

> * returns the date of the first data sample in RRD and the new RRD - fails
> with an error like ERROR: 'test.rrd' is too small (should be 5676 bytes)
> * returns the date of the last data sample in RRD and the new RRD - fails with
> an error like ERROR: 'test.rrd' is too small (should be 5676 bytes)
> * extract header information from the RRD - fails with an error like ERROR:
> 'test.rrd' is too small (should be 5676 bytes)
>
> This is not a comprehensive test. It just tests the functions I use. I have
> seen these errors in the forums, but I haven't looked to deep as yet.
>
> Next I'll try and get the ruby bindings to compile and document the win32
> build steps.
>
> Cheers, Barrie
>
>
>
> Tobias Oetiker wrote:
> > Today Barrie0482 wrote:
> >
> > I found this
> >
> > #ifdef WIN32
> > /* Gross Hack Alert */
> > #if _MSC_VER < 1300
> > #define strtoll(p, e, b) ((*(e) = (char*)(p) + (((b) == 10) ? strspn((p),
> > "0123456789") : 0)), _atoi64(p))
> > #else
> > #define strtoll(p, e, b) _strtoi64(p, e, b)
> > #endif
> >
> > cheers
> > tobi
> >
> >
> > > Hi Tobi,
> > >
> > > I am using Microsoft's Visual C++ 2008 Express edition. I doesn't seem to
> > > support strtoll.
> > >
> > > 1>..\src\rrd_restore.c(136) : error C3861: 'strtoll': identifier not found
> > >
> > > I'm looking to see if I can find a workaround.
> > >
> > > Cheers, Barrie
> > >
> > >
> > >
> > >
> > > oetiker wrote:
> > >
> > > > would the following patch work for you too:
> > > >
> > > > Index: rrd_restore.c
> > > > ===================================================================
> > > > --- rrd_restore.c       (revision 1801)
> > > > +++ rrd_restore.c       (working copy)
> > > >
> > > >
> > > >
> > >
> >
> >   ------------------------------------------------------------------------
> >
> >
> > No virus found in this incoming message.
> > Checked by AVG - www.avg.com Version: 8.5.375 / Virus Database:
> > 270.13.3/2217 - Release Date: 07/03/09 18:11:00
> >
> >
>
>

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi@... ++41 62 775 9902 / sb: -9900

_______________________________________________
rrd-developers mailing list
rrd-developers@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Re: Building rrdtool v1.3.8 on win32

by Barrie0482 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Tobi,

The errors occur on both the rrd created bt rrd_create and rrd_restore.

rrdtool.exe info test.rrd
ERROR: 'test.rrd' is too small (should be 5676 bytes)

rrdtool.exe info new.rrd
ERROR: 'new.rrd' is too small (should be 5676 bytes)

Cheers, Barrie

Tobias Oetiker wrote:
> do the errors only occure on the rrds created by rrd_restore ? this
> would indicate that there is still a problem with rrd_restore on
> windows ...
>  

_______________________________________________
rrd-developers mailing list
rrd-developers@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Re: Building rrdtool v1.3.8 on win32

by Tobias Oetiker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tomorrow Barrie wrote:

> Hi Tobi,
>
> The errors occur on both the rrd created bt rrd_create and rrd_restore.
>
> rrdtool.exe info test.rrd
> ERROR: 'test.rrd' is too small (should be 5676 bytes)
>
> rrdtool.exe info new.rrd
> ERROR: 'new.rrd' is too small (should be 5676 bytes)

ok so it is at least consistant ...
cheers
tobi

>
> Cheers, Barrie
>
> Tobias Oetiker wrote:
> > do the errors only occure on the rrds created by rrd_restore ? this
> > would indicate that there is still a problem with rrd_restore on
> > windows ...
> >
>
>

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi@... ++41 62 775 9902 / sb: -9900

_______________________________________________
rrd-developers mailing list
rrd-developers@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Re: Building rrdtool v1.3.8 on win32

by Barrie0482 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Tobi,

I was wrong in my last mail. It actually looks like rrd_restore is now
not working. I must have been testing with the wrong binaries.

I am going to clean up my project area and make sure I have my
information correct.

Sorry about the wrong information.

Cheers, Barrie


Tobias Oetiker wrote:

> Tomorrow Barrie wrote:
>
>  
>> Hi Tobi,
>>
>> The errors occur on both the rrd created bt rrd_create and rrd_restore.
>>
>> rrdtool.exe info test.rrd
>> ERROR: 'test.rrd' is too small (should be 5676 bytes)
>>
>> rrdtool.exe info new.rrd
>> ERROR: 'new.rrd' is too small (should be 5676 bytes)
>>    
>
> ok so it is at least consistant ...
> cheers
> tobi
>
>  
>> Cheers, Barrie
>>
>> Tobias Oetiker wrote:
>>    
>>> do the errors only occure on the rrds created by rrd_restore ? this
>>> would indicate that there is still a problem with rrd_restore on
>>> windows ...
>>>
>>>      
>>    
>
>  
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.375 / Virus Database: 270.13.5/2219 - Release Date: 07/05/09 05:53:00
>
>  

_______________________________________________
rrd-developers mailing list
rrd-developers@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Re: Building rrdtool v1.3.8 on win32

by Tobias Oetiker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Barrie,

just to be sure, here is the latest version of the patch ...

--- rrd_restore.c       (revision 1801)
+++ rrd_restore.c       (working copy)
@@ -151,6 +151,46 @@
     return (0);
 }                       /* int get_ulong_from_node */

+
+#ifdef WIN32
+/* Gross Hack Alert */
+#if _MSC_VER < 1300
+#define strtoll(p, e, b) ((*(e) = (char*)(p) + (((b) == 10) ? strspn((p), "0123456789") : 0)), _atoi64(p))
+#else
+#define strtoll(p, e, b) _strtoi64(p, e, b)
+#endif
+#endif
+
+static int get_llong_from_node(
+    xmlDoc * doc,
+    xmlNode * node,
+    long long *value)
+{
+    long long       temp;
+    char     *str_ptr;
+    char     *end_ptr;
+
+    str_ptr = (char *) xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
+    if (str_ptr == NULL) {
+        rrd_set_error("get_llong_from_node: xmlNodeListGetString failed.");
+        return (-1);
+    }
+
+    end_ptr = NULL;
+    temp = strtoll(str_ptr, &end_ptr, 10);
+    xmlFree(str_ptr);
+
+    if (str_ptr == end_ptr) {
+        rrd_set_error("get_llong_from_node: Cannot parse buffer as unsigned long long: %s",
+                      str_ptr);
+        return (-1);
+    }
+
+    *value = temp;
+
+    return (0);
+}                       /* int get_llong_from_node */
+
 static int get_double_from_node(
     xmlDoc * doc,
     xmlNode * node,
@@ -917,9 +957,19 @@
         else if (xmlStrcmp(child->name, (const xmlChar *) "step") == 0)
             status = get_ulong_from_node(doc, child,
                                         &rrd->stat_head->pdp_step);
-        else if (xmlStrcmp(child->name, (const xmlChar *) "lastupdate") == 0)
-            status = get_long_from_node(doc, child,
-                                        &rrd->live_head->last_up);
+        else if (xmlStrcmp(child->name, (const xmlChar *) "lastupdate") == 0) {
+            if (sizeof(time_t) == sizeof(long)) {
+               status = get_long_from_node(doc, child, (long *)&rrd->live_head->last_up);
+            }
+            else { if (sizeof(time_t) == sizeof(long long)) {
+                       status = get_llong_from_node(doc, child, (long long *)&rrd->live_head->last_up);
+                    }
+                    else {
+                       rrd_set_error("can't convert to time_t ...", child->name);
+                       status = -1;
+                    }
+            }
+        }
         else if (xmlStrcmp(child->name, (const xmlChar *) "ds") == 0)
             status = parse_tag_ds(doc, child, rrd);
         else if (xmlStrcmp(child->name, (const xmlChar *) "rra") == 0)


cheers
tobi

Today Barrie wrote:

> Hi Tobi,
>
> I was wrong in my last mail. It actually looks like rrd_restore is now not
> working. I must have been testing with the wrong binaries.
>
> I am going to clean up my project area and make sure I have my information
> correct.
>
> Sorry about the wrong information.
>
> Cheers, Barrie
>
>
> Tobias Oetiker wrote:
> > Tomorrow Barrie wrote:
> >
> >
> > > Hi Tobi,
> > >
> > > The errors occur on both the rrd created bt rrd_create and rrd_restore.
> > >
> > > rrdtool.exe info test.rrd
> > > ERROR: 'test.rrd' is too small (should be 5676 bytes)
> > >
> > > rrdtool.exe info new.rrd
> > > ERROR: 'new.rrd' is too small (should be 5676 bytes)
> > >
> >
> > ok so it is at least consistant ...
> > cheers
> > tobi
> >
> >
> > > Cheers, Barrie
> > >
> > > Tobias Oetiker wrote:
> > >
> > > > do the errors only occure on the rrds created by rrd_restore ? this
> > > > would indicate that there is still a problem with rrd_restore on
> > > > windows ...
> > > >
> > > >
> > >
> >
> >   ------------------------------------------------------------------------
> >
> >
> > No virus found in this incoming message.
> > Checked by AVG - www.avg.com Version: 8.5.375 / Virus Database:
> > 270.13.5/2219 - Release Date: 07/05/09 05:53:00
> >
> >
>
>

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi@... ++41 62 775 9902 / sb: -9900

_______________________________________________
rrd-developers mailing list
rrd-developers@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Parent Message unknown Re: Building rrdtool v1.3.8 on win32

by Tobias Oetiker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Barrie,

Today Barrie wrote:

> Hi Tobi,
>
> I applied the patch and recompiled again to be sure.
>
> The strtoll work around did not apply with the patch for some reason, so I
> manually added it to rrd_restore.c.
>
> This is the testing I have done on the new set of binaries.
>
> create - works
> update - works
> graph - works
> dump - works, but has an incorrect year compared to the unix time in the xml.
> e.g.year 2145
>
>    <!-- 2145-08-13 05:58:16 E. Australia Standard Time / 1246887000 -->

oh ...

> restore - does not reproduce the rrd file. It does create a rrd but with no
> entries. Dump of  restored rrd below.
>
> <?xml version="1.0" encoding="utf-8"?>
> <!DOCTYPE rrd SYSTEM "http://oss.oetiker.ch/rrdtool/rrdtool.dtd">
> <!-- Round Robin Database Dump --><rrd> <version> 0003 </version>
>        <step> 300 </step> <!-- Seconds -->
>        <lastupdate> 1246974488 </lastupdate> <!-- 2009-07-07 23:48:08 E.
> Australia Standard Time -->

which is worse than before ... with your original patch is worked
correctly ?

cheers
tobi

>
> <!-- Round Robin Archives --></rrd>
> fetch - works
> first - works
> last - works
> info - works
>
> I have attached my current rrd_restore.c and a zip of the files I created
> during the test.
>
> FYI, my test is a ruby script calling a rrdtool wrapper I have written in
> ruby.
>
> Cheers, Barrie
>
>
> Tobias Oetiker wrote:
> > Hi Barrie,
> >
> > just to be sure, here is the latest version of the patch ...
> >
> > --- rrd_restore.c       (revision 1801)
> > +++ rrd_restore.c       (working copy)
> >
>
>

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi@... ++41 62 775 9902 / sb: -9900

_______________________________________________
rrd-developers mailing list
rrd-developers@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Re: Building rrdtool v1.3.8 on win32

by Barrie0482 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Tobi,

Just a quick update.

I have been able to compile the ruby bindings. I needed to modify the
main.c in the ruby bindings to include the first function and to work
around a win32 problem with unistd.h. I'll send the modified  main.c to
you when I have confirmed it is working properly.

I have been able to run my test script using the ruby binding. I am
currently modifying another ruby script to use the ruby binding.

I have started writing my win32 build doco and I will publish it on my
repository on github when it is ready.

Cheers, Barrie

_______________________________________________
rrd-developers mailing list
rrd-developers@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Re: Building rrdtool v1.3.8 on win32

by Barrie0482 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Tobi,

I have written the first version of the rrdtool win32 build instructions
based on  the  WIN32-BUILD-TIPS.txt  as you suggested. Once  I work out  
how  and where to setup the required libraries  I'll also add a set of
binaries to the  repository as well.

The doco is here: http://wiki.github.com/barrie0482/rrdtool_win32_build 
, the diff files are under the source tab.

The ruby bindings seem to be working OK.  I need to work out how  and
where to setup the required libraries in a ruby gem and I'll put the gem
on a new repository with the doco I am writing to build the ruby bindings.

Cheers, Barrie

_______________________________________________
rrd-developers mailing list
rrd-developers@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers