Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to link poppler-qt5 when building on windows #26

Open
Exorcismus opened this issue Apr 4, 2019 · 7 comments
Open

How to link poppler-qt5 when building on windows #26

Exorcismus opened this issue Apr 4, 2019 · 7 comments
Labels

Comments

@Exorcismus
Copy link

Am trying to build the project on windows and using Qt creator, currently am stuck @building pdf_extract, I download the DLLs and header files as you mentioned, I add DLLs files to "dll" directory and added poppler folder to project

and this is the pdf_extract.pro content

QT     += core gui widgets xml

TARGET = pdf_extract
TEMPLATE = lib
DEFINES += DATASHEET_EXTRACTOR_EXPORT_LIB
DESTDIR = "$$PWD/../../bin"

CONFIG(release, debug|release) {
    CONFIG += optimize_full
}

SOURCES += \
    $$PWD/datasheet.cpp \
    $$PWD/datasheetpackage.cpp \
    $$PWD/datasheetpin.cpp \
    $$PWD/datasheetbox.cpp \
    $$PWD/pdfdebugwidget/pdfdebugwidget.cpp \
    $$PWD/pdfdebugwidget/pdfdebugviewer.cpp \
    $$PWD/pdfdebugwidget/pdfdebugscene.cpp \
    $$PWD/pdfdebugwidget/pdfdebugitempage.cpp \
    $$PWD/pdfdebugwidget/pdfdebugitempin.cpp \
    $$PWD/pdfdebugwidget/pdfdebugitemtextbox.cpp \
    $$PWD/model/pdfdatasheet.cpp \
    $$PWD/model/pdfpage.cpp \
    $$PWD/model/pdftextbox.cpp \
    $$PWD/model/pdfpin.cpp \
    $$PWD/model/pdfcomponent.cpp \
    $$PWD/controller/pdfloader.cpp

HEADERS += \
    $$PWD/pdf_extract_common.h \
    $$PWD/datasheet.h \
    $$PWD/datasheetpackage.h \
    $$PWD/datasheetpin.h \
    $$PWD/datasheetbox.h \
    $$PWD/pdfdebugwidget/pdfdebugwidget.h \
    $$PWD/pdfdebugwidget/pdfdebugviewer.h \
    $$PWD/pdfdebugwidget/pdfdebugscene.h \
    $$PWD/pdfdebugwidget/pdfdebugitempage.h \
    $$PWD/pdfdebugwidget/pdfdebugitempin.h \
    $$PWD/pdfdebugwidget/pdfdebugitemtextbox.h \
    $$PWD/model/pdfdatasheet.h \
    $$PWD/model/pdfpage.h \
    $$PWD/model/pdftextbox.h \
    $$PWD/model/pdfpin.h \
    $$PWD/model/pdfcomponent.h \
    $$PWD/controller/pdfloader.h 

LIBS += -L"$$PWD/../../bin"
**LIBS += -L"$$PWD/dll/"**

INCLUDEPATH += $$PWD/../../
**INCLUDEPATH += $$PWD/dll/**

LIBS += -lkicad

macx {
    LIBS += -L /usr/local/lib
    INCLUDEPATH += /usr/local/include 
}

but it keeps throwing the below

image

can you share with me how to do it properly ?

@Exorcismus
Copy link
Author

seems I had to change the format of linking to be as below

LIBS += -L"$$PWD/../../bin"
LIBS+= $$PWD/dll/jpeg62.dll
LIBS+= $$PWD/dll/libfreetype-6.dll
LIBS+= $$PWD/dll/libopenjp2.dll
LIBS+= $$PWD/dll/libpng12.dll
LIBS+= $$PWD/dll/libpoppler-80.dll
LIBS+= $$PWD/dll/libpoppler-qt5.dll
LIBS+= $$PWD/dll/libtiff3.dll
LIBS+= $$PWD/dll/zlib1.dll

progressing now

@sebcaux
Copy link
Member

sebcaux commented Apr 4, 2019

You do not need to change the .pro file. Just uncompressed the bin-poppler-win32.tar.gz archive to uconfig/bin directory

@Exorcismus
Copy link
Author

Exorcismus commented Apr 7, 2019

@sebcaux , thanks alot for the clarification, I did that but now I get the error
-1: error: skipping incompatible bin/libpoppler-qt5.dll when searching for -lpoppler-qt5
noting that the one found in bin is named libpoppler-qt5.dll not poppler-qt5, shall I update it in .pro file ?

@sebcaux
Copy link
Member

sebcaux commented Apr 7, 2019

I forgot to precise, this poppler build is for a mingw compiller in 32bits mode. You probably use another one.

And for linked argument, you need to always remove extension of the library and replace lib prefix by -l argument. That is why to link with libpoppler-qt5.dll you need to give -lpoppler-qt5

@Exorcismus
Copy link
Author

Exorcismus commented Apr 7, 2019

@sebcaux , Thanks Alot, compiled with no errors. yet the application crashes when I try to start it
18:01:59: The process "C:\Qt\5.6.3\Tools\mingw492_32\bin\mingw32-make.exe" exited normally. 18:01:59: Elapsed time: 00:08.
the contents of bin forlder are
jpeg62.dll kicad.dll libfreetype-6.dll libkicad.a libopenjp2.dll libpdf_extract.a libpng12.dll libpoppler-80.dll libpoppler-qt5.dll libtiff3.dll pdf_extract.dll test.exe uconfig.exe uconfig_gui.exe zlib1.dll
the error message is
the application was unable to start correctly 0xc00007b

I did also run windeployqt.exe uconfig_gui.exe and it generated required DLLs, but still same issue

@Exorcismus Exorcismus reopened this Apr 7, 2019
@Exorcismus
Copy link
Author

After trying different things, it seems the application runs in debug mode in Qt creator, but same error appears when I run the program either from Qt creator or generated .exe

@Exorcismus
Copy link
Author

Exorcismus commented Apr 8, 2019

After trying different things, it seems the application runs in debug mode in Qt creator, but same error appears when I run the program either from Qt creator or generated .exe

After searching ... the reason was I had another verion x64 of Qt installed and /bin was added to system path.
I have uninstalled that and rebuild the application but now I get this error

image

Am not sure of the issue, but when I copied all folders(iconengine, translations, printsupport, etc..) and DLLs(Qts) from the pre-build binary version of your application the exe worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants