[R-sig-ME] compiling CHOLMOD c code

Douglas Bates bates at stat.wisc.edu
Tue Aug 3 20:40:26 CEST 2010


On Tue, Jul 27, 2010 at 1:43 PM, Ryan King <c.ryan.king at gmail.com> wrote:
> Hello list,
> Like most mixed model implementations, my little project tries to use
> CHOLMOD for the underlying calculation.  I haven't had to use raw c
> libraries before.  Unfortunately, I need/want access to some CHOLMOD
> functions not used by Matrix or lme4.   My procedure was to make all
> the UF sparse suite packages into archives
> make in each of the following:
> UFconfig/
> CHOLMOD/Lib/
> AMD/Lib/
> CAMD/Lib/
> CCOLAMD/Lib/
> CHOLMOD/Lib/
> COLAMD/Lib/
> metis-4.0/Lib/
>
> then move the archives to my working directory and link the results all together
> R CMD SHLIB  *.a mylikec.c ../sparsesuite/metis-4.0/Lib/*.o -o
> bigsmush.so -llapack -lblas
>
> However, the result won't load
>
>> dyn.load("bigsmush.so")
> Error in dyn.load("bigsmush.so") :
>  unable to load shared library 'bigsmush.so':
>  bigsmush.so: undefined symbol: camd_malloc
>
>
> Grep says that camd_malloc is declared
> CAMD/Include/camd.h:329:EXTERN void *(*camd_malloc) (size_t) ;              /*
> pointer to malloc */
>
> and defined in both
> CAMD/Source/camd_global.c:51:void *(*camd_malloc) (size_t) = malloc ;

My guess is that this source file is very much like the
AMD/Source/amd_global.c file and the purpose of all these defines is
to accommodate incorporating these sources into Matlab.

> CHOLMOD/Partition/cholmod_camd.c:185:    camd_malloc = Common->malloc_memory ;
>
>
> as long as I don't compile with the -DNMALLOC option, which I don't
> think that I did.  Any help as to what I need to to?

Not really.  It is quite complicated trying to get all the CHOLMOD
pieces working with each other, which is one reason that Martin and I
decided to avoid the partitioning algorithms based on Metis.  (Also,
the last time we checked Metis is not available under an open source
license, which means we couldn't use it even if we could work out all
the linkage details.)

Generally the order in which you list object files for the linker is
important.  Linkers may have changed since I last looked at the
details but in the past they only did one pass over the object files
so if the reference to a particular symbol occurred after the
definition of the symbol it was not incorporated in the result.

The way that we did things in Matrix is to create archive (.a files)
from the CHOLMOD packages and then list those files in the link step.
Most versions of the ar program that creates archives put a symbol
table in the archive so that the order in which the files occur is
irrelevant.




More information about the R-sig-mixed-models mailing list