Hi Dirk,

ldd is not bringing up csparse which suggests that it is a linking  
problem.  For liking I used both the SHLIB and INSTALL comands using - 
L (see below), but both generate the same problem.

Cheers,

Jarrod

[jarrod@localhost ~]$ R CMD SHLIB ~/Work/AManal2/src/SStest.cc -L/ 
home/jarrod/My_Programs/SuiteSparse/CSparse/Lib -lcsparse
g++ -I/usr/lib/R/include -I/usr/lib/R/include  -I/usr/local/ 
include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 - 
fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 - 
march=i386 -mtune=generic -fasynchronous-unwind-tables -c /home/ 
jarrod/Work/AManal2/src/SStest.cc -o /home/jarrod/Work/AManal2/src/ 
SStest.o
/home/jarrod/Work/AManal2/src/SStest.cc: In function ‚Äòvoid SStest 
(int*, int*, double*, int*, int*)‚Äô:
/home/jarrod/Work/AManal2/src/SStest.cc:18: warning: unused variable  
‚ÄòiA‚Äô
/home/jarrod/Work/AManal2/src/SStest.cc:19: warning: unused variable  
‚ÄòpA‚Äô
/home/jarrod/Work/AManal2/src/SStest.cc:20: warning: unused variable  
‚ÄòxA‚Äô
g++ -shared -L/usr/local/lib -o /home/jarrod/Work/AManal2/src/ 
SStest.so /home/jarrod/Work/AManal2/src/SStest.o -L/home/jarrod/ 
My_Programs/SuiteSparse/CSparse/Lib -lcsparse  -L/usr/lib/R/lib -lR

 >dyn.load("~/Work/AManal2/src/SStest.so")
Error in dyn.load("~/Work/AManal2/src/SStest.so") :
   unable to load shared library '/home/jarrod/Work/AManal2/src/ 
SStest.so':
   /home/jarrod/Work/AManal2/src/SStest.so: undefined symbol:  
_Z10cs_spallociiiii


[jarrod@localhost ~]$ R CMD INSTALL -l ~/Desktop  ~/Work/AManal2
* Installing *source* package 'AManal' ...
** libs
g++ -I/usr/lib/R/include -I/usr/lib/R/include -I/home/jarrod/ 
My_Programs/SuiteSparse/CSparse/Include -I/usr/local/include    - 
fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack- 
protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic - 
fasynchronous-unwind-tables -c SStest.cc -o SStest.o
SStest.cc: In function ‚Äòvoid SStest(int*, int*, double*, int*, int*) 
‚Äô:
SStest.cc:18: warning: unused variable ‚ÄòiA‚Äô
SStest.cc:19: warning: unused variable ‚ÄòpA‚Äô
SStest.cc:20: warning: unused variable ‚ÄòxA‚Äô
g++ -shared -L/usr/local/lib -o AManal.so SStest.o -L/home/jarrod/ 
My_Programs/SuiteSparse/CSparse/Lib -lcsparse  -L/usr/lib/R/lib -lR
** R
** data
** preparing package for lazy loading
** help
  >>> Building/Updating help pages for package 'AManal'
      Formats: text html latex example
** building package indices ...
* DONE (AManal)

library("AManal", lib.loc="~/Desktop")
Error in dyn.load(file, ...) :
   unable to load shared library '/home/jarrod/Desktop/AManal/libs/ 
AManal.so':
   /home/jarrod/Desktop/AManal/libs/AManal.so: undefined symbol:  
_Z10cs_spallociiiii
Error: package/namespace load failed for 'AManal'

On 3 Dec 2007, at 16:57, Dirk Eddelbuettel wrote:

>
> On 3 December 2007 at 14:54, Jarrod Hadfield wrote:
> | I'm trying to load some C++ code using dyn.load but I'm getting
> | unresolved symbols associated with some external libraries
> | (CSparse).  I gather this is something to do with linking as the the
> | code compiles fine.  However, I've passed
> |
> | -L/home/jarrod/My_Programs/SuiteSparse/CSparse/Lib -lcsparse
> |
> | to the complier (g++), either directly using R CMD SHLIB or as
> | PKG_LIBS in a Makevars file, and I cannot resolve the problem.  I'm
> | working with R 2.6.0 on fedora 6
> |
> | Any help would be appreciated.
>
> Can you show us your error message upon load?  What does ldd say  
> when pointed
> at your package's library?  How exactly is the linking done?
>
> Compare all that to a working library such as eg Matrix. That may  
> provide
> further clues.
>
> Hth, Dirk
>
> -- 
> Three out of two people have difficulties with fractions.
>


	[[alternative HTML version deleted]]

