Operating System - HP-UX
1827773 Members
2550 Online
109969 Solutions
New Discussion

Re: Compiled Fortran File from another OS...

 
Jonathan Caplette_1
Super Advisor

Compiled Fortran File from another OS...

Hi guys!!

I've a little problem here... I've an IBM workstation running AIX 4.3.2 and XLfortran.... On that machine, some users have compiled Fortran progs, and now I have change my IBM for and HP Visualize B2600 running HP-UX 11i and without a Fortran compiler...

What I have done, is moved the file from the IBM on the HP station, with the same rights of rwx on each file.... The problem is when I call on compiled app, it says to me:
/elec/bin/excu[57]: //elec/bin/exec/zturb: cannot execute

What's on the line in my "excu" script on line 57, is to run that prog "zturb"....

any clue.?.?.? or somebody know why this program is not executable... is it really because of the compilation on an IBM machine???

Regards
Jonathan
20 REPLIES 20
Pete Randall
Outstanding Contributor

Re: Compiled Fortran File from another OS...

Jonathan,

Different compiler, different architecture: it's definitely not going to work.


Pete

Pete
Jonathan Caplette_1
Super Advisor

Re: Compiled Fortran File from another OS...

I've found the source code... Can I compile it with any Fortran compiler???
Pete Randall
Outstanding Contributor

Re: Compiled Fortran File from another OS...

HP has a Fortran compiler they'd be happy to sell you. I don't know if there's a "freeware" compiler available.

Pete

Pete
John Poff
Honored Contributor

Re: Compiled Fortran File from another OS...

Hi,

I just hit the gcc web site and it says it will compile fortran. I've never tried it before. Sounds like fun!


http://gcc.gnu.org/onlinedocs/gcc-3.2.1/gcc/G---and-GCC.html#G++%20and%20GCC


JP

harry d brown jr
Honored Contributor

Re: Compiled Fortran File from another OS...

Why not use GNU's fortran compiler, ported to HP - (install the Dependencies first!)?

http://hpux.cs.utah.edu/hppd/hpux/Gnu/gcc-3.2/

Or the GCC compiler depot from HP:
http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,547,00.html



live free or die
harry
Live Free or Die
Jonathan Caplette_1
Super Advisor

Re: Compiled Fortran File from another OS...

I'm gonna try those compiler.... I'll keep writting!!
Shannon Petry
Honored Contributor

Re: Compiled Fortran File from another OS...

The GNU project EGCS includes a fortran compiler. It's pretty robust, and supports fortran 77 standards. The compiler name is actually g77.

If your code is written in f90 standards, the compile will most likely fail.

The HP fortran compiler has both f77 and f90, so definately a safer route if your not sure.

You can download egcs from the HP porting center. http://hpux.cs.utah.edu/hppd/hpux/

Good luck!
Shannon
Microsoft. When do you want a virus today?
harry d brown jr
Honored Contributor

Re: Compiled Fortran File from another OS...

Shannon,

Does the g77 compiler support the "old" f77 extensions of do...while and do...until constructs ??

It's been about 20 years since I've written an F77 program!

live free or die
harry
Live Free or Die
John Poff
Honored Contributor

Re: Compiled Fortran File from another OS...

Harry,

My curiousity is peaked also. I took a Fortran programming class a LONG time ago when I was in college. I won't say how long ago, but the U.S. president at the time was a former Southern governor, and not from Arkansas! :)

JP
Shannon Petry
Honored Contributor

Re: Compiled Fortran File from another OS...

As far as I know yes.

I took some of my code and it worked. My code may predate yours, and was pretty basic math code for Calculus.


I'm not sure about how certain things would work though, as my code was mainframe based so file descriptors were much different than a Unix counterpart.

The basic routines all worked though. The one I compiled was a root number find program, which required no file i/o, just had a seed imbedded in the code.

Regards,
Shannon
Microsoft. When do you want a virus today?
Jonathan Caplette_1
Super Advisor

Re: Compiled Fortran File from another OS...

