Another Swig question


#1

Hi,

I’ve got my own swig problem that I can’t seem to figure out. I’m sorry
this email is so long. I’m asking for swig help from the gnuradio group
because I didn’t think anyone else would understand the gnuradio block
build environment.

I’m trying to use the tinyxml++ code in my gnuradio blocks. tinyxml++
is just c++ code that you compile into your app, there is no lib to link
with. I added the cpp and h files to the same directory that holds my
gnuradio blocks, then I added the following to the Makefile.am:

_sm_la_SOURCES =

ticpp.cpp
tinystr.cpp
tinyxml.cpp
tinyxmlerror.cpp
tinyxmlparser.cpp

“make” and “make install” complete without errors - there are no
unresolved externals, etc…

I didn’t add anything to the sm.i file because I am not interested in
using the tinyxml++ code directly from python.

When I run my python code that imports the sm library, I get the
following error: “ImportError:
/usr/local/lib/python2.4/site-packages/gnuradio/_sm.so:
undefined symbol: _ZN5ticpp8Document11GetAsStringEv”

ticpp::Document::GetAsString is a function in the tinyxml++ code. I’m
don’t understand how python even knows about that function, because none
of the tinyxml++ header files are in my swig input file, and they are
not included by any of the header files that are in my swig input file.

I found documentation on this “undefined symbol” error on the swig.org
site (section 29.2.5 of the SWIG documentation), but it only says:

“This error usually indicates that you forgot to include some object
files or libraries in the linking of the shared library file. Make sure
you compile both the SWIG wrapper file and your original program into a
shared library file. Make sure you pass all of the required libraries to
the linker.”

If I had forgotten to include some object files, or libraries in the
linking of my block code, I would get an unresolved external error. I
don’t understand what’s wrong. Please give me a hint.

Thanks,
Hans