problem building netcdf-90 interface with ifort under cygwin

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
skbhate

problem building netcdf-90 interface with ifort under cygwin

#1 Unread post by skbhate »

I am trying to build the netcdf-90 interface with ifort under cygwin, but cannot pass the /configure stage. It's unable to do a test compile of .f90 files..

May be I am not sure of the right flags to use with ifort. Has anyone got any success building netcdf-90 interface using ifort on cygwin ?

Here is what I am doing..

$ CC=gcc FC=ifort F90=ifort CPPFLAGS="-DNDEBUG -DpgiFortran" FFLAGS="-g -O2 -mp" ./configure --prefix=/usr/local/netcdf/ifort

The configure output shown below:

configure: netCDF 3.6.2
checking build system type... i686-pc-cygwin
checking host system type... i686-pc-cygwin
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
configure: checking user options
checking whether CXX is set to ''... no
checking whether FC is set to ''... no
checking whether F90 is set to ''... no
checking whether documentation is to be installed... no
checking whether Fortran compiler(s) should be tested during configure... yes
checking whether configure should try to set compiler flags... yes
checking whether FFIO will be used... no
checking whether to skip C++, F77, or F90 APIs if compiler is broken... yes
checking whether only the C library is desired... no
checking whether examples should be built... yes
checking whether F77 API is desired... yes
checking whether F90 API is desired... yes
checking whether fortran type sizes should be checked... yes
checking whether C API is desired... yes
checking where to get netCDF C-only library for separate fortran libraries...
checking whether CXX API is desired... yes
checking whether v2 netCDF API should be built... yes
checking whether the ncgen/ncdump should be built... yes
checking whether large file (> 2GB) tests should be run... no
checking whether extreme numbers should be used in tests... yes
checking where to put large temp files if large file tests are run... .
checking whether a win32 DLL is desired... no
checking whether separate fortran libs are desired... no
configure: finding C compiler
checking for C compiler default output file name... a.exe
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... .exe
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking whether gcc and cc understand -c and -o together... yes
checking for an ANSI C-conforming const... yes
configure: finding Fortran compiler (will not be used if Fortran API is not desired)
checking whether we are using the GNU Fortran compiler... no
checking whether ifort accepts -g... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether ifort 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


-skb

robertson
Site Admin
Posts: 219
Joined: Wed Feb 26, 2003 3:12 pm
Location: IMCS, Rutgers University

#2 Unread post by robertson »

Hi,

The issue with the configure script seems to be that ifort for windows likes to build object files with the .obj extension instead of the usual .o so the tests in the configure script can't find the resulting compiled files. My first idea was to change the OBJEXT variable to 'obj' but that caused a host of other problems with gcc.

I haven't had time to test it fully but my idea is to tell the configure script not to build the fortran interface by passing it --disable-f77 so the configure script will complete. Then re-enable building and testing of the f77 and f90 interfaces by editing the Makefile in the source root by changing:

Code: Select all

# If the user wants the F77 API this will cause it to be built and
# tested.
#F77_DIR = fortran
#F77_TEST = nf_test

# Does the user want C++ API?
CXX_DIR = cxx

# Does the user want F90 API?
#F90_DIR = f90
to

Code: Select all

# If the user wants the F77 API this will cause it to be built and
# tested.
F77_DIR = fortran
F77_TEST = nf_test

# Does the user want C++ API?
CXX_DIR = cxx

# Does the user want F90 API?
F90_DIR = f90

Then in the f90 and fortran folders modify the Makefiles adding a rule override similar to the one in the ROMS CYGWIN-ifort.mk file:

Code: Select all

#
# For a Windows compiler, override the compilation rule
#

%.o: %.f90
	cd $(SCRATCH_DIR); $(FC) -c $(FFLAGS) $(notdir $<) /object:$(notdir $@)
Since the Makefile you're editing is already in the build directory you shouldn't need 'cd $(SCRATCH_DIR);'. I believe some other changes need to be made to link the c API and fortran API into a single library but I'm not sure what those changes are yet. Perhaps others on this forum have advise or a better idea how make this all work.

an explanation of 'notdir', '$<' and '$@' can be found here.

Dave

nganju
Posts: 82
Joined: Mon Aug 16, 2004 8:47 pm
Location: U.S. Geological Survey, Woods Hole
Contact:

#3 Unread post by nganju »

Did this work in the end? I am trying to install ROMS 3.0 and netcdf 3.6.2 on my cygwin machine/ifort and having the same problem.

weihuali
Posts: 1
Joined: Sun Jan 06, 2008 4:54 pm
Location: State key lab. of estarine and coastal Res.

Re: problem building netcdf-90 interface with ifort under cygwin

#4 Unread post by weihuali »

I have got this error yestoday. To my problem, the reason is that I have not install the G95 correctly(Should installed in the root directory while not the user's home directory). I installed the G95 in the directory of "home\MyUserName", then I got the error in compiling the netcdf. So, maybe you should carefully do a check of the G95's installation work.

Post Reply