[ADOL-C] matlab mex linking error

Kshitij Kulshreshtha kshitij at math.upb.de
Thu Feb 24 12:27:47 EST 2011


Hello Sang,

As on 2011-02-24 17:10, Sang Ok Song did write:
> Hi,
> 
> When I try to compile the matlab interface, I get the following error:
> 
> -> gcc-4.0 -O -Wl,-twolevel_namespace -undefined error -arch x86_64 - 
> Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version- 
> min=10.5 -bundle -Wl,-exported_symbols_list,/Applications/ 
> MATLAB_R2009b.app/extern/lib/maci64/mexFunction.map -o   
> "simulate_cvmodel_sens.mexmaci64"  simulate_cvmodel_sens.o getPars.o  
> runmodel_sens.o cvmodel_sens.o cvmodel.o  -L/opt/sundials-2.3.0/lib -L/ 
> opt/adolc/lib64 -lsundials_cvodes -lsundials_nvecserial -ladolc -L/ 
> Applications/MATLAB_R2009b.app/bin/maci64 -lmx -lmex -lmat -lstdc++
> 
> Undefined symbols:
>    "adtl::ADOLC_numDir", referenced from:
>        adtl::setNumDir(unsigned int)in cvmodel_sens.o
>        adtl::setNumDir(unsigned int)in cvmodel_sens.o
>        cvmodel_sens(int, double, _generic_N_Vector*,  
> _generic_N_Vector*, _generic_N_Vector**, _generic_N_Vector**, void*,  
> _generic_N_Vector*, _generic_N_Vector*)in cvmodel_sens.o
>        cvmodel_sens(int, double, _generic_N_Vector*,  
> _generic_N_Vector*, _generic_N_Vector**, _generic_N_Vector**, void*,  
> _generic_N_Vector*, _generic_N_Vector*)in cvmodel_sens.o
>        cvmodel_sens(int, double, _generic_N_Vector*,  
> _generic_N_Vector*, _generic_N_Vector**, _generic_N_Vector**, void*,  
> _generic_N_Vector*, _generic_N_Vector*)in cvmodel_sens.o
>        cvmodel_jac(long, _DenseMat*, double, _generic_N_Vector*,  
> _generic_N_Vector*, void*, _generic_N_Vector*, _generic_N_Vector*,  
> _generic_N_Vector*)in cvmodel_sens.o
>        cvmodel_jac(long, _DenseMat*, double, _generic_N_Vector*,  
> _generic_N_Vector*, void*, _generic_N_Vector*, _generic_N_Vector*,  
> _generic_N_Vector*)in cvmodel_sens.o
>        cvmodel_jac(long, _DenseMat*, double, _generic_N_Vector*,  
> _generic_N_Vector*, void*, _generic_N_Vector*, _generic_N_Vector*,  
> _generic_N_Vector*)in cvmodel_sens.o
>        vlved(adtl::adouble, adtl::adouble, adtl::adouble,  
> adtl::adouble, adtl::adouble, adtl::adouble, adtl::adouble)in  
> cvmodel_sens.o
>        vlved(adtl::adouble, adtl::adouble, adtl::adouble,  
> adtl::adouble, adtl::adouble, adtl::adouble, adtl::adouble)in  
> cvmodel_sens.o
>        vlved(adtl::adouble, adtl::adouble, adtl::adouble,  
> adtl::adouble, adtl::adouble, adtl::adouble, adtl::adouble)in  
> cvmodel_sens.o
>        vlved(adtl::adouble, adtl::adouble, adtl::adouble,  
> adtl::adouble, adtl::adouble, adtl::adouble, adtl::adouble)in  
> cvmodel_sens.o
>        vlved(adtl::adouble, adtl::adouble, adtl::adouble,  
> adtl::adouble, adtl::adouble, adtl::adouble, adtl::adouble)in  
> cvmodel_sens.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
> 
>      mex: link of ' "simulate_cvmodel_sens.mexmaci64"' failed.
> 
> It seems to me that it may be a problem of liking to libadolc, but I  
> have no idea why.
> If you need more specific information about this mexing, let me know.
> Your help would be really appreciated.

It seems you code in cvmode_sens.o is calling the tapeless vector
version of the adouble datatype. In this case you need to have something
like

#define ADOLC_TAPELESS
#define NUMBER_DIRECTIONS 3  // the 3 can be any other value
#define DYNAMIC_DIRECTIONS   // this one is optional
#include <adolc/adouble.h>

ADOLC_TAPELESS_UNIQUE_INTERNALS

using adtl::adouble;

in your code to compile successfully. If you #define DYNAMIC_DIRECTIONS
then the value of NUMBER_DIRECIONS is not used (but it must be defined)
instead you must call setNumDir(p) before any adoubles are created.
Otherwise NUMBER_DIRECTIONS is the upper bound on how many directional
derivatives will be propagated.

I hope this helps. Also look at the example in
ADOL-C/examples/tapeless_vector.cpp


-- 
Dr. Kshitij Kulshreshtha

Institut für Mathematik,
Universität Paderborn,
Warburger Straße 100,
33098 Paderborn.

Büro: A3.235

Privatanschrift:
Arnikaweg 62
33100 Paderborn.



More information about the ADOL-C mailing list