Thread: Problem with SAC libraries (sacio.a) in Mac M1

Started: 2023-05-09 14:43:08
Last activity: 2023-05-13 13:39:05
Topics: SAC Help
Gilberto Silva
2023-05-09 14:43:08
Hello

I am trying to compile a fortran code (srcgrd5.f) using the SAC libraries
(sacio.a) in my Mac m1 but I am receiving the following output:

Input command line:

gfortran -fallow-argument-mismatch -o srcgrd5 srcgrd5.f
/Users/gilberto/src/sac/lib/sacio.a util_date.o


Output:


*srcgrd5.f:947:23:*


601 | call rsac1(infile,vss,nptsgrn,btime,dt,maxpts,nerr)

| 2

......

947 | call rsac1(fname,obs,nptsdat,btime,dt2,1,nerr)

| *1*

*Warning:* Rank mismatch between actual argument at *(1)* and actual
argument at (2 (rank-1 and scalar)

ld: warning: ignoring file /Users/gilberto/src/sac/lib/sacio.a, building
for macOS-arm64 but attempting to link with file built for macOS-x86_64

Undefined symbols for architecture arm64:

"_getfhv_", referenced from:

_getwaveforms_ in ccXgdBYQ.o

_getevent_data_ in ccXgdBYQ.o

"_getnhv_", referenced from:

_getevent_data_ in ccXgdBYQ.o

"_rsac1_", referenced from:

_getwaveforms_ in ccXgdBYQ.o

_getevent_data_ in ccXgdBYQ.o

"_wsac1_", referenced from:

_MAIN__ in ccXgdBYQ.o

ld: symbol(s) not found for architecture arm64

collect2: error: ld returned 1 exit status

So far, my guess is that the sacio.a file that I have is somehow not
suitable for Macs with M1 processor. I was hoping if someone could help me
with this.

Thank you!

  • Graça Silveira
    2023-05-12 17:12:37
    Hello,

    You need a sacio.a library compatible with the M1.

    In May 2022 I move to M1 and at that time I had to request the sources and compile sac myself.
    It is working pretty fine.

    You may start by checking if IRIS already have a compile version that works in the Mac M1.

    Best regards
    Graça Silveira

    Professor Coordenador/Investigador
    Departamento de Física
    Instituto Superior de Engenharia de Lisboa
    Rua Conselheiro Emidio Navarro,1
    1959-007 Lisbon
    Portugal
    &
    Instituto Dom Luiz IDL
    Edif. C8, FCUL, Campo Grande
    1749-016 LISBOA
    Portugal
    Email: mdsilveira<at>fc.ul.pt<mdsilveira<at>fc.ul.pt>
    Tel.: +351.217500812
    Fax: +351.217500977







    No dia 12/05/2023, às 18:04, Gilberto Silva (via IRIS) <sac-help-bounce<at>lists.ds.iris.edu<sac-help-bounce<at>lists.ds.iris.edu>> escreveu:

    Hello

    I am trying to compile a fortran code (srcgrd5.f) using the SAC libraries (sacio.a) in my Mac m1 but I am receiving the following output:

    Input command line:

    gfortran -fallow-argument-mismatch -o srcgrd5 srcgrd5.f /Users/gilberto/src/sac/lib/sacio.a util_date.o

    Output:

    srcgrd5.f:947:23:

    601 | call rsac1(infile,vss,nptsgrn,btime,dt,maxpts,nerr)
    | 2
    ......
    947 | call rsac1(fname,obs,nptsdat,btime,dt2,1,nerr)
    | 1
    Warning: Rank mismatch between actual argument at (1) and actual argument at (2 (rank-1 and scalar)
    ld: warning: ignoring file /Users/gilberto/src/sac/lib/sacio.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
    Undefined symbols for architecture arm64:
    "_getfhv_", referenced from:
    _getwaveforms_ in ccXgdBYQ.o
    _getevent_data_ in ccXgdBYQ.o
    "_getnhv_", referenced from:
    _getevent_data_ in ccXgdBYQ.o
    "_rsac1_", referenced from:
    _getwaveforms_ in ccXgdBYQ.o
    _getevent_data_ in ccXgdBYQ.o
    "_wsac1_", referenced from:
    _MAIN__ in ccXgdBYQ.o
    ld: symbol(s) not found for architecture arm64
    collect2: error: ld returned 1 exit status

    So far, my guess is that the sacio.a file that I have is somehow not suitable for Macs with M1 processor. I was hoping if someone could help me with this.

    Thank you!




    ----------------------
    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/


    • Gilberto Silva
      2023-05-12 18:10:15
      Hi Graça,

      As you said, I downloaded the sac source (
      http://ds.iris.edu/ds/nodes/dmc/forms/sac/) and compiled it in my mac
      following the instructions in the readme file, and now the sacio.a seems to
      work on my computer.

      Thank you!



      Em sex., 12 de mai. de 2023 às 14:13, Graça Silveira <
      mdsilveira<at>ciencias.ulisboa.pt> escreveu:

      Hello,

      You need a sacio.a library compatible with the M1.

      In May 2022 I move to M1 and at that time I had to request the sources and
      compile sac myself.
      It is working pretty fine.

      You may start by checking if IRIS already have a compile version that
      works in the Mac M1.

      Best regards
      Graça Silveira

      Professor Coordenador/Investigador
      Departamento de Física
      Instituto Superior de Engenharia de Lisboa
      Rua Conselheiro Emidio Navarro,1
      1959-007 Lisbon
      Portugal
      &
      Instituto Dom Luiz IDL
      Edif. C8, FCUL, Campo Grande
      1749-016 LISBOA
      Portugal
      Email: mdsilveira<at>fc.ul.pt <mdsilveira<at>fc.ul.pt>
      Tel.: +351.217500812
      Fax: +351.217500977







      No dia 12/05/2023, às 18:04, Gilberto Silva (via IRIS) <
      sac-help-bounce<at>lists.ds.iris.edu> escreveu:

      Hello

      I am trying to compile a fortran code (srcgrd5.f) using the SAC libraries
      (sacio.a) in my Mac m1 but I am receiving the following output:

      Input command line:

      gfortran -fallow-argument-mismatch -o srcgrd5 srcgrd5.f
      /Users/gilberto/src/sac/lib/sacio.a util_date.o

      Output:

      *srcgrd5.f:947:23:*

      601 | call rsac1(infile,vss,nptsgrn,btime,dt,maxpts,nerr)
      | 2
      ......
      947 | call rsac1(fname,obs,nptsdat,btime,dt2,1,nerr)
      | *1*
      *Warning:* Rank mismatch between actual argument at *(1)* and actual
      argument at (2 (rank-1 and scalar)
      ld: warning: ignoring file /Users/gilberto/src/sac/lib/sacio.a, building
      for macOS-arm64 but attempting to link with file built for macOS-x86_64
      Undefined symbols for architecture arm64:
      "_getfhv_", referenced from:
      _getwaveforms_ in ccXgdBYQ.o
      _getevent_data_ in ccXgdBYQ.o
      "_getnhv_", referenced from:
      _getevent_data_ in ccXgdBYQ.o
      "_rsac1_", referenced from:
      _getwaveforms_ in ccXgdBYQ.o
      _getevent_data_ in ccXgdBYQ.o
      "_wsac1_", referenced from:
      _MAIN__ in ccXgdBYQ.o
      ld: symbol(s) not found for architecture arm64
      collect2: error: ld returned 1 exit status

      So far, my guess is that the sacio.a file that I have is somehow not
      suitable for Macs with M1 processor. I was hoping if someone could help me
      with this.

      Thank you!




      ----------------------
      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/




      --
      *Gilberto da Silva Leite Neto (Leite Neto, G. S.)*
      *M.Sc. in Geodynamics and Geophysics PPGG/UFRN, Brazil*
      *PhD student in Geodynamics and Geophysics PPGG/UFRN, Brazil*
      *+55 (84) 99907-0847*

      *http://lattes.cnpq.br/8005306262785305
      http://lattes.cnpq.br/8005306262785305*

  • George Helffrich
    2023-05-13 13:39:05
    Dear Gilberto -

    There are two separate problems here: one is gfortran related, and the other is a mismatch between the machine architectures of your code and your SAC I/O libraries.

    To fix the first one, caused by the warnings associated with the RSAC1 calls, probably one of those parameters (infile and fname) is declared differently (character array vs a character string). Harmonize the type declarations and the warning will go away.

    The other one is your code is being generated for an M1 (ARM) processor but your library is for an Intel processor. You need to get the proper SAC I/O libraries for your machine and link with them.

    On 12 May 2023, at 18:04, Gilberto Silva (via IRIS) <sac-help-bounce<at>lists.ds.iris.edu> wrote:

    Hello

    I am trying to compile a fortran code (srcgrd5.f) using the SAC libraries (sacio.a) in my Mac m1 but I am receiving the following output:

    Input command line:

    gfortran -fallow-argument-mismatch -o srcgrd5 srcgrd5.f /Users/gilberto/src/sac/lib/sacio.a util_date.o

    Output:

    srcgrd5.f:947:23:

    601 | call rsac1(infile,vss,nptsgrn,btime,dt,maxpts,nerr)
    | 2
    ......
    947 | call rsac1(fname,obs,nptsdat,btime,dt2,1,nerr)
    | 1
    Warning: Rank mismatch between actual argument at (1) and actual argument at (2 (rank-1 and scalar)
    ld: warning: ignoring file /Users/gilberto/src/sac/lib/sacio.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
    Undefined symbols for architecture arm64:
    "_getfhv_", referenced from:
    _getwaveforms_ in ccXgdBYQ.o
    _getevent_data_ in ccXgdBYQ.o
    "_getnhv_", referenced from:
    _getevent_data_ in ccXgdBYQ.o
    "_rsac1_", referenced from:
    _getwaveforms_ in ccXgdBYQ.o
    _getevent_data_ in ccXgdBYQ.o
    "_wsac1_", referenced from:
    _MAIN__ in ccXgdBYQ.o
    ld: symbol(s) not found for architecture arm64
    collect2: error: ld returned 1 exit status

    So far, my guess is that the sacio.a file that I have is somehow not suitable for Macs with M1 processor. I was hoping if someone could help me with this.

    Thank you!




    ----------------------
    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


    • Gilberto Silva
      2023-05-13 13:10:40
      Hi George

      I managed to fix the second problem regarding the sacio libraries
      rebuilding SAC from source. With respect to the first problem, I dealt with
      it by using the -fallow-argument-mismatch flag during compilation and the
      program is working fine. However, I wasn't able to fix this without this
      flag. In the fortran file both infile and fname are declared as
      character*256.

      Thank you for your reply

      Em sáb., 13 de mai. de 2023 às 09:44, George Helffrich (via IRIS) <
      sac-help-bounce<at>lists.ds.iris.edu> escreveu:

      Dear Gilberto -

      There are two separate problems here: one is gfortran related, and the
      other is a mismatch between the machine architectures of your code and your
      SAC I/O libraries.

      To fix the first one, caused by the warnings associated with the RSAC1
      calls, probably one of those parameters (infile and fname) is declared
      differently (character array vs a character string). Harmonize the type
      declarations and the warning will go away.

      The other one is your code is being generated for an M1 (ARM) processor
      but your library is for an Intel processor. You need to get the proper SAC
      I/O libraries for your machine and link with them.

      On 12 May 2023, at 18:04, Gilberto Silva (via IRIS) <
      sac-help-bounce<at>lists.ds.iris.edu> wrote:

      Hello

      I am trying to compile a fortran code (srcgrd5.f) using the SAC libraries
      (sacio.a) in my Mac m1 but I am receiving the following output:

      Input command line:

      gfortran -fallow-argument-mismatch -o srcgrd5 srcgrd5.f
      /Users/gilberto/src/sac/lib/sacio.a util_date.o

      Output:

      *srcgrd5.f:947:23:*

      601 | call rsac1(infile,vss,nptsgrn,btime,dt,maxpts,nerr)
      | 2
      ......
      947 | call rsac1(fname,obs,nptsdat,btime,dt2,1,nerr)
      | *1*
      *Warning:* Rank mismatch between actual argument at *(1)* and actual
      argument at (2 (rank-1 and scalar)
      ld: warning: ignoring file /Users/gilberto/src/sac/lib/sacio.a, building
      for macOS-arm64 but attempting to link with file built for macOS-x86_64
      Undefined symbols for architecture arm64:
      "_getfhv_", referenced from:
      _getwaveforms_ in ccXgdBYQ.o
      _getevent_data_ in ccXgdBYQ.o
      "_getnhv_", referenced from:
      _getevent_data_ in ccXgdBYQ.o
      "_rsac1_", referenced from:
      _getwaveforms_ in ccXgdBYQ.o
      _getevent_data_ in ccXgdBYQ.o
      "_wsac1_", referenced from:
      _MAIN__ in ccXgdBYQ.o
      ld: symbol(s) not found for architecture arm64
      collect2: error: ld returned 1 exit status

      So far, my guess is that the sacio.a file that I have is somehow not
      suitable for Macs with M1 processor. I was hoping if someone could help me
      with this.

      Thank you!




      ----------------------
      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


      ----------------------
      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/



      --
      *Gilberto da Silva Leite Neto (Leite Neto, G. S.)*
      *M.Sc. in Geodynamics and Geophysics PPGG/UFRN, Brazil*
      *PhD student in Geodynamics and Geophysics PPGG/UFRN, Brazil*
      *+55 (84) 99907-0847*

      *http://lattes.cnpq.br/8005306262785305
      http://lattes.cnpq.br/8005306262785305*

06:21:26 v.22510d55