I am currently porting some software from an old Power Hawk to an iHawk Concurrent system. My fortran compiler is the Concurrent cf77 . No, I don't have the option to switch to gfortran, I need some compiler flags of this compiler.
In multiple *.f files I need the length of continuous characters let's call them "strings".
In the past we had a company internal library providing me therefore a function
lstr = lg(str)
This function is now not available anymore.
So the variables I am trying to get the length of are declared as following:
integer function number(str, state)
implicit none
character str*(*)
integer*1 z/ '30'x /
integer*2 j,i
j = lg(str)
do i=1 , j
num = ichar( str(i:i) ) - z
if(num.lt.0) then
state = 1
return
end if
end do
state= 0
return
end
So what I tried is this len() method instead of lg() but this gives me the compile error:
file.f: XXX undefined reference to `len_'
So I thought I am not this stupid, perhaps it is the do not add underscore problem, so for Concurrent it is sufficient to declare it as CEXTERNAL:
CEXTERNAL len
Haha , no the super not smart dev has now the following error:
file.f: XXX undefined reference to `len'
I am currently compiling / linking with the following flags:
cf77 -g --cpu=pentium -c -Nt5000 -lpthread $@
cf77 -g --cpu=pentium -o -Wl,-rpath-link=/usr/lib,-lc,/usr/lib/librt.a $@
Comment:
--cpu=pentium
is cross compiling for a 32-bit target machine on a 64-bit machine with a 64-bit compiler. with-Wl,-rpath-link= (...)
I hand down the flags to the linker. If I leave that out like using only:-L/usr/lib -lc
I get the following:/usr/lib/librt.so: undefined reference to `__pthread_unwind@GLIBC_PRIVATE' /usr/lib/librt.so: undefined reference to ¸pthread_sigmask@GLIBC2.0'
etc. a bunch of them. Adding librt.a is resulting then the same. Only handing it down with -Wl,-rpath-link= arg, arg, arg is working.
Am I perhaps just missing the correct library? Is this len()
method really doing what I need it for or do you have any suggestions?