[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)
- Subject: [netCDF #WEP-155858]: NetCDF 4.2 Fortran on Ubuntu 12.10 (Intended to be used with ROMS ocean model)
- Date: Tue, 16 Apr 2013 06:32:52 -0600
Hi Alexis,
I'm glad the Fortran build on Ubuntu worked. It's been useful to see the
problems
encountered due to unclear documentation of the process. As a result, I've
added another step in the instructions about avoiding the use of "sudo" before
"sudo make install":
http://www.unidata.ucar.edu/netcdf/docs/netcdf-fortran-install.html
Your persistence in getting the problems solved will make it easier for others
to
build the netCDF Fortran library in the future. And it appears that I don't
have
to complicate the instructions with advice about the -fPIC option, which
apparently wasn't needed after all ...
--Russ
> Finally I succeded. I'm ashamed with you because of using this sudo
> commands. It's just that I saw the sudo commands in the ROMS forum and i
> thought I may need them for the further installation of ROMS
> (http://www.myroms.org/).
>
> But anyway, the good news is that I finally succeeded. And I'm ashamed
> because after you told me to set the LD_LIBRARY_PATH as in your
> instructions I noticed that I failed to read correctly that instruction
> and that I could use the commands without sudo if I start from the clean
> directories from the downloads as you said in your email.
>
> So, I started from clean directories and followed your instruction steps
> without the CFLAGS and FCFLAGS=-fPIC, and it worked without problems!!
> Please forgive me!!
>
> 0) Uninstall everything and extract New folders
>
> 1) For the C installation:
> CPPFLAGS=-I/usr/local/include
> LDFLAGS=-L/usr/local/lib
> ./configure --prefix=/usr/local
> make
> make check
> sudo make install
> (everything went fine)
>
> 2) For the fortran installation:
> export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
> CPPFLAGS=-I/usr/local/include
> LDFLAGS=-L/usr/local/lib
> ./configure --prefix=/usr/local
> make
> make check
> sudo make install
> (everything went fine !!!)
>
> Thanks a lot!
> Alexis.
>
> PD. For your instructions of step 3, I suggest to add a note about
> checking that $PATH contains /usr/local/lib, as I thought that as the
> installation default was at /usr/local, this step was not neccesary. But
> obviously you were talking about the existing PATH and clearly my PATH
> did not contain /usr/local/lib.
>
> On 4/15/2013 11:50 PM, Unidata netCDF Support wrote:
> >> I did my best effort on this, but the installation is not succesful yet.
> >>
> >> I tried the following:
> >>
> >> 0) sudo make uninstall, sudo make clean twice for each C and Fortran
> >> libraries
> > Your C installation looks fine, and you shouldn't need to repeat it.
> >
> >> 1) Set flags, configure, make and install for the C libraries.
> >> Everything seemed to have gone fine. The output of the
> >> configure,make,check and install steps are attached with the "C2" suffix:
> >> CFLAGS=-fPIC
> >> CPPFLAGS=-I/usr/local/include
> >> LDFLAGS=-L/usr/local/lib
> >> sudo ./configure --prefix=/usr/local
> >> sudo make
> >> sudo make check
> >> sudo make install
> >> (log files have the suffix _C6)
> >>
> >> 2) Set flags, configure and make for the Fortran libraries. Now there is
> >> no error with the -fPIC option,
> >> as previously. Now the error is more weird as it is asking for
> >> libnetcdf.so, while it is there!! and I already set
> >> the LDFLAGS to the directory. These are the steps for the fortran:
> >> CFLAGS=-fPIC
> >> FCFLAGS=-fPIC
> >> CC=gcc
> >> FC=gfortran
> >> F77=gfortran
> >> CPPFLAGS=-I/usr/local/include
> >> LDFLAGS=-L/usr/local/lib
> >> sudo ./configure --prefix=/usr/local
> >> sudo make
> >> sudo make check
> >> (The install step was not done as the error appeared in the check)
> >> (log files have the suffix _F6)
> >>
> >> 3) Previously I tried not to run any command with sudo. I did that for
> >> the C and for the Fortran libraries (as suggested by Russ).
> >> No sudo logs have a _F4 prefix (the _C4 files are not included as they
> >> presented no problems)
> >> But then on the make of the Fortran library an error appeared of
> >> permission to access files and libraries (as shown in the log_make_F4).
> >> That is why I tried again with sudo but still not able to succeed.
> > I should have recommended running "sudo make distclean" rather than
> > "sudo make clean", because a file and directory that should have been
> > removed wasn't removed. However, we haven't tested "sudo make
> > distclean" in the case of a failed build so it may not remove
> > everything needed in that case either. At this point, I would
> > recommend just starting over with a new netcdf-fortran build
> > directory, unpacked from the netcdf-fortran-4.2 distribution without
> > using sudo. Then don't use sudo in the Fortran build unless "make
> > check" works, after which you can use "sudo make install".
> >
> > The fact that you are no longer getting "-fPIC" error messages is
> > actually good progress, and I think the final problem is easier to
> > solve. It may just be a matter of following step 3 in the
> > instructions at
> >
> >
> > http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-fortran-install.html
> >
> > by setting the environment variable LD_LIBRARY_PATH=/usr/local/lib
> > before running the netcdf-fortran configure script. However, the
> > value of $LD_LIBRARY_PATH is often not inherited when you use sudo,
> > because of a security issue.
> >
> > Please ket us know if this works, because it will take some time to
> > try to duplicate this problem on our Ubntu virtual machine ...
> >
> > --Russ
> >
> >> I still need your help. Thank you very much for your interest and
> >> support on this issue. I hope yoo to be able to replicate the problem
> >> over there. I hope that you find the same problem. If not, then I will
> >> be lost! Remember, I'm trying to install in Ubuntu 12.10 (Quantal
> >> Quetzal) and in my first emal I indicated the list of dependencies
> >> utilities installed with apt-get up to now.
> >>
> >> Thank you very very VERY much.
> >>
> >> Alexis Espinosa
> >> University of Western Australia
> >>
> >>
> >> On 4/13/2013 1:21 AM, Unidata netCDF Support wrote:
> >>> Alexis,
> >>>
> >>>> Unfortunately, the FCFLAGS="-fPIC" did not modify the error message!
> >>> Hmm, that's unexpected.
> >>>
> >>>> This is what I did:
> >>>>
> >>>> 0) sudo make uninstall for both C and Fortran libraries.
> >>>>
> >>>> 1) Set flags, configure, make and install for the C libraries.
> >>>> Everything seemed to have gone fine. The output of the
> >>>> configure,make,check and install steps are attached with the "C2" suffix:
> >>>> CFLAGS=-fPIC
> >>>> CPPFLAGS=-I/usr/local/include
> >>>> LDFLAGS=-L/usr/local/lib
> >>>> sudo ./configure --prefix=/usr/local
> >>>> sudo make
> >>>> sudo make check
> >>>> sudo make install
> >>>>
> >>>> 2) Set flags, configure and make for the Fortran libraries, but the same
> >>>> error appeared as you can see from the log_make and log_check files for
> >>>> the fortran attempt:
> >>>> CFLAGS=-fPIC
> >>>> FCFLAGS=-fPIC
> >>>> CC=gcc
> >>>> FC=gfortran
> >>>> F77=gfortran
> >>>> CPPFLAGS=-I/usr/local/include
> >>>> LDFLAGS=-L/usr/local/lib
> >>>> sudo ./configure --prefix=/usr/local
> >>>> sudo make
> >>>> sudo make check
> >>>> (The install step was not done as the error appeared first)
> >>> I have two suggestions. First, don't run "./configure", "make all",
> >>> or "make check" using sudo, because on some systems that prevents
> >>> inheritance of environment variable settings, as a security
> >>> precaution. The only command you need to run with "sudo" is "make
> >>> install" (or possibly "make clean" if you've previously run as root).
> >>>
> >>> Second, make sure you run "make clean" before running "./configure",
> >>> to ensure the new FLAGS settings get applied to all the compile steps.
> >>> I noticed in the log_make_FORTRAN2 file you attached, some of the
> >>> objects were not recompiled, for example:
> >>>
> >>> Making all in f90
> >>> make[2]: Entering directory
> >>> `/home/espinosa/ROMS/NetCDF/netcdf-fortran-4.2/f90'
> >>> make all-am
> >>> make[3]: Entering directory
> >>> `/home/espinosa/ROMS/NetCDF/netcdf-fortran-4.2/f90'
> >>> make[3]: Nothing to be done for `all-am'.
> >>> make[3]: Leaving directory
> >>> `/home/espinosa/ROMS/NetCDF/netcdf-fortran-4.2/f90'
> >>>
> >>> When the files in that directory get recompiled, you should expect to
> >>> see:
> >>>
> >>> /bin/sh ../libtool --tag=FC --mode=compile gfortran -fPIC -c -o
> >>> netcdf4.lo netcdf4.f90
> >>> libtool: compile: gfortran -fPIC -c netcdf4.f90 -fPIC -o
> >>> .libs/netcdf4.o
> >>>
> >>> with "-fPIC" used. That is the specific object that the error message
> >>> is about in
> >>>
> >>> /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
> >>>
> >>> so it's important that it gets recompiled with -fPIC.
> >>>
> >>>> The log_make_FORTRAN2 shows that the -fPIC option is being used for a
> >>>> lot of intermediate compiling steps, but that is still not enought for
> >>>> solving the problem.
> >>>>
> >>>> Any suggestions?
> >>> If the suggestions above don't work, I don't know why it's failing. Next
> >>> week a
> >>> staff member who has been at the EGU meeting in Vienna will return, and
> >>> he might
> >>> be able to duplicate and debug the problem on an Ubuntu virtual machine
> >>> to which
> >>> he has access ...
> >>>
> >>> --Russ
> >>>
> >>>> Thank you very much for your help and interest,
> >>>> Alexis Espinosa
> >>>>
> >>>> On 4/12/2013 1:02 AM, Unidata netCDF Support wrote:
> >>>>> 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
> >>>>>
> >>>>>
> >>>> --
> >>>> 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
> >>>
> >>>
> >>
> >> --
> >> 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
> >
> >
>
>
> --
> 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