Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.

[udunits] Build and run problem on ubuntu 13.10 32bits

Hi there,

Using master or d98f047 (v2.2.3), I ran into build problems. For some reason libudunits2.so isn't build with -lm, causing the build of the udunits2 bin to fail. My quick workaround was to rebuild the lib "manually" by appending "-lm" to the original CC command.

Now i'm running into some basic usage problems, first the command line test, which works:
$ echo $LC_NAME
en_NZ.UTF-8
$ udunits2
You have: 1e3 V.A
You want: W
    1000 V.A = 1000 W

Now my quick test:
$ cat test.c
#include <stdio.h>
#include <udunits2.h>

int main(int argc, char *argv[])
{
  ut_system *sys = ut_read_xml(NULL);
  if (!sys) { printf("Sys error\n"); return 1; }

  ut_unit *from = ut_parse(sys, "V.A", UT_UTF8);
  if (!from) { printf("From error\n"); return 1; }

  ut_unit *to = ut_parse(sys, "W", UT_UTF8);
  if (!to) { printf("To error\n"); return 1; }

  int res = ut_are_convertible(from, to);
  if (res == 0) {
    cv_converter* conv = ut_get_converter(from, to);
    if (!conv) { printf("Conv error\n"); return 1; }
    printf("%g\n", cv_convert_double(conv, 1e3));
  }
  else {
    printf("%d %d %d\n", UT_SUCCESS, UT_NOT_SAME_SYSTEM, UT_BAD_ARG);
    printf("%d %p %p\n", res, from, to);
  }

  free(from);
  free(to);
  free(sys);

  return 0;
}
$ gcc -Wall test.c -o test -ludunits2 && ./test
0 5 1
1 0x9743b00 0x9748908

Which means that from and to are non null, but can_convert tells me that one of the two is null (1=UT_BAD_ARG)

Am I doing something wrong? This is what the udunits2 command line tool is doing basically

BTW, I have some warning messages as well (both with udunits2 -r and my test prog): Definition of "kt" in "/usr/local/share/udunits/udunits2-common.xml", line 90, overrides prefixed-unit "1000000 kilogram" Definition of "microns" in "/usr/local/share/udunits/udunits2-common.xml", line 336, overrides prefixed-unit "1e-15 second" Definition of "ft" in "/usr/local/share/udunits/udunits2-common.xml", line 433, overrides prefixed-unit "1e-12 kilogram" Definition of "yd" in "/usr/local/share/udunits/udunits2-common.xml", line 441, overrides prefixed-unit "8.64e-20 second" Definition of "pt" in "/usr/local/share/udunits/udunits2-common.xml", line 655, overrides prefixed-unit "1e-09 kilogram" Definition of "at" in "/usr/local/share/udunits/udunits2-common.xml", line 1052, overrides prefixed-unit "1e-15 kilogram" Definition of "ph" in "/usr/local/share/udunits/udunits2-common.xml", line 1571, overrides prefixed-unit "3.6e-09 second" Definition of "nt" in "/usr/local/share/udunits/udunits2-common.xml", line 1578, overrides prefixed-unit "1e-06 kilogram"



  • 2014 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the udunits archives: