LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   No such file or directory (https://www.linuxquestions.org/questions/linux-desktop-74/no-such-file-or-directory-679307/)

malibec2005 10-27-2008 07:03 AM

No such file or directory
 
I am quite a beginner and so my query may sound quite trivial to u guys but plz help me out with this

when i tried to have a netcad output i changed the make file as follow:
FLAG_6 = -DNETCDF_IO
IOLIBS = -L/usr/local/lib -lnetcdf
IOINCS = -I/usr/local/include


then i had the following results:

/usr/bin/cpp -P -C -traditional -DGFORTRAN -P -C -traditional -DNETCDF_IO -DGCN -DDYE_RELEASE mod_ncdio.F > mod_ncdio.f90
gfortran -O3 -c -I/usr/local/include mod_ncdio.f90
In file mod_ncdio.f90:49

USE netcdf
1
Fatal Error: Can't open module file 'netcdf.mod' for reading at (1): No such file or directory
make: *** [mod_ncdio.o] Error 1


any help

colucix 10-27-2008 07:53 AM

Well.. is there a netcdf.mod file in /usr/include? Which linux distribution are you running on and how did you install netcdf libraries?

malibec2005 10-28-2008 03:41 AM

Quote:

Originally Posted by colucix (Post 3323022)
Well.. is there a netcdf.mod file in /usr/include? Which linux distribution are you running on and how did you install netcdf libraries?

for the first part. Yes the netcdf,mod file in the /usr/include.
i did not install the netcdf libraries myself but the IT team did it for me. the Linux server is called caunton

colucix 10-28-2008 03:59 AM

Hmmm, is it in /usr/local/include (see the gfortran statement in your firts post) or in /usr/include?

Another story: there is a chance that a netcdf.mod file has been compiled using a fortran compiler different from that you are used to (gfortran). A compatibility issue may arise. In this case, take in mind that you can install netcdf libraries locally, under your home directory. You must not have root privileges to do that, since only your own files and directories are affected. If you need some help to do this (if it happens you need it), feel free to ask.

malibec2005 10-28-2008 04:56 AM

Quote:

Originally Posted by colucix (Post 3323816)
Hmmm, is it in /usr/local/include (see the gfortran statement in your firts post) or in /usr/include?

Another story: there is a chance that a netcdf.mod file has been compiled using a fortran compiler different from that you are used to (gfortran). A compatibility issue may arise. In this case, take in mind that you can install netcdf libraries locally, under your home directory. You must not have root privileges to do that, since only your own files and directories are affected. If you need some help to do this (if it happens you need it), feel free to ask.



the following are my recent make file.

FLAG_6 = -DNETCDF_IO
IOLIBS = -L/usr/lib64 -lnetcdf
IOINCS = -I/usr/include/


the required libraries are located in the above locations lib64 and include.

Then the following are the massage that i received after i compiled

mod_lag.f90:(.text+0x8c57): undefined reference to `__netcdf__nf90_put_var_1d_fourbytereal'
mod_lag.f90:(.text+0x8ccb): undefined reference to `__netcdf__nf90_put_var_1d_fourbytereal'
mod_lag.o:mod_lag.f90:(.text+0x8d3f): more undefined references to `__netcdf__nf90_put_var_1d_fourbytereal' follow
mod_lag.o: In function `__mod_lag__dump_lag_restart':
mod_lag.f90:(.text+0x8dae): undefined reference to `__netcdf__nf90_put_var_1d_fourbyteint'
mod_lag.f90:(.text+0x8e25): undefined reference to `__netcdf__nf90_put_var_1d_fourbyteint'
mod_lag.f90:(.text+0x8e34): undefined reference to `__netcdf__nf90_close'
mod_lag.f90:(.text+0x90f5): undefined reference to `__netcdf__nf90_strerror'
collect2: ld returned 1 exit status
make: *** [fvcom] Error 1


i appreciate if you can guide me to start again and install Netcadf Correctly.
as i mention before i am quite new in the field. so please keep in mind

colucix 10-28-2008 08:51 AM

Ok. It looks like the NetCDF installed on the system have been compiled without the -fno-second-underscore option. So, if you want to install your own NetCDF for usage with gfortran, here are detailed instructions. The following commands will install NetCDF 3.6.3 under your HOME directory. I choosed version 3.6.3 instead of the more recent NetCDF 4 to avoid further complications. Unless you need the advanced functionalities of NetCDF 4, you can safely follow my choice.

1) First download the NetCDF source code (using wget from command line, or any ftp client with anonymous login)
Code:

wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-3.6.3.tar.gz
2) Unpack the archive in your HOME directory and go the the directory containing the sources
Code:

tar zxvf netcdf-3.6.3.tar.gz -C $HOME
cd $HOME/netcdf-3.6.3

3) Set the build environment
Code:

export F77=gfortran
export FC=gfortran
export FFLAGS='-fno-second-underscore  -g -O2'
export FCFLAGS='-fno-second-underscore -g -O2'
export CC=gcc
export CXX=g++
export CPP='gcc -E'
export CXXCPP='g++ -E'

4) Configure step. I suggest to install your own version of NetCDF under the same directory used for building. The installation step will create the proper bin/ lib/ and include/ subdirectories. Moreover you can enable the build of shared object
Code:

./configure --prefix=$HOME/netcdf-3.6.3 --enable-shared
5) If the step above is successful (you can check full output in config.log) do
Code:

make
6) Test the libraries before installation. Since the output of this step is very long and scrolls fast through the terminal, I suggest to save it in a file for further checking. For example, you can use tee to see the output on the terminal and save it in a file simultaneously. Then you can grep the file for words like "error", "fail", "warning", "pass".
Code:

make check 2>&1 | tee check.log
grep -i error check.log
grep -i fail check.log
grep -i warning check.log
grep -i passed check-log

7) If everything looks right you can perform the last step
Code:

make install
Now you will have your include files in $HOME/netcdf-3.6.3/include and the libraries in $HOME/netcdf-3.6.3/lib. Set the proper location in your Makefile and the trick is done (hopefully)! ;)

malibec2005 10-29-2008 05:02 AM

Thanks

i started to follow your procedure. however after the fourth step i received the following:

checking whether we are using the GNU Fortran compiler... no
checking whether gofortran accepts -g... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether gofortran accepts -g... no
configure: setting up Fortran 90
checking for Fortran flag to compile .f90 files... unknown
configure: error: Fortran could not compile .f90 files
[enxmabm@caunton netcdf-3.6.3]$

colucix 10-29-2008 05:49 AM

Quote:

Originally Posted by malibec2005 (Post 3324838)
checking whether we are using the GNU Fortran compiler... no
checking whether gofortran accepts -g... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether gofortran accepts -g... no
configure: setting up Fortran 90
checking for Fortran flag to compile .f90 files... unknown
configure: error: Fortran could not compile .f90 files
[enxmabm@caunton netcdf-3.6.3]$

Hmmm... you sure you correctly typed the name of the fortran compiler when you set the build environment? Please, check it and try again.

malibec2005 12-02-2008 10:50 AM

Thank you all it works now.

colucix 12-02-2008 11:02 AM

I'm glad to hear good news! :)

geo_man 10-23-2014 01:34 AM

Quote:

Originally Posted by colucix (Post 3323997)
Ok. It looks like the NetCDF installed on the system have been compiled without the -fno-second-underscore option. So, if you want to install your own NetCDF for usage with gfortran, here are detailed instructions. The following commands will install NetCDF 3.6.3 under your HOME directory. I choosed version 3.6.3 instead of the more recent NetCDF 4 to avoid further complications. Unless you need the advanced functionalities of NetCDF 4, you can safely follow my choice.

1) First download the NetCDF source code (using wget from command line, or any ftp client with anonymous login)
Code:

wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-3.6.3.tar.gz
2) Unpack the archive in your HOME directory and go the the directory containing the sources
Code:

tar zxvf netcdf-3.6.3.tar.gz -C $HOME
cd $HOME/netcdf-3.6.3

3) Set the build environment
Code:

export F77=gfortran
export FC=gfortran
export FFLAGS='-fno-second-underscore  -g -O2'
export FCFLAGS='-fno-second-underscore -g -O2'
export CC=gcc
export CXX=g++
export CPP='gcc -E'
export CXXCPP='g++ -E'

4) Configure step. I suggest to install your own version of NetCDF under the same directory used for building. The installation step will create the proper bin/ lib/ and include/ subdirectories. Moreover you can enable the build of shared object
Code:

./configure --prefix=$HOME/netcdf-3.6.3 --enable-shared
5) If the step above is successful (you can check full output in config.log) do
Code:

make
6) Test the libraries before installation. Since the output of this step is very long and scrolls fast through the terminal, I suggest to save it in a file for further checking. For example, you can use tee to see the output on the terminal and save it in a file simultaneously. Then you can grep the file for words like "error", "fail", "warning", "pass".
Code:

make check 2>&1 | tee check.log
grep -i error check.log
grep -i fail check.log
grep -i warning check.log
grep -i passed check-log

7) If everything looks right you can perform the last step
Code:

make install
Now you will have your include files in $HOME/netcdf-3.6.3/include and the libraries in $HOME/netcdf-3.6.3/lib. Set the proper location in your Makefile and the trick is done (hopefully)! ;)

Thanks, this works for gfortran compiler beautifully. Please help me building the enviroment for intel compiler.

geo_man 11-05-2014 12:14 AM

For intel compilers
 
Set the build environment for intel compilers, the following way:

export CC=icc

export CXX=icpc

export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'

export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'

export F77=ifort

export FC=ifort

export F90=ifort

export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'

export CPP='icc -E'

export CXXCPP='icpc -E'


Rest of the steps remain the same as given by colucix


All times are GMT -5. The time now is 03:03 AM.