From: Eric Prud'h. <er...@w3...> - 2010-08-18 08:18:19
|
* Josh Cherry <jc...@nc...> [2010-08-17 22:28-0400] > > > On Sat, 14 Aug 2010, Bryan Bishop wrote: > > > I am wrapping openNURBS for python consumption and want to fix some > > undefined symbols, which seem to be traced back to the _wrap.cxx file > > (the symbols aren't used in the wrapped library as far as I can tell). > > My work flow is as follows: > > > > swig -classic -cpperraswarn -c++ -python opennurbs.i > > gcc -c ../opennurbs/*.cpp opennurbs_wrap.cxx -I/usr/include/python2.5/ > > -I/usr/lib/python2.5/ -L. -lstdc++ -lpython2.5 -lopenNURBS -lGLU -lGL > > -lglut -lXmu -lXi -lXext -lX11 2>&1 > > gcc -z defs -shared libopenNURBS.a opennurbs_wrap.o -L. -lstdc++ > > -lpython2.5 -lopenNURBS -lGLU -lGL -lglut -lXmu -lXi -lXext -lX11 -o > > _opennurbs.so > > ldd -r _opennurbs.so > > > > When I run the ldd -r line I get this back: > > > > undefined symbol: > > _ZNK16ON_UuidIndexList5WriteER16ON_BinaryArchive (./_opennurbs.so) Make sure the symbol is located in e.g. one of your .o files: for f in *.o; do echo $f && objump -t $f | grep _ZNK16ON_UuidIndexList5WriteER16ON_BinaryArchive; done Here's an annotated example of me looking for some symbol: eric@ubu:~/checkouts/swobjects/bin$ for f in ../lib/RdfDB.o ../lib/ResultSet.o; do echo $f && objdump -t $f | grep _ZN6w3c_sw5RdfDB13bindVariablesEPNS_9ResultSetEPKNS_5TTermEPKNS_17BasicGraphPatternE; done ../lib/ParserCommon.o ../lib/RdfQueryDB.o 00000000 *UND* 00000000 _ZN6w3c_sw5RdfDB13bindVariablesEPNS_9ResultSetEPKNS_5TTermEPKNS_17BasicGraphPatternE ../lib/RdfDB.o 00001608 g F .text 00000511 _ZN6w3c_sw5RdfDB13bindVariablesEPNS_9ResultSetEPKNS_5TTermEPKNS_17BasicGraphPatternE ../lib/ResultSet.o It's undefined (*UND*) in RdfQueryDB.o; but at offset 1608 in RdfDB.o. Let's find out what the real function name is: eric@ubu:~/checkouts/swobjects/bin$ objdump -C -t ../lib/RdfDB.o | grep ^00001608 00001608 g F .text 00000511 w3c_sw::RdfDB::bindVariables(w3c_sw::ResultSet*, w3c_sw::TTerm const*, w3c_sw::BasicGraphPattern const*) > I would have guessed that those symbols are what the library provides. > Usually missing symbols mean that you need change your link line. I'm not > sure why you have libopenNURBS.a in addition to -lopenNURBS. Having > libopenNURBS.a before opennurbs_wrap.o might be the problem. While you're trying to understand the problem, don't be afraid to include -lopenNURBS multiple times in the link invocation. A link invocation of -lfoo -lbar -lfoo allows the linker to resolve foofunc1, which references barfunc1, which in turn references foofunc2. Such circularity is rare, but it's still a useful strategy to double your link line and whittle it back to the minimum. > Josh > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Swig-user mailing list > Swi...@li... > https://lists.sourceforge.net/lists/listinfo/swig-user -- -ericP |