I downloaded gcc 3.2 from the link above... I got the compiler g77 and when I try to compile my files it says to me : "Fortran Compiler not installed on this machine "

I did g77 .f I'm sure that I need option with that, but I don't know which one to put, I've nerver compiled with any compiler...

Somebody can help me please??
Ralph Grothe
Honored Contributor

Re: Compiled Fortran File from another OS...

Because it's been a long time ago when I wrote F77 progs myself, and then there was no GNU g77 available, I can only guess about compiler options for g77.

But I guess as it builds on gcc they are basically very similar.

So look for file a.out (if the compile went without errors) which should be your executable.

Since the name isn't very fancy (and only for historic reasons) you can tell g77 to name the binary something else.

e.g.

g77 -o my_number_cruncher number_cruncher.for
Madness, thy name is system administration
John Poff
Honored Contributor

Re: Compiled Fortran File from another OS...

Hi,

Here is a link to the Fortran docs on the GNU site. Maybe they will help:

http://gcc.gnu.org/onlinedocs/gcc-3.2.1/g77/


JP
Shannon Petry
Honored Contributor

Re: Compiled Fortran File from another OS...

Make sure you download and install gnu-binutils as well as egcs. I believe the assembler for g77 and other compilers is identical, so this may be the complaint.

Also, make sure that your path includes the ~/bin directory for both bin-utils and egcs.


Regards,
Shannon
Microsoft. When do you want a virus today?
Gregory Fruth
Esteemed Contributor

Re: Compiled Fortran File from another OS...

g77 works quite well on FORTRAN 77
programs. It supports the usual F77
extensions like "end do". I've had no
problems using it on our applications
(30000 lines of F77 code).
Jonathan Caplette_1
Super Advisor

Re: Compiled Fortran File from another OS...

Hi guys, look at what I got here... Somebody have a clue about what to do????

# g77 qn0460a.f
qn0460a.f: In subroutine `chdate':
qn0460a.f:42: warning:
CALL IDATE(IMOIS,IJOUR,IAN)
^
Intrinsic `IDATE', invoked at (^), known to be non-Y2K-compliant [info -f g77 M
Y2KBAD]
/usr/ccs/bin/ld: Unsatisfied symbols:
MAIN__ (first referenced in /usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.2/
../../../libfrtbegin.a(frtbegin.o)) (code)
ltitsb_ (first referenced in /var/tmp//ccckg4zb.o) (code)
collect2: ld returned 1 exit status

thanks!
jonathan
Gregory Fruth
Esteemed Contributor

Re: Compiled Fortran File from another OS...

Step 1: Assign points where appropriate.

Step 2: Make sure you have a main program
defined somewhere. If the app is halfway
decently written there'll be a PROGRAM
and/or STOP statement somewhere.
Otherwise, look for code that is not encased
in a SUBROUTINE or FUNCTION or BLOCK
DATA program unit.
Gregory Fruth
Esteemed Contributor

Re: Compiled Fortran File from another OS...

If it's IDATE that you're asking about, then
the message from the compiler is pretty
self-explanatory. If you're concerned with
Y2K compliance then you need to fix the
warning. Otherwise, you can ignore it and
the program ought to run. (The reason why
your example above doesn't work is the
missing main program -- the warning about
IDATE is unrelated).

From the syntax you show, it seems that the
original programmer was using the VAX IDATE;
g77 believes that the VAX IDATE is not Y2K
compliant, hence the warning. However, if
you use the Unix IDATE syntax, g77 is satisifed
and the warning will go away. But you'll
need to modify your program a bit:

integer ibuf(3)
call idate(ibuf)
ijour = buf(1)
imoi = buf(2)
ian = buf(3)
Gregory Fruth
Esteemed Contributor

Re: Compiled Fortran File from another OS...

Oops, replace buf() with ibuf() where appropriate.
Jonathan Caplette_1
Super Advisor

Re: Compiled Fortran File from another OS...

Hi guys...

The problem was with the order of the compilation of the files...

Thank you all!!