[R-SIG-Mac] ld: multiple definitions of symbol

Hadassa Brunschwig hadassa.brunschwig at mail.huji.ac.il
Mon Jan 12 13:59:47 CET 2009


Hi

I am trying to compile multiple .c functions into
a shared object using R CMD SHLIB (I am using Tiger 10.4.10).
These functions make use of header files, some of with are in
the same directory as the .c files and some of them are standard I guess,
like #include <stdlib.h>.
When I compile the files using gcc, they compile beautifully. But using the
following command

R CMD SHLIB -o test.so *.c

I obtain errors of the sort:

ld: multiple definitions of symbol _ivector
nrutil.o definition of _ivector in section (__TEXT,__text)
tools.o definition of _ivector in section (__TEXT,__text)

I read somewhere that this is due to multiple compilers but I am not
sure about that.
I thought that I might have to add a statement for ld which says
--allow-multiple-definitions
but don't know where to put that in the R CMD SHLIB command. Or do I
have to include
the path to the standard libraries stdlib.h?

Thanks for any comments.
Hadassa


-- 
Hadassa Brunschwig
PhD Student
Department of Statistics
The Hebrew University of Jerusalem
http://www.stat.huji.ac.il



More information about the R-SIG-Mac mailing list