Problem compiling intrinsic functions
I've recently had a new version of the sun fortran compiler installed by our IT people. However, I appear to be unable to use certain intrinsic functions in a particular manner. As an example the following code compiles and runs successfully, whilst the second example program fails to link:
program main
implicit none
PRINT*, ADJUSTL(" abc")
PRINT*, ADJUSTR("abc ")
PRINT*, SIGN(100.0,-1.0)
end program main
--
program main
implicit none
character(len=5) :: test
real :: neg = -1.0, ton = 100.0
test = "abc "
PRINT*, ADJUSTL(test)
PRINT*, ADJUSTR(test)
PRINT*, SIGN(ton,neg)
end program main
Has anyone come accross this before? Or is it possible to recreate the error? The error message I'm getting is:
Undefinedfirst referenced
symbolin file
_F90_ADJUSTR_8 temp.o
_F90_ADJUSTL_8 temp.o
__f95_signf temp.o
ld: fatal: Symbol referencing errors. No output written to a.out
Any help appreciated. Thanks
Ric
[1065 byte] By [
Ric] at [2007-11-26 9:28:57]

# 1
It seems as though the compiler didn't install properly. Those functions are defined in libfsu. Try using the -v option when linking. You'll see a bunch of output, including something like this:
/usr/ccs/bin/ld -t -R/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/lib:/opt/SUNWspro/lib/v8plus:/opt/SUNW spro/lib -o a.out /opt/SUNWspro/prod/lib/crti.o /opt/SUNWspro/prod/lib/crt1.o /opt/SUNWspro/prod/lib/misalign.o /opt/SUNWspro/prod/lib/values-xi.o -Y P,/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/prod/lib/v8plus:/opt/SUNWspro/lib:/opt /SUNWspro/prod/lib:/usr/ccs/lib:/lib:/usr/lib foo.o -lfui -lfai -lfai2 -lfsumai -lfprodai -lfminlai -lfmaxlai -lfminvai -lfmaxvai -lfsu -lsunmath -Bdynamic -lmtsk -lm -lc /opt/SUNWspro/prod/lib/crtn.o
This link command includes a set of directories in which the linker should look for libraries (the "-Y P, " option). Look for libfsu.so in one of those directories. Given your symptoms, either you won't find it, or you'll find an old one that doesn't contain those functions.
Anyway, reinstalling is probably the best way to fix the problem.
igb at 2007-7-7 0:11:16 >

# 2
Thanks
The problem turned out to be in the setting of the LD_LIBRARY_PATH environment variable. This was still set up to look at the libraries from an old installation. The -Y P option looked correct, but an earlier version of libfsu must have been used at some point in the compilation process.
Ric
Ric at 2007-7-7 0:11:16 >
