Robotips / uConfig

Datasheet pinout extractor from PDF and library Stylizer for Kicad.
GNU General Public License v3.0
516 stars 58 forks source link

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

Open Exorcismus opened 5 years ago

Exorcismus commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

Exorcismus commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

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