Compilation Error Ver. 0.8.10 on Debian/Sarge

Help
2005-08-19
2013-06-03
  • Balbir Thomas
    Balbir Thomas
    2005-08-19

    I get a compilation error that NC_MAX_NAME is
    not declared in ncdf_att_cl.cpp at line 84. However
    this file includes netcdf.h which is present in
    /usr/include. This is the first error reported, there are many other not all belonging to netcdf.h.
    For example att_name is also undeclared. Would be
    greatfull for any suggestions on why this could be
    happening.

     
    • Marc Schellens
      Marc Schellens
      2005-08-20

      The problem is using netCDF and HDF.
      Please refer to the README, requirements section
      about netCDF and HDF.
      There the problem is explained and solutions provided.
      HTH,
      marc

       
    • Balbir Thomas
      Balbir Thomas
      2005-09-04

      Thank you,

      The problem is indeed, as you point out due to the
      conflict between similarly named hearder files in
      hdf4 and netcdf. However the solution is not appropirate for debian as hdf4 include files are
      placed under /usr/include/hdf so that it does not
      conflict with netcdf. If a package overwrites the files of another that is an error of the package management system and any good distribution should not allow this.
      Since the $INCLUDES variable in src/Makefile.in, also points to /usr/include/hdf, when compliling  gld-ncdf* files this conflict of header files get exposed. IMHO the best option for the long run will be to split $INCLUES so that hdf4 hearder paths are not included when compiling gdl's netcdf files. Is this possible ?
      While I am not very comfortable with autoconf and libtool, I am trying to hack this, and if successfull will send you a diff but should you have the time before next release, kindly do look into it.

      sincerely
      B Thomas

       
    • Marc Schellens
      Marc Schellens
      2005-09-05

      I don't know if splitting on a file basis is possible.
      At least I would expect that this is a quite big hack as a lot of things have to be doubled (assuming that there isn't a special autoconf command).
      But check the latest CVS version.
      I think it should be sorted out, as the netCDF path goes now before the HDF path into the search-path and thus the 'real' netcdf.h gets included.
      HTH,
      marc

       
    • Balbir Thomas
      Balbir Thomas
      2005-09-09

      Hi,
      Thanks again. I was not able to test if the cvs version fixes the header problem. There seems to be another compilation failure due to ambiguous signature of sqrt() as shown below :

      if i386-linux-g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/magick -I/usr/include/netcdf-3 -I/usr/include/hdf -I/usr/include/hdf \then mv -f ".deps/gdl-m
      ath_fun_jmg.Tpo" ".deps/gdl-math_fun_jmg.Po"; else rm -f ".deps/gdl-math_fun_jmg.Tpo"; exit 1; fi
      math_fun_jmg.cpp: In function `BaseGDL* lib::radon_fun(EnvT*)':
      math_fun_jmg.cpp:470: error: call of overloaded `sqrt(unsigned int)' is
      ambiguous
      /usr/include/bits/mathcalls.h:157: error: candidates are: double sqrt(double)
      /usr/include/c++/3.3/cmath:550: error:                 long double
      std::sqrt(long double)
      /usr/include/c++/3.3/cmath:546: error:                 float std::sqrt(float)
      math_fun_jmg.cpp:503: error: call of overloaded `sqrt(int)' is ambiguous
      /usr/include/bits/mathcalls.h:157: error: candidates are: double sqrt(double)
      /usr/include/c++/3.3/cmath:550: error:                 long double
      std::sqrt(long double)
      /usr/include/c++/3.3/cmath:546: error:                 float std::sqrt(float)
      make[4]: *** [gdl-math_fun_jmg.o] Error 1
      make[4]: Leaving directory `/home/bt/archive/debian/gdl/gdl-0.8.11/src'
      make[3]: *** [all-recursive] Error 1
      make[3]: Leaving directory `/home/bt/archive/debian/gdl/gdl-0.8.11/src'
      make[2]: *** [all-recursive] Error 1
      make[2]: Leaving directory `/home/bt/archive/debian/gdl/gdl-0.8.11'
      make[1]: *** [all] Error 2
      make[1]: Leaving directory `/home/bt/archive/debian/gdl/gdl-0.8.11'
      make: *** [build-stamp] Error 2

      Although this is not relevant to the error I am puzzled by the include directive "-I/usr/include/netcdf-3" . There is no such thing on my system.

      sincerely
      B Thomas

       
    • Balbir Thomas
      Balbir Thomas
      2005-09-09

      Oops forgot to emphasise that the sqrt compiler failure in my previous message occurs in the cvs version (today).

       
    • Joel Gales
      Joel Gales
      2005-09-09

      The "ambiguous" call to "sqrt" in math_fun_jmg.cpp has been fixed in CVS.

      Joel

       
    • Balbir Thomas
      Balbir Thomas
      2005-09-10

      Yep sqrt problem in math_fun_jmg.cpp is fixed and it exposes the original header conflict again as shown below. Have you been able to reproduce this problem on you computer intalling the two libraries under different directories ?  Let me know what else I can do to help ?
      While I have only read the first few chapters of the autobook and am making my way slowly across it (as time permits) , I gather the restriction on having a common $INCLUDE comes from the use of automake. Couldn't you for instance have all netcdf interface files compiled into and library say libgdlncdf and so this can have its own INCLUDES in Makefile.am and so on for the the other parts of the program.  Alternatively if you can point me towards some information on the programs overall structure/design  and dependencies I can try writing Makefile.in manually if you like to dispense with automake altogeather (I will be very slow though so you shouldn't have to wait for me).

      regards
      bt

      -------------------------------ERROR MESSAGE------------------
      if i386-linux-g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/magick -I/usr/include/netcdf-3 -I/usr/include/hdf -I/usr/include/hdf -I/usr/include/python
      2.3     -g -O2 -MT gdl-ncdf_att_cl.o -MD -MP -MF ".deps/gdl-ncdf_att_cl.Tpo" -c -o gdl-ncdf_att_cl.o `test -f 'ncdf_att_cl.cpp' || echo './'`ncdf_att_cl
      .cpp; \ then mv -f ".deps/gdl-ncdf_att_cl.Tpo" ".deps/gdl-ncdf_att_cl.Po"; else rm -f ".deps/gdl-ncdf_att_cl.Tpo"; exit 1; fi
      ncdf_att_cl.cpp: In function `BaseGDL* lib::ncdf_attname(EnvT*)':
      ncdf_att_cl.cpp:84: error: `NC_MAX_NAME' undeclared (first use this function)
      ncdf_att_cl.cpp:84: error: (Each undeclared identifier is reported only once
         for each function it appears in.)
      ncdf_att_cl.cpp:109: error: `att_name' undeclared (first use this function)
      ncdf_att_cl.cpp:109: error: `nc_inq_attname' undeclared (first use this
         function)
      ncdf_att_cl.cpp: In function `BaseGDL* lib::ncdf_attinq(EnvT*)':
      ncdf_att_cl.cpp:159: error: `nc_inq_att' undeclared (first use this function)
      ncdf_att_cl.cpp: In function `void lib::ncdf_attget(EnvT*)':
      ncdf_att_cl.cpp:225: error: `nc_inq_att' undeclared (first use this function)
      ncdf_att_cl.cpp:232: error: `NC_INT' undeclared (first use this function)
      ncdf_att_cl.cpp:240: error: `nc_get_att_int' undeclared (first use this
         function)
      ncdf_att_cl.cpp:258: error: `nc_get_att_short' undeclared (first use this
         function)
      ncdf_att_cl.cpp:280: error: `nc_get_att_float' undeclared (first use this
         function)
      ncdf_att_cl.cpp:302: error: `nc_get_att_double' undeclared (first use this
         function)
      ncdf_att_cl.cpp:322: error: `nc_get_att_text' undeclared (first use this
         function)
      ncdf_att_cl.cpp:342: error: `nc_get_att_uchar' undeclared (first use this
         function)

       
    • Marc Schellens
      Marc Schellens
      2005-09-12

      Even though I think automake is a kind of mess
      (but being not to comfortable with it) I think a manual
      Makefile.in would complicate things rather than ease them.

      netcdf-3 is a directory for netcdf from some third party provider of rpms for FC3.

      Did you provide a path for netcdf to configure at all?
      If you have it in a subdirctory '.../include' provide this path without the 'include'. This should work. (the library then shoudl be in '.../lib'

      HTH,
      marc

       
    • Balbir Thomas
      Balbir Thomas
      2005-09-13

      Hi,
      I tried using --with-netcdf=/usr since netcdf.h from the netcdf library is in /usr/include and the
      library in /usr/lib. I also tried not building hdf4
      with --without-hdf (note hdf4 is in /usr/include/hdf and hdf5 is in /usr/include). In both these cases I get the same error. Oddly enough
      --without-hdf does not seem to work since i see
      -I/usr/include/hdf being used in the compilation.

      I hate to be bothering you with this since you are
      doing a great job with a much needed application. However I was trying to build debian packages for this application and make them available to you, and put them on my web page (http://www.scientificcomputing.net). For this purpose it would be great if I could build with all
      features enabled.
      If you know someone using a version of linux other
      than debian or fedora core 3 you may want to have them try the build too.
      I do have access to fedora core 3 in my office but
      at home its is debian. I'll be happy to help in any way I can.

       
    • Marc Schellens
      Marc Schellens
      2005-09-14

      Are you using the latest CVS version?
      /usr/include/hdf is included for hdf4 and 5 as
      some systems got their include files there.
      hdf4 is causing the trouble (has netcdf.h).
      But: if you set the netcdf path explicitely,
      it should appear before the hdf4 path (does it?).
      So it is strange that you still get the error.

      Please confirm the path order and that you use the latest CVS version.

      Don't worry about bothering, it is in our interest that
      GDL compiles on as many platforms as possible
      (but that with the least possible effort of course :-).
      And a debian version is welcome.

      marc

       
    • Joel Gales
      Joel Gales
      2005-09-14

      BT,

      Change the lines in configure:

      EXT_LIBS="$LIBS"
      EXT_INCLUDES="$INCLUDES"

      to

      EXT_LIBS="$EXT_LIBS $LIBS"
      EXT_INCLUDES="$EXT_INCLUDES $INCLUDES"

      Then:

      setenv EXT_INCLUDES  /usr/include

      This should place /usr/include before /usr/include/hdf in the include search path.

      Joel

      P.S.  Although I can compile all the netcdf code I'm currently having problems linking because both libnetcdf.a and libmfhdf.a contain netcdf funtions with the same names.

       
    • Balbir Thomas
      Balbir Thomas
      2005-09-16

      Apologies for the delay, was hard pressed at work. Will be busy till next weekend (i.e after 21st). 

      However I did attempt compilation with cvs source of 09/14/05 and as per the above instructions and got this error :
      -------------------------------------------------------------------------------------
      make[4]: Leaving directory `/home/bt/archive/debian/gdl/gdl-0.8.11/src/antlr'
      make[4]: Entering directory `/home/bt/archive/debian/gdl/gdl-0.8.11/src'
      if i386-linux-g++ -DHAVE_CONFIG_H -I. -I. -I.. /usr/include  -I/usr/include/magick -I/usr/include -I/usr/include/hdf -I/usr/include/hdf -I/us
      r/include/python2.3     -g -O2 -MT gdl-assocdata.o -MD -MP -MF ".deps/gdl-assocdata.Tpo" -c -o gdl-assocdata.o `test -f 'assocdata.cpp' || ec
      ho './'`assocdata.cpp; \ then mv -f ".deps/gdl-assocdata.Tpo" ".deps/gdl-assocdata.Po"; else rm -f ".deps/gdl-assocdata.Tpo"; exit 1; fi
      i386-linux-g++: cannot specify -o with -c or -S and multiple compilations
      make[4]: *** [gdl-assocdata.o] Error 1
      make[4]: Leaving directory `/home/bt/archive/debian/gdl/gdl-0.8.11/src'
      make[3]: *** [all-recursive] Error 1
      make[3]: Leaving directory `/home/bt/archive/debian/gdl/gdl-0.8.11/src'
      make[2]: *** [all-recursive] Error 1
      make[2]: Leaving directory `/home/bt/archive/debian/gdl/gdl-0.8.11'
      make[1]: *** [all] Error 2
      make[1]: Leaving directory `/home/bt/archive/debian/gdl/gdl-0.8.11'
      make: *** [build-stamp] Error 2
      bt@mandelbrot:~/work/thesis/octave/compare$ ls -l ~/archive/debian/gdl/         
      total 820

      -------------------------------------------------------------------------------------
      Only way I can think of solving the linking problem of libmfhdf.a and libnetcdf.a is not to link them booth to the same executable.
      I mean if you seperate the functions that use one or the other into two seperate executables or libraries, then I would believe gdl can call these two executables or use the two libraries instead of itself being linked to both libmfhdf and libnetcdf.

      I will try compiling again after a couple of days.
      regards
      bt

       
    • Joel Gales
      Joel Gales
      2005-09-16

      Oops, I meant:

      setenv EXT_INCLUDES "-I/usr/include"

      Joel

       
    • Marc Schellens
      Marc Schellens
      2005-09-18

      I applied the changes Joel suggested for configure into
      configure.in
      Even though I think that is not a real clean solution,
      but why not offer this option as a last resort.

      Strange that you got the problem with multple defined symbols:
      linking should be done with:
      -z muldefs
      (that is on linux non power-pc)
      allowing multiple defined symbols.

      Don't you see this option during linking?
      marc

       
    • Jim Garlick
      Jim Garlick
      2005-09-19

      Strange - I tried building from CVS this morning and am getting stuck on the netcdf/hdf4 include file problem.

      I tried both --with-netcdf=/usr and setenv EXT_INCLUDES "-I/usr/include" and I can see that -I/usr/include comes before -I/usr/include/hdf on the g++ command line in both cases, but it still appears to pick up the wrong version of netcdf.h.

      I'm not using netcdf so I'm running --with-netcdf=no for now.