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

[netCDF #UAT-411621]: getting undefined reference when compiling netCDF4.2 Fortran

Hi Steve,

Rather than using compiler flags related to underscores, I recommend
following the steps here, which work with many compiler combinations
without messing with underscores in function names:


The instructions above explain when LD_LIBRARY_PATH may be required in
addition to LD_FLAGS and CPPFLAGS settings.  If this doesn't work for
you, we might be able to provide more help if you send the config.log
file generated by the configure script when you start building the
netCDF Fortran API from source.

Also, it would be better to use the most recent netCDF C release, version, with netCDF Fortran 4.2.  It has various bug fixes and
other improvements since netCDF C 4.2 was released, and it's compatible
with netCDF-Fortran version 4.2.


> I have successfully cross-compiled netcdf C 4.2, i.e., build it on a x86_64
> linux box to run on a android ARM.
> Now I'm trying to cross-compile netcdf fortran 4.2.  But I'm getting
> undefined references like the one I show below, when I run "gmake check".
> libtool: link: /home/me/ANDROID19/bin/arm-linux-androideabi-gfortran -l
> ./fortran -I../f90 -g -O2 -o .libs/nf_test test_get.o test_put.o
> nf_error.o     nf_test.o test_read.o test_write.o util.o fortlib.o
> ../fortran/.libs/libnetcdff.so -Wl,-rpath -Wl,/home/me/NETCDF42-ANDROID/lib
> test_get.o: In function `test_nf_get_var1_int1_':
> /home/me/ANDROID-NETCDF-FORTRAN-COMPILE/netcdf-fortran-4.2/nf_test/test_get.F:125:
> undefined reference to `nf_get_var1_int1_'
> and lots more very similar to this.
> Prior to this I compiled the netCDF C code, version 4.2.  Then I point
> CPPFLAGS=-I/path/to/netCDF-C-compile/include and
> LD_LIBRARY_PATH=/path/to/netCDF-C-compile/lib.
> If anybody could point me toward how to fix this or give me some ideas that
> would be great.  If it helps at all, I have attached the config log file.
> TIA,
> SK

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu

Ticket Details
Ticket ID: UAT-411621
Department: Support netCDF
Priority: Normal
Status: Closed

NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.