LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-05-2011, 02:06 AM   #1
wootletootle
Member
 
Registered: Jul 2002
Location: New Zealand
Distribution: slackware
Posts: 81

Rep: Reputation: 15
Cygwin script compilation problem (f77)


Can anyone suggest a solution to a compiler problem (f77)
which arises when I try to execute a bash script
("compile" see [1] below) running under Cygwin on WinXP.

The script finds the correct file(s) but the compiler does
not recognize them as fortran source files. If the script
is executed sequentially from the command line then there
is no problem.

The directory structure of flh971da contains two subdirectories
flh971da/scripts and flh971da/source. The compile script [1] is shown
(in part) below. The script changes directory to flh971da/source,
and compiles source from subdirectories flh971da/source/n where
n=a,b,c etc and places the object files in flh971da/source/nobj
n=a,b,c... etc. The response to flh971da/scripts/compile script is
given below [2]. It is clear that the compiler (f77) locates the
correct source file [4] (flh971da/source/a/a00aaft.f) but does not
recognize it as a fortran source file.

All relevant files have been processed with d2u.

I suspect the problem is with the script, but I have
no idea how to fix it.


[1] (flh971da/scripts/compile)
.........................................................................
#!/bin/sh
# This script compiles all the Library source.
#
. fortopts
OPTIONS=$UNOPT
cd ../source
if [ ! -d aobj ]
then
mkdir aobj
fi
cd aobj
$F77 $STD $OPTIONS $NOLNK ../a/a00aaft.f
exit 1

[2] (compiler response)
..........................................................................

$ cd ~/flh971da
$ cd scripts
$ ./compile
../a/a00aaft.f: line 1: SUBROUTINE: command not found
../a/a00aaft.f: line 2: C: command not found
../a/a00aaft.f: line 3: C: command not found
../a/a00aaft.f: line 4: C: command not found
../a/a00aaft.f: line 5: C: command not found
../a/a00aaft.f: line 6: C: command not found
../a/a00aaft.f: line 7: C: command not found
../a/a00aaft.f: line 8: C: command not found
../a/a00aaft.f: line 9: C: command not found
../a/a00aaft.f: line 10: INTEGER: command not found
../a/a00aaft.f: line 11: C: command not found
../a/a00aaft.f: line 12: syntax error near unexpected token `('
../a/a00aaft.f: line 12: ` CHARACTER*80 MSG(20)'


[3] (flh971da/scripts/fortopts)
.........................................................................
#!/bin/sh
# Script sets some variables used by various tools
#
F77='f77' # name of Fortran compiler
NOLNK='-c' # flag to prevent linking
STD=' ' # flag for compiling source to make a shared library
UNOPT='' # flag for no optimization

[4] (flh971da/source/a/a00aaft.f)
..............................................................................
SUBROUTINE A00AAF
C MARK 15 RE-ISSUE. NAG COPYRIGHT 1991.
C
C Writes information about the particular implementation of the
C NAG Library in use.
C
C The output channel is given by a call to X04ABF.
C
C .. Local Scalars ..
INTEGER I, NADV
C .. Local Arrays ..
CHARACTER*80 MSG(20)
C .. External Subroutines ..
EXTERNAL A00AAZ, X04ABF, X04BAF
C .. Executable Statements ..
CALL A00AAZ(MSG)
CALL X04ABF(0,NADV)
DO 20 I = 1, 7
CALL X04BAF(NADV,MSG(I))
20 CONTINUE
CALL X04BAF(NADV,MSG(20))
RETURN
END
............................................................................

Last edited by wootletootle; 04-05-2011 at 04:44 AM.
 
Old 04-19-2011, 12:45 PM   #2
ShadowCat8
Member
 
Registered: Nov 2004
Location: San Bernardino, CA
Distribution: Gentoo, Arch, (RedHat4.x-9.x, FedoraCore 1.x-4.x, Debian Potato-Sarge, LFS 6.0, etc.)
Posts: 261

Rep: Reputation: 52
Well,

As a quick thought on this, how about using "export" in front of all of your variable definitions in fortopts. The output from the compiler looks to me like it's still trying to parse through the files as a BASH script. So, the resulting fortopts file would look like:
Code:
#!/bin/sh
# Script sets some variables used by various tools
#
export F77='f77' # name of Fortran compiler
export NOLNK='-c' # flag to prevent linking
export STD=' ' # flag for compiling source to make a shared library
export UNOPT='' # flag for no optimization
HTH. Let us know.

And, BTW, thanks for the trip down Memory Lane... I haven't seen Fortran 77 code since college!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cygwin issue with bash script jdwilder Other *NIX 7 09-20-2013 05:53 AM
Have you ever used cygwin, i've met a problem with the command stat from cygwin andy820303 Linux - Newbie 0 03-11-2009 03:37 AM
Help with Cygwin shell script? corbintechboy General 1 12-26-2007 10:59 AM
Problem linking f77 and f90 object files Make problem (I think) TheBrick Programming 1 05-22-2006 06:17 AM
f77 compiling problem ekosis Linux - Software 2 05-09-2006 04:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration