Thread: Compiling a c code with subroutines from sacio.a

Started: 2010-06-09 00:12:38
Last activity: 2010-06-09 17:36:11
Topics: SAC Help
Shahar Shani Kadmiel
2010-06-09 00:12:38
I have written a short code in c utilizing the "wsac1" subroutine.
When compiling, I get this:

Undefined symbols:
"_wsac1", referenced from:
_main in cc7iJC76.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

This is the only problem and when I comment out the line containing wsac1 the program compiles with no errors.
The part after _main, where it says "cc7iJC76.o", changes with every try.

This is my compile line:

cc codeName.c -o codeName -lm -m32 sacio.a

where sacio.a is in the same folder as codeName.c.
I have tried giving the full path of sacio.a as-well as changing the order of appearance of the arguments in the compile line.

I know that sacio.a is being read because when -m32 wasn't specified I got a warning stating:

ld: warning: in sacio.a, file was built for unsupported file format which is not the architecture being linked (x86_64)

I am using MacSAC 10.6f-grh104 and the sacio.a that came with it.
I am currently trying to compile this code on a Mac running OS X 10.6.3 (i7 processor) but I intend to compile this on a linux machine that does not have sac installed. Can I copy the sacio.a that came with MacSAC or should I use a different archive file?

Thanks for all your help.
Shahar
  • Brian Savage
    2010-06-09 17:36:11
    Dear Shahar,

    You may need to add an underscore to the function call within your C
    code.
    MacSAC is a fortran version of SAC from the original lineage of SAC,
    before SAC2000 / SAC@IRIS.

    The function in the sacio.a library probably have trailing underscores
    in them.

    This is not an issue for the SAC version from IRIS.

    See: http://www.ibiblio.org/pub/languages/fortran/ch1-11.html

    Brian Savage
    savage<at>uri.edu



    On Jun 8, 2010, at 10:12 AM , Shahar Shani Kadmiel wrote:

    I have written a short code in c utilizing the "wsac1" subroutine.
    When compiling, I get this:

    Undefined symbols:
    "_wsac1", referenced from:
    _main in cc7iJC76.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status

    This is the only problem and when I comment out the line containing
    wsac1 the program compiles with no errors.
    The part after _main, where it says "cc7iJC76.o", changes with every
    try.

    This is my compile line:

    cc codeName.c -o codeName -lm -m32 sacio.a

    where sacio.a is in the same folder as codeName.c.
    I have tried giving the full path of sacio.a as-well as changing the
    order of appearance of the arguments in the compile line.

    I know that sacio.a is being read because when -m32 wasn't specified
    I got a warning stating:

    ld: warning: in sacio.a, file was built for unsupported file format
    which is not the architecture being linked (x86_64)

    I am using MacSAC 10.6f-grh104 and the sacio.a that came with it.
    I am currently trying to compile this code on a Mac running OS X
    10.6.3 (i7 processor) but I intend to compile this on a linux
    machine that does not have sac installed. Can I copy the sacio.a
    that came with MacSAC or should I use a different archive file?

    Thanks for all your help.
    Shahar
    _______________________________________________
    sac-help mailing list
    sac-help<at>iris.washington.edu
    http://www.iris.washington.edu/mailman/listinfo/sac-help


23:33:31 v.9bc884e1