Fwd: [ncl-install] Multiple definitions,
undefined references while linking ncl
Rick Grubin
grubin at ucar.edu
Tue Jan 8 11:05:25 MST 2008
All, I neglected to send this message to the ncl-install list, as it
may be of some help to others. My apologies.
Begin forwarded message:
Hi Jan
>>> 2) I had to replace yy_current_buffer with
>>> YY_CURRENT_BUFFER_LVALUE in ni/src/ncl/Symbol.h to work around an
>>> undefined reference (related to my flex version again, I guess)
>>>
>> This is interesting; I've never seen this problem and can't find
>> any reference to something similar in our help archives. Would you
>> please send me a copy of your 'ncl.' file?
>>
>
> I suppose you mean ncl.l. However, the problem is in Symbol.h. I
> attached both files, with Symbol.h patched as necessary to compile
> without problems using flex-2.5.33.
I could duplicate your problem with a newer version of flex.
Attached are files 'ncl.l' and 'Symbol.h' which I believe fix your
problem. Some recent fixes for other issues required small changes
in these two files. Please substitute them for what you currently have.
>>> 3) I had to make a symlink hdf -> . in HDF's include directory.
>>> Some source files wanted to include <hdf/hdf.h>.
>>>
>>
>>
> Ok. Overwriting NetCDF include files was not an issue for me
> because I installed HDF-4 with a different --prefix. So I didn't
> realize I still needed the --includedir option.
It may not seem like an issue; however HDF includes its own built-in
netCDF files/implementation and, unfortunately, it does matter.
The future may bring these problems to an end, as HDF and netCDF are
being combined.
> I reinstalled HDF-4 according to instructions. I did it with --
> disable-netcdf (this option was missing in INSTALL.html provided in
> the downloaded archive, but it is mentioned on the web page).
./configure --help will also tell you about the option.
> The effect is that the compilation now fails with
>
> gcc -c -DLINUX -ansi -fPIC -D_FILE_OFFSET_BITS=64 -
> D_LARGEFILE_SOURCE -O -I../../.././include -I/usr/X11R6/include -I/
> home/VO_SW_DIR/wisent/flex-2.5.34/include -I/home/VO_SW_DIR/wisent/
> jpeg-6b/include -I/home/VO_SW_DIR/wisent/netcdf-3.6.2/include -I/
> home/VO_SW_DIR/wisent/HDF4.2r2/include -I/home/VO_SW_DIR/wisent/
> udunits-1.12.4/include -DLinux -DMAJOR=2 -DSYSV -D_POSIX_SOURCE -
> D_XOPEN_SOURCE -DByteSwapped -DNeedFuncProto NclHDF.c
> NclHDF.c:27:24: hdf/netcdf.h: No such file or directory
HDF, as noted, includes its own version of netCDF routines. It has
its own header file called 'netcdf.h' and NCL expects to find it
in a directory specified with the '--includedir' option to HDF's
configuration process.
Make sure your HDF installation did create a directory structure that
has a directory named 'hdf' where HDF's header files are
stored. In your above command line, is it in: home/VO_SW_DIR/wisent/
HDF4.2r2/include ?
If so, it would mean that the file cannot be found because you
specified a different location when you configured HDF:
>>> At present, this is what I use for configuring HDF
>>>
>
> export CC=gcc
> export CFLAGS="-DHAVE_NETCDF"
> export F77=pgf77
> export PATH=$DGRID_VO_DIRECTORY/ws/flex-2.5.34/bin:
> $DGRID_VO_DIRECTORY/ws/bison-2.3/bin:$PATH
>
> ./configure \
> --prefix=$DGRID_VO_DIRECTORY/ws/HDF4.2r2 \
> --with-zlib=$DGRID_VO_DIRECTORY/ws/zlib-1.2.3 \
> --with-jpeg=$DGRID_VO_DIRECTORY/ws/jpeg-6b \
> --includedir=$DGRID_VO_DIRECTORY/ws/HDF4.2r2/include/hdf
> # --disable-netcdf
Note that you've specified "--includedir=$DGRID_VO_DIRECTORY/ws/
HDF4.2r2/include/hdf"
and that's not where NCL is expecting to find it.
You can fix this by reconfiguring and rebuilding again; that would be
tedious. You can also fix it by editing the Makefile
in /path/to/NCL source/ni/src/ncl and changing the appropriate
macros (INCSEARCH and INC_SEARCH) to reflect the
extra 'hdf' in the path.
>>> Do I have to point the HDF build process to my NetCDF
>>> installation somehow?
No.
>>> Ok, so I guess I need to somehow build HDF with my version of
>>> NetCDF (3.6.2) rather than its own?
No; build HDF as you did above, but use '--disable-netcdf' again.
Then, make sure your Makefile (as noted above) has the correct path
for HDF's include files. Then do the following, in
that directory:
make clean
followed by
make depend includes all install
Lastly, in looking over your LINUX configuration file, I would
suggest the following change:
#define CtoFLibraries -pgf90libs
Newer PGI compilers will expand the above to the proper library
references, in the proper order. This will eliminate the
very long list of PGI libraries (that must be in the right order!),
and allow you to remove the reference to their location in
the "ArchRecLibSearch" definition.
>> Mary mentioned that you are going to switch over to autoconf/
>> automake, which is a very good idea. Hopefully, the lengthy
>> instructions can be replaced by a short ./configure --help after
>> that.
That is indeed the goal.
> You might also consider redistributing the required third-party
> software and using these redistributed versions during the build
> process by default.
Many of these software packages have their own licensing
requirements; they require that you accept their terms prior to
downloading,
building and using them. We cannot be responsible for making those
decisions for an end user, hence the end user must make those
decisions on their own.
----
Rick Grubin NCAR/TDD/CISL/VETS
Visualization + Enabling Technologies
grubin at ucar.edu 303.497.1832
More information about the ncl-install
mailing list