[R-SIG-Mac]Compiling R libraries on MAC OS X

Stephen Eglen eglen@pcg.wustl.edu
Wed, 26 Feb 2003 17:31:05 -0600


Hi,
can anyone help me with the following problem?

[Using R-1.6.2 patched on Mac OS X 10.2.4, Developer tools from ~August?]

I have made four personal R libaries on Linux, and I'm trying to get
them to work on Mac OS X.  All of them have C code that is called from
R using .C().  Three out of the four work fine, but when I try to
compile one of them (a Voronoi library, based on Steve Fortune's code)
ld complains.  

% R CMD check sjevor

* checking for working latex ... OK
* using log directory '/Users/stephen/langs/R/sjevor.Rcheck'
* checking for file 'sjevor/DESCRIPTION' ... OK
* checking if this is a source package ... OK
* Installing *source* package 'sjevor' ...
** libs
gcc -no-cpp-precomp -I/usr/local/lib/R/include  -I/sw/include -I/usr/local/include  -g -fno-common  -g -O2 -c edgelist.c -o edgelist.o
gcc -no-cpp-precomp -I/usr/local/lib/R/include  -I/sw/include -I/usr/local/include  -g -fno-common  -g -O2 -c geometry.c -o geometry.o
gcc -no-cpp-precomp -I/usr/local/lib/R/include  -I/sw/include -I/usr/local/include  -g -fno-common  -g -O2 -c heap.c -o heap.o
gcc -no-cpp-precomp -I/usr/local/lib/R/include  -I/sw/include -I/usr/local/include  -g -fno-common  -g -O2 -c main.c -o main.o
gcc -no-cpp-precomp -I/usr/local/lib/R/include  -I/sw/include -I/usr/local/include  -g -fno-common  -g -O2 -c memory.c -o memory.o
gcc -no-cpp-precomp -I/usr/local/lib/R/include  -I/sw/include -I/usr/local/include  -g -fno-common  -g -O2 -c output.c -o output.o
gcc -no-cpp-precomp -I/usr/local/lib/R/include  -I/sw/include -I/usr/local/include  -g -fno-common  -g -O2 -c sjevor.c -o sjevor.o
gcc -no-cpp-precomp -I/usr/local/lib/R/include  -I/sw/include -I/usr/local/include  -g -fno-common  -g -O2 -c voronoi.c -o voronoi.o
gcc -bundle -flat_namespace -undefined suppress -L/sw/lib -L/usr/local/lib -o sjevor.so edgelist.o geometry.o heap.o main.o memory.o output.o sjevor.o voronoi.o   
ld: multiple definitions of symbol _ELhash
edgelist.o definition of _ELhash in section (__DATA,__common)
geometry.o definition of _ELhash in section (__DATA,__common)
ld: multiple definitions of symbol _ELhashsize
edgelist.o definition of _ELhashsize in section (__DATA,__common)
geometry.o definition of _ELhashsize in section (__DATA,__common)
ld: multiple definitions of symbol _ELleftend
...

ld produces many similar complaints, before the build fails.

Has anyone else come across this problem? The package builds fine on
my linux box.

Thanks for any pointers,
Stephen