Thread: Fortran compiling error using the SAC library

Started: 2019-05-28 15:45:51
Last activity: 2019-05-28 15:45:51
Topics: SAC Help
Joan A. Parera Portell
2019-05-28 15:45:51
Hello all,

I'm trying to compile a fortran77 program (getsnr.f) which includes some
SAC routines:

      PROGRAM getsnr
C
      INTEGER   npts, nerr
      REAL*4    rftn, beg, del, snr
      CHARACTER nom*50
C
      CALL getarg (1,nom)
      CALL rsac1 (nom,rftn,npts,beg,del,1,nerr)
      CALL getfhv ('user0',snr,nerr)
C
      WRITE (6,*) snr
C
      END

As you can see, the code is straightforward. Its only goal is to get the
signal to noise ratio contained in the header of sac files. I try to
compile using the following commands, as shown in the SAC user's manual:

>>f77 -o getsnr getsnr.f -I${SACHOME}/include -L${SACHOME}/lib -lsacio
-lsac

However, I get the following errors:

/usr/bin/ld: /home/joanan/Aplicacions/sac/lib/libsacio.a(getfhv.o):
relocation R_X86_64_32 against undefined symbol `kmlhf' can not be used
when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/joanan/Aplicacions/sac/lib/libsacio.a(rsac1.o):
relocation R_X86_64_32 against `.rodata' can not be used when making a
PIE object; recompile with -fPIC
/usr/bin/ld: /home/joanan/Aplicacions/sac/lib/libsacio.a(f2c.o):
relocation R_X86_64_32 against `.rodata' can not be used when making a
PIE object; recompile with -fPIC
/usr/bin/ld: /home/joanan/Aplicacions/sac/lib/libsacio.a(rsach.o):
relocation R_X86_64_32 against `.rodata' can not be used when making a
PIE object; recompile with -fPIC

[...]

/usr/bin/ld: /home/joanan/Aplicacions/sac/lib/libsacio.a(zinquire.o):
relocation R_X86_64_32 against `.text' can not be used when making a PIE
object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status

I tried recompiling with the -fPIC flag with no success, the SAC
libraries are never linked (the same error messages appear). I would
really appreciate if someone could give some hint on what might be failing.

I'm on Linux Mint 19.1 64 bit.

Regards,

Joan A. Parera Portell





01:18:39 v.b4412d20