Opened 17 years ago

Closed 17 years ago

#11 closed bug (fixed)

Compilation of roms-sed on windows under cygwin using g95

Reported by: skbhate Owned by: skbhate
Priority: normal Milestone: ROMS-SED Compilation & Testing
Keywords: Cc: jcwarner@…, rsignell@…, skbhate@…

Description (last modified by skbhate)

Roms-sed version: Current version available from the trunk.
Environment/OS: CYGWIN
Fortran compiler: g95 http://www.g95.org
Netcdf-lib: Built with g95 compiler under cygwin

Code compiles fine and creates all the required libs for ROMS... but it breaks at the final step while linking all libs and creating executable 'OceanS'...

/usr/bin/cpp -P -traditional -I/usr/local/include -DCYGWIN -DI686 -DG95 -ISWAN -IROMS/Include -IROMS/Adjoint -IROMS/Nonlinear -IROMS/Representer -IROMS/Tangent -IROMS/SeaIce -IROMS/Drivers -IMaster Master/propagator.F > propagator.f90
ROMS/Bin/cpp_clean propagator.f90
g95 -c -O3 -ffast-math propagator.f90
g95 -c -O3 -ffast-math ocean_control.f90
g95 -c -O3 -ffast-math master.f90
g95 -O3 -ffast-math master.o ocean_control.o ocean_coupler.o propagator.o refdif_couple.o libSWAN.a libADM.a libRPM.a libTLM.a libNLM.a libICE.a libUTIL.a libMODS.a /exe: /link
g95: /exe:: No such file or directory
g95: /link: No such file or directory
make: *** [.] Error 1
rm seaice.f90 sv_perturb.f90 mod_kinds.f90

The possible cause of error seems to be in the rule defined for CYGWIN in Master/Module.mk (shown below)

11: #ifeq ($(OS)-$(strip $(FORT)),CYGWIN-df)
12:
13: ifeq ($(OS),CYGWIN)
14: $(BIN): $(libraries) $(local_objs)
15: $(LD) $(FFLAGS) $(local_objs) $(libraries) $(LIBS_WIN32) /exe:$(BIN_WIN32) /link   $(LDFLAGS)
16: else
17: $(BIN): $(libraries) $(local_objs)
18:      $(LD) $(FFLAGS) $(LDFLAGS) $(local_objs) -o $@ $(libraries) $(LIBS)
19: endif

Line 13 (shown above) will always be true for CYGWIN no matter what is the compiler and will look for /exe and /link directories which are (I suppose) only true for compaq visual command-line fortran compiler 'df'. So the recommended fix can be uncomment line 13 and comment line 11 in Master/Module.mk . This will ensure that if statement is true for only 'df' compiler and the else statement would be executed for other compilers like g95 etc.

Compilation was successful after the above recommended changes to the Master/Module.mk.

The issue still remains to be resolved whether the updated rule in Master/Module.mk will work for 'df' compiler or not.

Attachments (1)

Module.mk (548 bytes ) - added by skbhate 17 years ago.
Master/Module.mk. Updated rule.

Download all attachments as: .zip

Change History (7)

by skbhate, 17 years ago

Attachment: Module.mk added

Master/Module.mk. Updated rule.

comment:1 by skbhate, 17 years ago

Status: newassigned

comment:2 by skbhate, 17 years ago

Description: modified (diff)

comment:3 by skbhate, 17 years ago

Priority: criticalnormal

comment:4 by skbhate, 17 years ago

Description: modified (diff)

in reply to:  description comment:5 by Rich Signell, 17 years ago

Cc: jcwarner@… added

Replying to skbhate:

The issue still remains to be resolved whether the updated rule in Master/Module.mk will work for 'df' compiler or not.

It could be that nobody uses 'df' anymore, anyway, rendering this a moot point.

I think the "digital fortran" is a throwback to the original fortran compiler from DEC. The compiler was then taken over by Compaq, and then by Intel, and has been replaced by the Intel compiler. John, is this correct?

comment:6 by jcwarner, 17 years ago

Cc: rsignell@… skbhate@… added
Resolution: fixed
Status: assignedclosed

Appears that user has created a work-around so priority on this issue was reduced. Issue develops because Cygwin environment can support several compilers. Earlier versions only were concerned with ifort and df. The ifort and df compilers required the /link option to send flags to the linker. The new g95 compiler does not appear to require the /link option. So we now need to differentiate different compilers on the cygwin environment. Current fix: 1) In Module.mk, remove the /exe. Not needed. This was an explicit way to specify the name of the executable file. 2) Retain the capability to use /link by adding a flag in the appropriate Compilers file. So CYGWIN-ifort and CYGWIN-df will have LD_WINDOWS := on CYGWIN-g95 will not have that flag. 3) Modify Module.mk as ifdef LD_WINDOWS $(BIN): $(libraries) $(local_objs)

$(LD) $(FFLAGS) $(local_objs) -o $@ $(libraries) $(LIBS_WIN32) $(LDFLAGS)

else $(BIN): $(libraries) $(local_objs)

$(LD) $(FFLAGS) $(LDFLAGS) $(local_objs) -o $@ $(libraries) $(LIBS)

endif

THIS FIX WILL APPEAR IN ROMS v3.0.

Note: See TracTickets for help on using tickets.