PDA

View Full Version : how can I add libpoppler plugin to my Qt4 project?



ahmetturan
29th January 2014, 15:17
I compiled Qt 4.8.5 statically.
I installed poppler to my linux system.
I added to pro file:


QTPLUGIN += poppler

and I added to main.cpp


Q_IMPORT_PLUGIN(poppler)

Also I added libpoppler.a and libpoppler.so to my project as a system library.

After I run project I get these errors:


.../main.cpp:-1: error: undefined reference to `qt_plugin_instance_poppler()'
:-1: error: collect2: ld returned 1 exit status

how can I add libpoppler plugin to my Qt4 project?

Thanks

anda_skoa
29th January 2014, 18:46
libpoppler is not a plugin, it is a normal library.

You link against it using LIBS

Cheers,
_

ahmetturan
31st January 2014, 08:39
Thank you @anda_skoa. My application works my computer and also other computers which Qt is not installed. But when I use a poppler function in other computers my application crashed. How can I add poppler statically to my ap

anda_skoa
31st January 2014, 10:21
Like any other static library.
Make sure it is found during the build and not a dynamic library version of itself and that all its dependencies are also available either as system libraries or also as static builds.

Cheers,
_

ahmetturan
3rd February 2014, 16:16
I compiled poppler statically with ./configure --enable-static & make & make install.

I add these line to my pro file:


unix:!macx:!symbian: LIBS += -L$$PWD/../../../../../../usr/local/lib/ -lpoppler-qt4

INCLUDEPATH += $$PWD/../../../../../../usr/include/poppler/qt4
DEPENDPATH += $$PWD/../../../../../../usr/include/poppler/qt4

unix:!macx:!symbian: PRE_TARGETDEPS += $$PWD/../../../../../../usr/local/lib/libpoppler-qt4.a

Also I copied needed so files(libpoppler-qt4.so and libpoppler.so)
app works in my computer and in other computer. but app crashed in poppler class in other computer with segmentation fault error.

Please help how can I add poppler to my app statically?

ChrisW67
3rd February 2014, 20:42
If you have a statically built Poppler, and you link against it, then you do not have any *.so files to deploy. If they still exist alongside a static version the linker will generally prefer them while building your application.

You also seem to be mixing the include files from a version of Poppler installed under /usr with the library from a version installed under /usr/local. This may not be a problem, or it might explain your original crashing problem.