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

[netCDF #WEP-155858]: NetCDF 4.2 Fortran on Ubuntu 12.10 (Intended to be used with ROMS ocean model)



Hi Alexis,

> I'm trying to install netcdf-4.2 (fortran version) in my Ubuntu 12.10
> (Quantal) system. I have tried some suggestions available on the ROMS
> forum but those explanations were for Ubuntu 12.04 and for cygwin and a
> subtle difference may be creating the problem I'm finding: I can't pass
> the check correctly.
> 
> So, I went directly to your page and found the "Building the netCDF-4.2
> and later Fortran libraries" explanation and followed it carefully, but
> it is still not working.
> 
> 0. The first thing I found is that you suggest to install first the C
> library in shared mode. So I "make uninstall" the failed fortran and C
> succesful installations (which were first tried to be installed in
> --disable-shared mode)
> 
> 1. Then I installed the C version again like this:
> sudo ./configure --prefix=/usr/local --enable-netcdf-4 --enable-dap
> (I kept the ROMS' forum suggestions except the --disable-shared option)
> sudo make
> sudo make check
> sudo make install
> (everything went fine. I'm attaching you the output of the
> sudo make check > log_check_C 2>&1
> command)
> 
> 2. Then I tried the installation of the Fortran library
> CC=gcc
> FC=gfortran
> CPPFLAGS=-I/usr/local/include
> LDFLAGS=-L/usr/local/include/lib
> sudo ./configure --prefix=/usr/local
> sudo make
> sudo make check
> (But the make and make check failed. I'm attaching you the output of:
> sudo make > log_make_FORTRAN 2>&1
> and
> sudo make check > log_check_FORTRAN 2>&1
> commands)
> 
> QUESTION: What should I do in order to install the fortran library
> correctly?

The error message you are getting

  /usr/bin/ld: ../f90/.libs/libnetcdff90.a(netcdf.o): relocation R_X86_64_32 
against `.rodata.str1.8' can not be used when making a shared object; recompile 
with -fPIC

indicates that you need to add "-fPIC" the the compiler options for gfortran 
when configuring
the netCDF Fortran library.  It may also be necessary to add -fPIC to the gcc 
options when 
configuring the netCDF C library.

Sometimes -fPIC is needed for 64-bit shared libraries but not for 32-bit shared 
libraries.  I
thought libtool was supposed to figure this out and provide the Position 
Independent Code
option automatically when needed, but it doesn't seem always do that when 
needed.

Please try configuring and building the netCDF C library with CFLAGS="-fPIC" 
and then 
installing it again.  Then try configuring and building the netCDF Fortran 
library
with FCFLAGS="-fPIC".  If "make check" doesn't work after that, please let us 
know.
We don't have an Ubuntu platform configured on which to test the netCDF Fortran 
build,
so we'd also like to know if this succeeds, in which case we'll add to the 
instructions.

Thanks for reporting the problem!

--Russ 

> Thanks a lot,
> Alexis Espinosa
> PD I previously installed a lot of supposed dependencies:
> sudo apt-get install -y cdbs debhelper gcc gfortran libcunit1-dev
> libcurl4-gnutls-dev libdap-dev libhdf5-dev texinfo texlive-base
> texlive-latex-base zlib1g-dev make build-essential bison doxygen curl
> g++ libmpich2-dev subversion
> 
> 
> 
> 
> --
> Alexis Espinosa Gayosso
> PhD Candidate
> School of Environmental Systems Engineering and The UWA Oceans Institute
> The University of Western Australia
> MO15, 35 Stirling Highway
> Crawley, WA 6009
> Australia
> 
> Tel: (+618) 6488-7359
> Fax: (+618) 6488-1015
> Email: address@hidden
> Web: www2.sese.uwa.edu.au/~espinosa/
> 
> 
> 
Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: WEP-155858
Department: Support netCDF
Priority: Normal
Status: Closed