Compilation Problems with GPL Code (pdf2xml)

I'm interested in compiling the GPL pdf2xml project provided by mobipocket.

The source code & info is publicly available here:

http://www.mobipocket.com/dev/pdf2xml/

I am running ubuntu 'hardy' and I was hoping to use gcc to comile the code, but being a total c++ newbie I ran into compiler messages that mean nothing to me:

Can anyone offer some advice?

Note I've removed the end of the output due to limit on forum text size...

$ gcc -I ./xpdf -I ./xpdf/fofi -I ./xpdf/goo -I ./xpdf/xpdf -I ./image/zlib -I ./image/png pdf2xml.cpp

pdf2xml.cpp: In member function ‘bool XmlOutput::load_from_pdf(GString&, GString&)’:
pdf2xml.cpp:497: warning: deprecated conversion from string constant to ‘char*’
pdf2xml.cpp: In member function ‘virtual void MbpOutputDev::drawString(GfxState*, GString*)’:
pdf2xml.cpp:823: warning: deprecated conversion from string constant to ‘char*’
pdf2xml.cpp:827: warning: deprecated conversion from string constant to ‘char*’
/tmp/ccKElOg8.o: In function `MbpOutputDev::compose_image_filename(GString&, int, char const*, GString&)':
pdf2xml.cpp:(.text+0x648): undefined reference to `GString::clear()'
pdf2xml.cpp:(.text+0x655): undefined reference to `GString::append(GString*)'
pdf2xml.cpp:(.text+0x663): undefined reference to `GString::append(char const*)'
pdf2xml.cpp:(.text+0x698): undefined reference to `GString::append(char)'
pdf2xml.cpp:(.text+0x6b0): undefined reference to `GString::append(char)'
pdf2xml.cpp:(.text+0x6bd): undefined reference to `GString::append(char const*)'
/tmp/ccKElOg8.o: In function `MbpOutputDev::append_coalesc_block(GString&, Rect const&, bool)':
pdf2xml.cpp:(.text+0x6f9): undefined reference to `GString::clear()'
pdf2xml.cpp:(.text+0x74c): undefined reference to `GString::append(char)'
pdf2xml.cpp:(.text+0x760): undefined reference to `GString::append(GString*)'
/tmp/ccKElOg8.o: In function `MbpOutputDev::save_png(GString&, unsigned int, unsigned int, unsigned int, unsigned char*, unsigned char, unsigned char, png_color_struct*, unsigned short)':
pdf2xml.cpp:(.text+0x805): undefined reference to `png_create_write_struct'
pdf2xml.cpp:(.text+0x82a): undefined reference to `png_create_info_struct'
pdf2xml.cpp:(.text+0x845): undefined reference to `png_destroy_write_struct'
pdf2xml.cpp:(.text+0x883): undefined reference to `png_destroy_write_struct'
pdf2xml.cpp:(.text+0x8b4): undefined reference to `png_destroy_write_struct'
pdf2xml.cpp:(.text+0x8e3): undefined reference to `png_set_write_fn'
pdf2xml.cpp:(.text+0x9c5): undefined reference to `png_set_bKGD'
pdf2xml.cpp:(.text+0x9e2): undefined reference to `png_set_pHYs'
pdf2xml.cpp:(.text+0xa3a): undefined reference to `png_set_IHDR'
pdf2xml.cpp:(.text+0xa73): undefined reference to `png_write_info'
pdf2xml.cpp:(.text+0xa7c): undefined reference to `png_set_interlace_handling'
pdf2xml.cpp:(.text+0xaaa): undefined reference to `png_write_row'
pdf2xml.cpp:(.text+0xacf): undefined reference to `png_write_end'
pdf2xml.cpp:(.text+0xadc): undefined reference to `png_destroy_write_struct'
/tmp/ccKElOg8.o: In function `file_flush_data(png_struct_def*)':
pdf2xml.cpp:(.text+0xb33): undefined reference to `png_error'
/tmp/ccKElOg8.o: In function `file_write_data(png_struct_def*, unsigned char*, unsigned long)':
pdf2xml.cpp:(.text+0xb88): undefined reference to `png_error'
/tmp/ccKElOg8.o: In function `MbpOutputDev::handle_string(GfxState*, GString*, double&, double&)':
pdf2xml.cpp:(.text+0xbe1): undefined reference to `GString::clear()'
pdf2xml.cpp:(.text+0xd33): undefined reference to `GString::append(char const*)'
pdf2xml.cpp:(.text+0xd4d): undefined reference to `GString::append(char const*)'
pdf2xml.cpp:(.text+0xd67): undefined reference to `GString::append(char const*)'
pdf2xml.cpp:(.text+0xd80): undefined reference to `GString::append(char)'
pdf2xml.cpp:(.text+0xd9c): undefined reference to `GString::append(char const*, int)'
/tmp/ccKElOg8.o: In function `MbpOutputDev::updateFont(GfxState*)':
pdf2xml.cpp:(.text+0x1179): undefined reference to `GString::cmp(GString*)'
pdf2xml.cpp:(.text+0x11d0): undefined reference to `GString::clear()'
pdf2xml.cpp:(.text+0x11e1): undefined reference to `GString::append(GString*)'
/tmp/ccKElOg8.o: In function `MbpOutputDev::~MbpOutputDev()':
pdf2xml.cpp:(.text+0x1221): undefined reference to `operator delete(void*)'
pdf2xml.cpp:(.text+0x124f): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x1266): undefined reference to `GList::~GList()'
pdf2xml.cpp:(.text+0x1287): undefined reference to `GList::~GList()'
pdf2xml.cpp:(.text+0x12a4): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x12c5): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x12e0): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x12ff): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x1350): undefined reference to `operator delete(void*)'
/tmp/ccKElOg8.o: In function `MbpOutputDev::~MbpOutputDev()':
pdf2xml.cpp:(.text+0x1395): undefined reference to `operator delete(void*)'
pdf2xml.cpp:(.text+0x13c3): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x13da): undefined reference to `GList::~GList()'
pdf2xml.cpp:(.text+0x13fb): undefined reference to `GList::~GList()'
pdf2xml.cpp:(.text+0x1418): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x1439): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x1454): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x1473): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x14c4): undefined reference to `operator delete(void*)'
/tmp/ccKElOg8.o: In function `MbpOutputDev::~MbpOutputDev()':
pdf2xml.cpp:(.text+0x1509): undefined reference to `operator delete(void*)'
pdf2xml.cpp:(.text+0x1537): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x154e): undefined reference to `GList::~GList()'
pdf2xml.cpp:(.text+0x156f): undefined reference to `GList::~GList()'
pdf2xml.cpp:(.text+0x158c): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x15ad): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x15c8): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x15e7): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x1638): undefined reference to `operator delete(void*)'
/tmp/ccKElOg8.o: In function `MbpOutputDev::MbpOutputDev(XmlOutput&, GString&)':
pdf2xml.cpp:(.text+0x168f): undefined reference to `GString::GString()'
pdf2xml.cpp:(.text+0x16c3): undefined reference to `GString::GString()'
pdf2xml.cpp:(.text+0x16d8): undefined reference to `GList::GList(int)'
pdf2xml.cpp:(.text+0x1705): undefined reference to `GString::GString()'
pdf2xml.cpp:(.text+0x171f): undefined reference to `GList::~GList()'
pdf2xml.cpp:(.text+0x173d): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x1758): undefined reference to `GString::~GString()'
/tmp/ccKElOg8.o: In function `MbpOutputDev::MbpOutputDev(XmlOutput&, GString&)':
pdf2xml.cpp:(.text+0x17d3): undefined reference to `GString::GString()'
pdf2xml.cpp:(.text+0x1807): undefined reference to `GString::GString()'
pdf2xml.cpp:(.text+0x181c): undefined reference to `GList::GList(int)'
pdf2xml.cpp:(.text+0x1849): undefined reference to `GString::GString()'
pdf2xml.cpp:(.text+0x1863): undefined reference to `GList::~GList()'
pdf2xml.cpp:(.text+0x1881): undefined reference to `GString::~GString()'
pdf2xml.cpp:(.text+0x189c): undefined reference to `GString::~GString()'
/tmp/ccKElOg8.o: In function `XmlOutput::add_metatag(char const*, GString*)':
pdf2xml.cpp:(.text+0x1a76): undefined reference to `operator new[](unsigned long)'
pdf2xml.cpp:(.text+0x1c8d): undefined reference to `operator delete[](void*)'
/tmp/ccKElOg8.o: In function `XmlOutput::load_from_pdf(GString&, GString&)':
pdf2xml.cpp:(.text+0x1e05): undefined reference to `operator new(unsigned long)'
pdf2xml.cpp:(.text+0x1e1d): undefined reference to `GlobalParams::GlobalParams(char*)'
pdf2xml.cpp:(.text+0x1e2b): undefined reference to `globalParams'
pdf2xml.cpp:(.text+0x1e32): undefined reference to `globalParams'
...
Last edited on
Looking only at the errors, I would hazard a guess that you aren't linking some library you need.
Here's one that occurs a lot:

pdf2xml.cpp:(.text+0x648): undefined reference to `GString::clear()'

This function seems to be defined in the file ./xpdf/goo/GString.cc at line 139

<snip>
GString *GString::clear() {
s[length = 0] = '\0';
resize(0);
return this;
}
</snip>

and I thought I had linked this in using the option: -I ./xpdf/goo

Topic archived. No new replies allowed.