PDA

View Full Version : Trouble using Poppler libs with QT Creator on Mac



runikovoor
26th July 2011, 14:36
Hi Guys,

I am having some trouble with using the Poppler libs(for PDF rendering) with my QT Creator project in Mac 10.6.8.

I downloaded the poppler source and configured things with the help of cmake. Then I ran "make install" to install the poppler libraries. In my QT Creator
project I have the below lines as code :

QString test("/Users/***/Desktop/WhiteBox.pdf");
Poppler::Document* temp =Poppler::Document::load(test);

below is the error I get while compiling:

Undefined symbols for architecture x86_64:
"Poppler::Document::load(QString const&, QByteArray const&, QByteArray const&)", referenced from:
MainWindow::MainWindow(QWidget*)in mainwindow.o
ld: symbol(s) not found for architecture x86_64
make: Leaving directory `/Users/****/PDFRenderExample-build-desktop'
collect2: ld returned 1 exit status
make: *** [PDFRenderExample.app/Contents/MacOS/PDFRenderExample] Error 1
The process "/usr/bin/make" exited with code 2.
Error while building project PDFRenderExample (target: Desktop)
When executing build step 'Make'


It would be really helpful if someone could point out the mistake I am doing and advice me with a solution for the same.

Thanks in advance!!!

high_flyer
27th July 2011, 16:01
Undefined symbols for architecture x86_64:
Are you on a 32bit or 64bit machine?

mavenlin
15th November 2011, 06:32
Hi, I think I have the same problem with you. When I try to link the poppler in macport, I keeps getting the error. And I don't think it is really the architecture problem, because all macports librarys are compiled from source and uses the x64 version compiler.

So I tried to compile poppler step by step, I use macport to install all the dependencies need by poppler.
However, for poppler itself, I don't use macport, I downloaded the newest version. and cmake it.
When cmaking there is also x86_64 problem in making the cxx wrapper. It is caused by the iconv library on mac.
By default It uses the iconv in /usr/lib, for some reason the native libiconv on mac has something wrong. (If you google it you will see people trying to compile PHP but also fail on the iconv lib).
So I modify the FindIconv.cmake file to use the iconv located under /opt/local/lib.
And that works out.

I think it is because when installing poppler from macport there is no problem because macport uses the its own iconv.
But when creating a project to link poppler in Qt creator, it will by default use the iconv in /usr/lib. That's why it fails to work.

Hope this is useful to you.

One thing to add is that don't try to replace the system native iconv. It seems that some people did it and nothing happens.
But I tried to do that, and my lion stuck at the startup screen, I have to reinstall the system.