[sac-user] Compiling SAC_from_C demos

Jaroslav Sykora sykora at utia.cas.cz
Mon Jun 11 14:42:37 CEST 2012

I tried the demo and it works here. I just ran make in the directory.

As you're getting a linking error please check that all the environment 
variables (especially LD_LIBRARY_PATH) are set properly as is described 
in the top-level README.

I usually create a small script called sac-settings.sh (displayed below) 
in the top-level directory (the one where the README is), then 'source' 
it - *not* execute it! - into the bash environment:

export SACBASE=<put-here-path-to-your>/sac2c-1.00-beta-linux-athlon
export SAC2CBASE=$SACBASE/sac2c
export PATH=$PATH:$SAC2CBASE/bin

You may also try running:
   sac4c Sum -ldflags
It should print a long list of libraries and paths that are being linked 
in. The library -lArrayTransformMod should contain the missing symbols. 
You may try changing the order of the libraries.
For example put -lArrayTransformMod at the end of the command line (it 
shouldn't hurt if a library is mentioned several times on the linker 
command line):

   gcc -o summarizer summarizer.c `sac4c Sum -ccflags` `sac4c Sum 
-ldflags` -lArrayTransformMod


On 07/06/12 16:36, Neumair Guenther - S0810306018 wrote:
> Dear SAC Team/Users,
> I have some trouble compiling the sac_from_c demo from
> sac2c-1.00-17729-beta-linux-i386.tar.gz
> Simple programs like those in /sac/demos/applications/numerical/misc
> compile without errors. However i have to use a SAC module within C
> so i tried compiling /sac/demos/basics/sac_from_c using the given
> makefile. However the compiler throws out some undefined references
> /opt/sac2c-1.00-beta-linux-athlon/sac/demos/basics/sac_from_c$ make
> gcc -o summarizer summarizer.c `sac4c Sum -ccflags` `sac4c Sum
> -ldflags` ./libcwrapper.so: undefined reference to
> `SACf_ArrayTransform__sum__i_S' ./libcwrapper.so: undefined reference
> to `SACf_ArrayTransform__sum__d_S' ./libcwrapper.so: undefined
> reference to
> `SACf_ComplexArrayTransform__sum__SACt_ComplexArrayTransform__complex_S'
./libcwrapper.so: undefined reference to `SACf_ArrayTransform__sum__f_S'
> The problem occurs when linking the module to the c object. Compiling
> the module with first sac2c and after that sac4c both work.
> I tried to compile a similar program on a virtual machine using the
> ubuntu-sac-livecd.iso and it worked perfectly.
> Are the examples in the sac2c-1.00-17729-beta-linux-i386.tar.gz
> version supposed to build out of the box or did i make a mistake? Is
> the interface described in the /sac/demos/basics/sac_from_c demo the
> suggested way to use SAC-functions in C?
> Thanks in advance _______________________________________________
> sac-user mailing list sac-user at sac-home.org
> http://lists.sac-home.org/mailman/listinfo.cgi/sac-user

Space--the final frontier!

More information about the sac-user mailing list