Operating System - HP-UX
1753856 Members
7474 Online
108808 Solutions
New Discussion юеВ

Re: "Unsatisfied symbols" while linking (Fortran 90 code calls C functions)

 
Reggie Chang
Frequent Advisor

"Unsatisfied symbols" while linking (Fortran 90 code calls C functions)

Hello there,

I got the error message like the following during linking.

/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (ice.o) was detected.
The linked output may not run on a PA 1.x system.
/usr/ccs/bin/ld: Unsatisfied symbols:
xxcset (code)
when (code)
xxgpci (code)
xxcclr (code)


The scripts used to compile and link are:
compile script:
f90 -c -O2 +U77 *.f
if ( $entry == 'mdsgi' ) cc -c *.c
ar rls $entry.a *.o
ar rls $astpath/library/blockdata.a *bd.o
ar rls $astpath/library/astros.a *.o

link script:
cp $astpath/library/astros.a $astpath/dist/sysgen
cp $astpath/library/sysgen.a $astpath/dist/sysgen
cp $astpath/library/blockdata.a $astpath/dist/sysgen
cd $astpath/dist/sysgen
f90 +U77 -o astros.bin astros.o *.o blockdata.a astros.a

The cc compiler is with HP-UX 10.20 and
the Fortran 90 is from HP. Please see
attachment for cc and f90 info. Those
C programs (say, when.c) are compiled fine
without error messages, by the way.

Does anyone have the idea about the problem?

Best regards,

Reggie

reggie@zonatech.com

4 REPLIES 4
Olav Baadsvik
Esteemed Contributor

Re: "Unsatisfied symbols" while linking (Fortran 90 code calls C functions)


Hi,


As far as I can see all *.o files go into
the astros.a file.
Use nm astros.a to check if the unsatisfied
symbols really are in astros.a

nm astros.a should show lines like this:

when | 0 | extern | entry | $CODE$

By the way, I do not see why you have this
line in the compile-script:
ar rls $entry.a *.o
as this does not seem to be used later.

The output from your cc -Ae also indicates
that you do not have the ANSI/C compiler
installed, only the "bundled compiler"

Regards
Olav
Gregory Fruth
Esteemed Contributor

Re: "Unsatisfied symbols" while linking (Fortran 90 code calls C functions)

The HP F90 compiler (and I suspect most
if not all FORTRAN compilers) automatically
converts all external symbol names (function
names, subroutine names, and common block
names) to lower case. Perhaps your functions
xxcset(), when(), etc. are actually named
(xxCset(0, When(), etc.) F90 will only look
for xxcset(), when(), etc. You can use the
"F90 +uppercase" option to make it look for
XXCSET(), WHEN(), etc., but I don't think
there's a way to get it to preserve mixed
case symbols.

If this is the problem, you need to rename
your C functions to all lower case, or to
all upper case and use the +uppercase
option.

HTH

Reggie Chang
Frequent Advisor

Re: "Unsatisfied symbols" while linking (Fortran 90 code calls C functions)

Hi Olav,

nm astros.a gives the following result:

Symbols from astros.a[when.o]:
S$7$when_ | 384|static|data |$LIT$
when_ | 0|extern|entry |$CODE$
when | |undef |code |


Do you see any problem?

Best regards,

Reggie

Gregory Fruth
Esteemed Contributor

Re: "Unsatisfied symbols" while linking (Fortran 90 code calls C functions)

Oh yeah, most FORTRAN compilers also
add an underscore to external symbol names.
Use "f90 +noppu" to suppress this behavior.

According to the man page, "f90 +ppu"
is the default for 64-bit objects, while
"f90 +noppu" is the default for 32-bit
objects.