[R-SIG-Mac] kinship

stefano iacus stefano.iacus at unimi.it
Sat Oct 22 13:22:37 CEST 2005


Andrew,
the problem is that in some headers you defines symbols used by  
different .c files.
You should define these extern everywhere but for on single .c file  
only.
One triky solution is to declare all of them as "extern" in the .h  
file and undef "extern" for one .c file only.
Have a look at R sources in files src/include/Defn.h and src/main/main.c

All symbols in Defn.h are defined as extern, and defn.h is included  
by many .c files.
Only main.c defines __MAIN__ which has the effect in Defn.h to  
undefine extern.

I've just helped mantainers of the latentnet package, they've got the  
same problem.

stefano


On 22/ott/05, at 12:12, Andrew Beckerman wrote:


> Dear all -
>
> OS 10.4.2, R 2.2.0 + Tcltk and Fortran
>
> I am trying to install the package "kinship", only available through
> source.  The package seems to do well until the very end, where a
> multiple definitions error crops up (see below).   A previous post
> and response from B. Ripley suggested the following:
>
> "You need to change coxfit6.h to have the object extern in all but
> one of the files it is included in. That is a peculiarity of MacOS X."
>
> Any advice on how to accomplish this?  Is it in the works with
> regards to packaging a binary?
>
> Cheers
> andrew
>
> ------------------
> tar: Read 3584 bytes from -
> * Installing *source* package 'kinship' ...
> ** libs
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c agfit6b.c -o
> agfit6b.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c
> bdsmatrix_index1.c -o bdsmatrix_index1.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c
> bdsmatrix_index2.c -o bdsmatrix_index2.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c
> bdsmatrix_index3.c -o bdsmatrix_index3.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c
> bdsmatrix_prod.c -o bdsmatrix_prod.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c
> bdsmatrix_prod2.c -o bdsmatrix_prod2.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c
> bdsmatrix_prod3.c -o bdsmatrix_prod3.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c chinv4.c -o
> chinv4.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c chinv5.c -o
> chinv5.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c cholesky4.c -o
> cholesky4.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c cholesky5.c -o
> cholesky5.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c chsolve4.c -o
> chsolve4.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c chsolve5.c -o
> chsolve5.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c coxfit6a.c -o
> coxfit6a.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c coxfit6b.c -o
> coxfit6b.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c coxfit6c.c -o
> coxfit6c.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c gchol.c -o
> gchol.o
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include   -fno-common  -g -O2 -c gchol_bds.c -o
> gchol_bds.o
>
> The downloaded packages are in
>      /private/tmp/RtmpUlQDSt/downloaded_packages
> gcc-3.3 -bundle -flat_namespace -undefined suppress -L/usr/local/lib -
> o kinship.so agfit6b.o bdsmatrix_index1.o bdsmatrix_index2.o
> bdsmatrix_index3.o bdsmatrix_prod.o bdsmatrix_prod2.o
> bdsmatrix_prod3.o chinv4.o chinv5.o cholesky4.o cholesky5.o
> chsolve4.o chsolve5.o coxfit6a.o coxfit6b.o coxfit6c.o gchol.o
> gchol_bds.o  -lcc_dynamic -F/Library/Frameworks/R.framework/.. -
> framework R
> ** Removing '/Library/Frameworks/R.framework/Versions/2.2/Resources/
> library/kinship'
> ld: multiple definitions of symbol _c6
> agfit6b.o definition of _c6 in section (__DATA,__common)
> coxfit6a.o definition of _c6 in section (__DATA,__common)
> coxfit6b.o definition of _c6 in section (__DATA,__common)
> coxfit6c.o definition of _c6 in section (__DATA,__common)
> ld: can't locate file for: -lcc_dynamic
> make: *** [kinship.so] Error 1
> ERROR: compilation failed for package 'kinship'
>
> ---------------------------------------------------------------------- 
> --
> ---------
> Dr. Andrew Beckerman
> Department of Animal and Plant Sciences, University of Sheffield,
> Alfred Denny Building, Western Bank, Sheffield S10 2TN, UK
> ph +44 (0)114 222 0026; fx +44 (0)114 222 0002
> http://www.shef.ac.uk/beckslab
> ---------------------------------------------------------------------- 
> --
> ----------
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
>



More information about the R-SIG-Mac mailing list