Trouble with cc/f77

Caroline Lambert caroline at pangea.Stanford.EDU
Fri Jan 25 07:30:50 AEST 1991


In article <1991Jan24.194343.5054 at morrow.stanford.edu> farrell at tioga.Stanford.EDU (Phil Farrell) writes:
>In article <1991Jan24.001055.3069 at ims.alaska.edu>
>Don Rice (fnddr at acad3.alaska.edu) writes:
>>A couple of cc/f77 problems have turned up (Ultrix 4.0/DS5000/Fortran 2.1)....
>>... when trying to combine a main program written in C with a subroutine
>>written in Fortran, the Fortran built-in functions aren't found:
>>  > cc -o prog main.c fortsub.o -lF77 -lU77 -lI77 -lm
>>  ld:
>>  Undefined:
>>  sinf
>>  cosf
>>  sqrtf
>
>Is the C compiler even finding the libraries?  As installed, Fortran 2.1
>libraries are in /usr/lib/cmplrs/f77, but the C compiler looks for 
>those -lF77 etc directives in /usr/lib.  I created symbolic links
>for libF77.a, libI77.a, and libU77.a from /usr/lib/cmplrs/f77 to /usr/lib
>on my system to address this problem.
>
>Secondly, you realize that the linker only searches a library once for 
>any references on its current "unresolved" list.  If a routine from one
>library calls one from another library that has already been searched, 
>that will created an undefined reference.  You might play with the 
>order of libraries on your command line, or even add another -l command
>at the end to search the library a second time.
>
I have the same problem. I have compiled my program on Phil's machine
and it gives the same error, so linking the libraries doesn't work. 
I've already tried every conceivable order for linking the libraries
and that doesn't work.

What I did find, though, is the following: somewhere in my FORTRAN
subroutine I have some statements like these:

      real a, b
      a = sin(b)

The problem is that sin is a double precision function, and a and b
are single precision. This code does work:

      double precision a, b
      a = sin(b)

This works too:

      real a,b
      a = sngl(sin(dble(b)))

If anyone knows why C/f77 with f772.1 complains about this mixture of
single precision arguments to double precision functions, I'd like to
know, since I'm having a miserable time porting some software to our
DEC5000 machine with f772.1 which works fine on a DEC3100 with f771.3,
and every other machine I have access to.

--
Caroline Lambert               
Dept. of Geophysics
Stanford University	caroline at pangea.Stanford.EDU   standard disclaimer



More information about the Comp.unix.ultrix mailing list