Wanting to use libxml2 in a c++ custom gnuradio block, I added #include <libxml/parser.h> and #include <libxml/tree.h> to the .h file.

At first it couldn’t find them, because they’re not installed under /usr/include, but instead under /usr/include/libxml2, so I had to create a symbolic link: sudo ln -s /usr/include/libxml2/libxml /usr/include/libxml (is this a bug???).

After that, it would compile and link successfully, but when I tried to load my block, I would get an ImportError: undefined symbol: xmlMemoryDump. After a looot of searching, I learned I have to add -lxml2 to the linker flags in Makefile.am (along with the pre-existing $(GNURADIO_CORE_LIBS), $(PYTHON_LDFLAGS), -lstdc++)…

Advertisements