Re: compile errors

From: Rick Grubin (grubin AT XXXXXX)
Date: Tue Apr 13 2004 - 11:30:29 MDT

  • Next message: Ronald Gilliland: "Install glitch on Mac OS X"

    Hello,

    It seems a few folks are running in to similar problems; hopefully I can
    cover them sufficiently here to save others some grief.

    > I try to compile the ncarg with HDF using the gcc/g77 compiler.
    > (RH9 on a Dell inspiron 5150 notebook)

    Red Hat Linux v9 is a supported platform, so that's good. It does matter
    what version of the GNU development tools (gcc, g77, etc.) you're using.
    You can check by running:

    % gcc -v

    or

    % g77 -v

    The results from each should match; the GNU compilers are both built from
    the same code base. As an example:

    % gcc -v
    Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
    Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
    --infodir=/usr/share/info --enable-shared --enable-threads=posix
    --disable-checking --with-system-zlib --enable-__cxa_atexit
    --host=i386-redhat-linux
    Thread model: posix
    gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

    > In my config/LINUX file I have the options -lg2c and -lm
    > and I encounter a lot of "undefined reference to main"
    > errors (ex on fontc and graphc files). After reading a few
    > suggestions in the list I decide to comment out the above
    > two options.

    Indeed, the file $NCARG/config/LINUX file does include the line

    #define CtoFLibraries -lg2c -lm

    This gets propagated to Makefiles in all subdirectories. This system-wide
    definition/propagation was necessary at one point in the past, for the GNU
    development tools of version 2.9x vintage, to build the NCARG source code.
    In particular, the "-lg2c" verbiage was necessary for the subdirectories
    where both C and Fortran object files were linked together.

    The newer GNU development tools, those found with Red Hat Linux v9, do not
    need the link with the library libg2c.a when compiling Fortran-only source
    code (as is the case in the source directories noted below). The
    linker/loader will locate the proper object code to build an executable.

    The interim solution (until the code base here is updated) is to edit the
    Makefiles in these directories:

        $NCARG/common/src/fontcap
        $NCARG/common/src/graphcap
        $NCARG/ncarg2d/src/bin/pre2ncgm
        $NCARG/ncarg2d/src/db/pwritxnt

    Change the line:

    CTOFLIBS = -lg2c -lm

    to

    CTOFLIBS =

    and run 'make' again, in those directories.

    Regarding the HDF software:
    > Errors reduces to a few (it cant find the hdf.h and says no such file) .

    It's important to note that NCARG expects to find the HDF include files
    in a directory path like: .../include/hdf as noted in the INSTALL file
    for NCARG. If this isn't the case, you'll see errors like "can't find
    file hdf.h"

    If installing HDF v4.2r0, you can configure such as:

        % ./configure --prefix=/local --includedir=/local/include/hdf

    In this example, I've installed the HDFv4 software relative to /local,
    and the header files in particular in /local/include/hdf I have also
    specified /local/include as a place to look for locally installed
    header files when running the Configure program for NCARG. Then, when
    NCARG source code files specify something like

    #include <hdf/hdf.h>

    those files will be found, because NCARG was configured to look in the
    directory /local/include/hdf and /local/include/hdf/hdf.h exists,
    per my installation of the HDFv4 software.

    > A single error for gcc on ictrans (undefinedreference to "s_copy', to
    > "sqrt", to "cos", to "sin" !) !

    Did you modify the Makefile for ictrans?
      </path/to/ncarg/ncarview/src/lib/libictrans/Makefile>

    The proper library ("-lm" or /usr/lib/libm.a) is present in the correct
    spot in the Makefile, if you configured correctly. The "-lm" in this case
    is from

    #define CtoFLibraries -lg2c -lm

    in the $NCARG/config/LINUX file.

    -Rick.

    --
    Rick Grubin                     Visualization + Enabling Technologies
    Scientific Computing Division   National Center for Atmospheric Research   
    grubin AT unknown                 303.497.1832
    

    _______________________________________________ ncarg-talk mailing list ncarg-talk AT unknown http://mailman.ucar.edu/mailman/listinfo/ncarg-talk



    This archive was generated by hypermail 2b29 : Thu Apr 22 2004 - 07:41:11 MDT