delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/05/21/11:21:55

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: Yes, hits=5.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,FREEMAIL_REPLY,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <SNT129-W506D793A069A9C8255888187E40@phx.gbl>
From: bo yu <enviyub2 AT hotmail DOT com>
To: <tprince AT computer DOT org>, <cygwin AT cygwin DOT com>
Subject: RE: How to compile Fortran 90 subroutine under CYGWIN
Date: Fri, 21 May 2010 15:21:40 +0000
In-Reply-To: <4BF6803B.2060103@aol.com>
References: <SNT129-W2E72156B2337B784EB72687E40 AT phx DOT gbl>,<4BF6803B DOT 2060103 AT aol DOT com>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Tim,
=20
Thanks for your reply.
=20
I have the new version of cygwin installed in my computer, in which the g77=
, g++, gcc, gfortran, C++ compiler are in C:\cygwin\bin.

Firstly, I use cygwin build C programs and For77 programs. It works very we=
ll. Now, I add two For90 programs and want to build following program toget=
her in cygwin:
=20
Fortran 77 program:   runslhg.f , intrface.f=20
Fortran 90 program:   swan_init.f90 ,  swan_loopstep.f90
C Program:            slosh2.c ,  cstart.c etc.
=20
Step 1: I replace g77 with gfortran in 'makefile',=20
=20
#!/bin/make
SHELL =3D /bin/sh
CC =3D gcc
F77 =3D gfortran
STRIP =3D strip
STD_FLAGS =3D -O3 -Wall -pedantic -ansi
FFLAGS =3D
LD_FLAGS =3D -Wl,--stack,8000000
STD_DEF =3D -D_WINDOWS_ -D_GCC_
STD_INC =3D -I.
STD_LIB =3D -lg2c -L/usr/lib -lm
PRJ_NAME =3D sloshDos
TARGETS =3D $(PRJ_NAME)
CFLAGS =3D $(STD_FLAGS) $(STD_DEF) $(STD_INC)
############################
# FILES
############################
H_SOURCES =3D slosh2.h \
            pack.h \
            myassert.h \
            myutil.h \
            savellx.h \
            complex.h \
            clock.h \
            tendian.h \
            tio3.h
C_OBJECTS =3D slosh2.o \
            pack.o \
            myassert.o \
            myutil.o \
            savellx.o \
            complex.o \
            clock.o \
            tendian.o \
            tio3.o
F_OBJECTS =3D runslhg.o \
            intrface.o \
            swan_init.o \
            swan_loopstep.o
=20=20=20=20=20=20=20=20=20=20=20=20
C_MAIN =3D cstart.c
############################
# TARGETS
############################
all: $(TARGETS)
 @echo ""
$(PRJ_NAME): $(C_OBJECTS) $(F_OBJECTS) $(C_MAIN) $(LIB_DEPENDS) $(H_SOURCES)
 $(CC) $(C_MAIN) $(CFLAGS) $(LD_FLAGS) $(C_OBJECTS) $(F_OBJECTS) $(STD_LIB)=
 -o $(PRJ_NAME)
 $(STRIP) -s $(PRJ_NAME).exe
install:
 cp *.exe ../../bin
clean:
 rm -f *.o *.bak *.BAK
############################
# SUFFIXES
############################
.c.o : $(H_SOURCES)
 $(CC) -c $(CFLAGS) $<
.f.o:
 ${F77} -c ${FFLAGS} $<
=20

Step 2: in cygwin, I ran makefile, The error message is
=20
gcc =96c runslhg.f
gcc =96c intrface.f
make: *** No rule to make target =91swan_init.o=92, needed by =91sloshDos=
=92. Stop
=20
Step 3: To test if gfortran compiler wotk for For77 program, I try to build=
 C program and For70 programs only using gfortran, I ran makefile, The erro=
r message is
=20
runslhg.o:runslhg.f:,.text+0x4f>: undefined reference to '__gfortran_st_rea=
d'
runslhg.o:runslhg.f:,.text+0x6d>: undefined reference to '__gfortran_transf=
er_character'
runslhg.o:runslhg.f:,.text+0x7b>: undefined reference to '__gfortran_st_rea=
d_done'
=20
=20
My Questions are
(1) Does gfortran work for fortran 90 program only?=20
(2) g77 compiler works for fortran 77 programs. Does g77 work for fortran 9=
0 programs?
(3) How to build C, FOR77 and For 90 programs together in cygwin? How to se=
t the makefile, use seperate command for for77 and for 99?
=20
=20
I would appreciate any suggestion what should I look at.
=20
Thanks again,
Bo
enviyub2 AT hotmail DOT com

=20
=20
=20


----------------------------------------
> Date: Fri, 21 May 2010 05:44:43 -0700
> From: n8tm AT aol DOT com
> To: cygwin AT cygwin DOT com
> Subject: Re: How to compile Fortran 90 subroutine under CYGWIN
>
> On 5/21/2010 5:37 AM, bo yu wrote:
>> .c.o : $(H_SOURCES)
>> $(CC) -c $(CFLAGS) $<
>> .f.o:
>> ${F77} -c ${FFLAGS} $<
>>
>> ------------------------------------------------------------------------=
--------------------
>> Here is the code of =91Testfor90.f90=92
>> --------------------------------------------------
>>
> make noticed that you didn't supply a rule for .f90.o
>
> Why wouldn't you use gfortran? If you are trying to use a cygwin
> installation from several years ago, it's time to update.
>
> --
> Tim Prince
>
>
> --
> Problem reports: http://cygwin.com/problems.html
> FAQ: http://cygwin.com/faq/
> Documentation: http://cygwin.com/docs.html
> Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
>=20=09=09=20=09=20=20=20=09=09=20=20
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hot=
mail.
http://www.windowslive.com/campaign/thenewbusy?tile=3Dmultiaccount&ocid=3DP=
ID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019