[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 20050307:no excecutable is created



Sheo Shanker Prasad <address@hidden> writes:

> Dear Ed,
>
> Good news. Every thing was fine with the environmental declaration that you 
> had helped me to set up. Every thing had compiled correctly.
>
> The culprit was my own ignorance about NetCDF. This incidence requires me to 
> again request you to kindly give me just a brief tutorial about the things 
> that I had asked you in e-mail of 4th March that is summarized below (or, 
> please let me me know where to find the answers).
>
> Your help will be greatly appreciated.
>
> Regards.
>
> Sheo
>
> My questions  are:
>
> (1) Why NetCDF library specification done in the following way
>
> -L/home/ssp/netcdf_abs/lib -llibnetcdf.a
>
> fails giving the message: ld: cannot find -llibnetcdf.a
>
> BUT the specification done in the following way 
>
> -L/home/ssp/netcdf_abs/lib -lnetcdf
>
> does the linking correctly?

Because the -l option to the linker adds the "lib" to the front and
".a" to the back. Look in your compiler docs for the -l option and it
is explained.

The second method you have is the correct way to do things.

>
> (2)Which files among the following represent Fortran interface, Fortran90 
> interface, c++ interface and C interface. Alternatively, what do the various 
> interfaces mean and where do they reside.
>
> ncdump, ncgen in /bin,

Ncgen and ncdump are compiled tools that you may use from the command
line. See:

http://my.unidata.ucar.edu/content/software/netcdf/docs/netcdf/ncgen.html#ncgen

and:

http://my.unidata.ucar.edu/content/software/netcdf/docs/netcdf/ncdump.html#ncdump

> following 7 files in  /include:
> ncvalues.h  netcdfcpp.h  netcdf.h  netcdf.hh* netcdf.inc  NETCDF.mod* 
> TYPESIZES.mod

> & libnetcdf.a  libnetcdf_c++.a in /lib

ncvalues.h, netcdfcpp.h, netcdf.hh*, and libnetcdf_c++.a are for the
C++ interface. 

netcdf.h and libnetcdf.a are for the core C interface (used also by
C++, and Fortran interfaces).

netcdf.inc is for Fortran 77 (which links to libnetcdf.a).

NETCDF.mod and TYPESIZES.mod are for the fortran 90 interface.

>
> (1a) Specifically, since enabling CXX creates the libnetcdf_c++.a  in /lib 
> that is not created if CXX=" " is in the environment setting (but CC is), 
> Does it mean that both the Fortran and C language libraries are in  
> libnetcdf.a  residing in /lib.

Yes. In fact, the fortran library is actually a bunch of C
functions. But as a user you don't need to worry about that.

>
> (3) Does it mean that ncdump and ncgen will work for Fortran and C languages 
> OR are they language-independent 

They are language-independent.

NetCDF data files produced in by any programming API are completely
interchangeable. 

In other words, the netCDF binary formats are fixed, and the different
language interfaces are just different ways to read and write the same
format.

This gets a little more complicated with netCDF 3.6.0, which
introduces a new binary format, the 64-bit offset format, which allows
very large data files. However, it is still the case that what the C
interface creates, the Fortran and C++ (and Java for that matter)
interfaces can read. And vise versa. And ncgen and ncdump can work
well with any language interface.

So different people can use different programming languages on
different platforms, and all can work with the same netCDF file.

There are also some additional third party tools to work with netCDF
data files. See:

http://www.unidata.ucar.edu/packages/netcdf/software.html

Unfortunately I'm not familiar with many of these packages, so I can't
recommend anything in particular. If you post to the netCDF mailing
list you can get some opinions.

>
> (2) What is the difference between building NetCDF with CC=/usr/bin/gcc and 
> CC=/usr/bin/cc. In other words, what is the difference between the C-language 
> compilers that I have in my /usr/bin/cc and /usr/bin/gcc.

Well you'll have to ask your sysadmin that question. Sometimes there's
a link to the gcc compiler called cc. Sometimes there is a vendor
compiler installed (i.e. one that cost money) and it will be cc, while
gcc might also be installed.

Sometimes there are multiple vendor compilers installed, and cc points
to the most popular, or the most recently installed. Finally, there
might be different cc executables in different places, and which one
you get depends on your path.

All gnu software responds well to the --version option, so you could
try "cc --version" and see if it's the same as "gcc --version". Vendor
compilers will usually respond to --version with some message telling
you what to try to get more information. 

>
> (4) What is the difference between building NetCDF with CXX=/usr/bin/g++ and 
> CXX=/usr/bin/c++. In other words, what is the difference between the 
> Cplusplus-language compilers that I have in my /usr/bin/g++ and
> /usr/bin/c++.

Same answer as above.

Happy netCDFing!

Ed


-- 
Ed Hartnett  -- address@hidden