Thread: ERROR: compiling with sacio.a

Started: 2019-08-08 12:52:21
Last activity: 2019-08-17 20:35:35
Topics: SAC Help
Onur Tan
2019-08-08 12:52:21
Dear all,

I have just installed Ubuntu 18.4 (64bit) with gfortran-7 or -8.
I need to re-compile additional sac programs.

In my previous system (ubuntu 16 64bit), I can compile the programs with no
error.
But now, I have problem with ld.

Here is output:

gfortran sac2xy.f sacio.a
/usr/bin/ld: sacio.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: sacio.a(rsac2.o): relocation R_X86_64_32 against `.rodata' can
not be used when making a PIE object; recompile with -fPIC
.... more lines ...
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status

gfortran sac2xy.f sacio.a -fPIC
This also gives the same error.

Do you have any suggestions?


Best regards
Onur

  • Steve Gao
    2019-08-09 17:18:27
    Sometimes adding “-m64” in the gfortran line may work.

    Steve Gao

    From: sac-help-bounce<at>iris.washington.edu <sac-help-bounce<at>iris.washington.edu> On Behalf Of Onur Tan
    Sent: Friday, August 9, 2019 11:39 AM
    To: SAC Help <sac-help<at>lists.ds.iris.edu>
    Subject: [IRIS][sac-help] ERROR: compiling with sacio.a


    Dear all,

    I have just installed Ubuntu 18.4 (64bit) with gfortran-7 or -8.
    I need to re-compile additional sac programs.

    In my previous system (ubuntu 16 64bit), I can compile the programs with no error.
    But now, I have problem with ld.

    Here is output:

    gfortran sac2xy.f sacio.a
    /usr/bin/ld: sacio.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: sacio.a(rsac2.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
    .... more lines ...
    /usr/bin/ld: final link failed: Nonrepresentable section on output
    collect2: error: ld returned 1 exit status
    gfortran sac2xy.f sacio.a -fPIC
    This also gives the same error.

    Do you have any suggestions?

    Best regards
    Onur

  • George Helffrich
    2019-08-09 20:26:14
    Dear All -

    It looks like the SAC I/O library (sacio.a) was compiled with a different set of code generation options than your code is being compiled with. The order of the options matters in a case like this. Try

    gfortran -fPIC sac2xy.f sacio.a

    On 9 Aug 2019, at 17:39, Onur Tan <xonurtan<at>gmail.com> wrote:


    Dear all,

    I have just installed Ubuntu 18.4 (64bit) with gfortran-7 or -8.
    I need to re-compile additional sac programs.

    In my previous system (ubuntu 16 64bit), I can compile the programs with no error.
    But now, I have problem with ld.

    Here is output:

    gfortran sac2xy.f sacio.a
    /usr/bin/ld: sacio.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: sacio.a(rsac2.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
    .... more lines ...
    /usr/bin/ld: final link failed: Nonrepresentable section on output
    collect2: error: ld returned 1 exit status

    gfortran sac2xy.f sacio.a -fPIC
    This also gives the same error.

    Do you have any suggestions?


    Best regards
    Onur

    ----------------------
    SAC Help
    Topic home: http://ds.iris.edu/message-center/topic/sac-help/ | Unsubscribe: sac-help-unsubscribe<at>lists.ds.iris.edu

    Sent from the IRIS Message Center (http://ds.iris.edu/message-center/)
    Update subscription preferences at http://ds.iris.edu/account/profile/



    George Helffrich
    george<at>elsi.jp


    • Onur Tan
      2019-08-17 20:35:35

      Dear all,

      I tried all suggestions, but I cannot solve the problem.
      Someone also suggest me to re-compile SAC to generate new lib file. But, configure script cannot find installed packages on the system :(

      The latest version of SAC is 101.6a in 2013.
      Is it possible to share new version with small bug-fixes after 6 years ?

      Best regards
      Onur


      On 9 Aug 2019, at 22:22, George Helffrich <george<at>elsi.jp> wrote:

      Dear All -

      It looks like the SAC I/O library (sacio.a) was compiled with a different set of code generation options than your code is being compiled with. The order of the options matters in a case like this. Try

      gfortran -fPIC sac2xy.f sacio.a

      On 9 Aug 2019, at 17:39, Onur Tan <xonurtan<at>gmail.com <xonurtan<at>gmail.com>> wrote:


      Dear all,

      I have just installed Ubuntu 18.4 (64bit) with gfortran-7 or -8.
      I need to re-compile additional sac programs.

      In my previous system (ubuntu 16 64bit), I can compile the programs with no error.
      But now, I have problem with ld.

      Here is output:

      gfortran sac2xy.f sacio.a
      /usr/bin/ld: sacio.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: sacio.a(rsac2.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
      .... more lines ...
      /usr/bin/ld: final link failed: Nonrepresentable section on output
      collect2: error: ld returned 1 exit status

      gfortran sac2xy.f sacio.a -fPIC
      This also gives the same error.

      Do you have any suggestions?


      Best regards
      Onur

      ----------------------
      SAC Help
      Topic home: http://ds.iris.edu/message-center/topic/sac-help/ | Unsubscribe: sac-help-unsubscribe<at>lists.ds.iris.edu <sac-help-unsubscribe<at>lists.ds.iris.edu>

      Sent from the IRIS Message Center (http://ds.iris.edu/message-center/)
      Update subscription preferences at http://ds.iris.edu/account/profile/



      George Helffrich
      george<at>elsi.jp <george<at>elsi.jp>

      ----------------------
      SAC Help
      Topic home: http://ds.iris.edu/message-center/topic/sac-help/ | Unsubscribe: sac-help-unsubscribe<at>lists.ds.iris.edu

      Sent from the IRIS Message Center (http://ds.iris.edu/message-center/)
      Update subscription preferences at http://ds.iris.edu/account/profile/


09:39:01 v.22510d55