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

Build issues on Windows and Linux #15

Open
iondevsrl opened this issue Feb 9, 2017 · 17 comments
Open

Build issues on Windows and Linux #15

iondevsrl opened this issue Feb 9, 2017 · 17 comments
Labels
Milestone

Comments

@iondevsrl
Copy link

Hi,

First of all thanks for your work on QtPdfium.
I tried it on Linux and Windows and I have encountered the following issues:

  1. On Linux Ubuntu 16.04 64-bit with Qt version 5.5.1 and gcc version 5.4.0 the library itself can be built out of the box but when trying to use it there's a compile error message:

/src/pdfium/qpdfium.h:52:36: error: ‘>>’ should be ‘> >’ within a nested template argument list
QVector<QWeakPointer> m_pages;

In order to fix it, you need to change the incriminated line to:
QVector<QWeakPointer > m_pages;

  1. On Windows 10 64-bit with Qt 5.6.1 and MinGW compiler (gcc version 5.4.0, built by MSYS2 project) the compilation fails with the error message bellow.

Could you, please, add support for the MinGW compiler?

Thanks in advance for your help and best regards,
Ion

make[3]: Entering directory '/c/qtiplot/3rdparty/qtpdfium/src/pdfium'
g++ -c -pipe -fno-keep-inline-dllexport -march=nocona -mtune=core2 -Wa,-mbig-obj -O2 -std=c++1z -Wall -Wextra -fno-exceptions -frtti -DUNICODE -D__QT__ -DOPJ_STATIC -DPNG_PREFIX -DPNG_USE_READ_MACROS -DQT_NO_VERSION_TAGGING -DQT_BUILD_PDFIUM_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DFT2_BUILD_LIBRARY -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -IC:/msys64/mingw64/include/dbus-1.0 -IC:/msys64/mingw64/lib/dbus-1.0/include -IC:/msys64/mingw64/include/libxml2 -IC:/msys64/mingw64/include/freetype2 -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/libpng16 -IC:/msys64/mingw64/include/harfbuzz -IC:/msys64/mingw64/include/glib-2.0 -IC:/msys64/mingw64/lib/glib-2.0/include -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/mariadb -I../../include -I../../include/QtPdfium -IC:/qtiplot/3rdparty/qtpdfium/include/QtPdfium/5.5.0 -IC:/qtiplot/3rdparty/qtpdfium/include/QtPdfium/5.5.0/QtPdfium -Itmp -I../3rdparty/pdfium -I../3rdparty/pdfium/third_party/freetype/include -I../3rdparty/pdfium/third_party/freetype/include/freetype -IC:/msys64/mingw64/include/QtCore/5.6.1 -IC:/msys64/mingw64/include/QtCore/5.6.1/QtCore -IC:/msys64/mingw64/include/QtGui -IC:/msys64/mingw64/include/QtCore -I.moc/release -IC:/msys64/mingw64/share/qt5/mkspecs/win32-g++ -o .obj/release/fpdfview.o ../3rdparty/pdfium/fpdfsdk/fpdfview.cpp
In file included from ../3rdparty/pdfium/core/fpdfapi/parser/cpdf_indirect_object_holder.h:15:0,
from ../3rdparty/pdfium/core/fpdfapi/parser/cpdf_array.h:16,
from ../3rdparty/pdfium/fpdfsdk/fpdfview.cpp:15:
../3rdparty/pdfium/core/fpdfapi/parser/cpdf_object.h:117:34: warning: unused parameter 'src' [-Wunused-parameter]
CPDF_Object(const CPDF_Object& src) {}
^
../3rdparty/pdfium/core/fpdfapi/parser/cpdf_object.h:117:34: warning: unused parameter 'src' [-Wunused-parameter]
../3rdparty/pdfium/fpdfsdk/fpdfview.cpp: In function 'FPDF_BOOL FPDF_SetPrintPostscriptLevel(int)':
../3rdparty/pdfium/fpdfsdk/fpdfview.cpp:447:3: error: 'g_pdfium_print_postscript_level' was not declared in this scope
g_pdfium_print_postscript_level = postscript_level;
^
../3rdparty/pdfium/fpdfsdk/fpdfview.cpp: In function 'void FPDF_RenderPage(HDC, FPDF_PAGE, int, int, int, int, int, int)':
../3rdparty/pdfium/fpdfsdk/fpdfview.cpp:681:46: error: 'CFX_WindowsDevice' was not declared in this scope
pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsDevice>(dc);
^
../3rdparty/pdfium/fpdfsdk/fpdfview.cpp:681:67: error: no matching function for call to 'MakeUnique(HDC__*&)'
pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsDevice>(dc);

@pinaraf
Copy link
Contributor

pinaraf commented Feb 9, 2017

I just reported a compilation issue when using MSVC++ under windows. Current master does not compile under windows so far. Could you try an older revision, 4201c6a ? This could help pinpoint the issue…

@iondevsrl
Copy link
Author

I've just tried to compile using the revision you indicated and qmake complains about missing files.
Do you have other suggestion?

@pinaraf
Copy link
Contributor

pinaraf commented Feb 10, 2017

Did you also update the submodule ? It should build fine, or at least not complain about missing files…

@iondevsrl
Copy link
Author

You're right, after updating the submodule the error message about missing files disappears, but I get a compile error, first error line shown bellow:

./3rdparty/pdfium/core/src/fxcrt/../../include/fxcrt/fx_system.h:126:25: error: expected unqualified-id before 'void'
#define FXSYS_snprintf (void) snprintf

After I edit the header file fx_system.h in order to fix this error I get a 2nd error message, which is the same that I get when I try to compile QtPdf module (https://github.com/qt-labs/qtpdf):

../3rdparty/pdfium/core/src/fxcrt/fx_basic_util.cpp:172:21: error: 'Printf_format_string' has not been declared
Printf_format_string const char* fmt

@paulovap
Copy link
Owner

Hey! @iondevsrl @pinaraf I don't have a Windows nor Linux machine at the moment, so I can only test on Mac/iOS/Android. I will try to setup an old notebook to fix this. But PRs are also greatly appreciated!

@paulovap paulovap added the bug label Feb 11, 2017
@paulovap paulovap added this to the v1.0 milestone Feb 11, 2017
@pinaraf
Copy link
Contributor

pinaraf commented Feb 11, 2017

I don't have any issue building on Linux with G++ 6.3.0 / Qt 5.7. But I will have to target Windows users and I must use MSVC++, so I can help cover these two targets.

@iondevsrl
Copy link
Author

As explained in my initial post, the fix for gcc 5.4 on Linux is very simple. The error message is:

/src/pdfium/qpdfium.h:52:36: error: ‘>>’ should be ‘> >’ within a nested template argument list

Therefore all you have to do is add a space character.

On Windows I can only use MinGW and I can also help with builds and testing for this compiler.

By the way, would you be interested in having QtPdfium work with Qt4?
Just with a few extra #if QT_VERSION < 0x050000 lines I was able to get it work on Linux.

@pinaraf
Copy link
Contributor

pinaraf commented Feb 12, 2017

'>>' vs '> >' is a classical C++ gotcha related to C++11/14. I think the code is missing a CONFIG += c++11 in the corresponding qmake files.

@coooooooorey
Copy link

@iondevsrl did you succeed on building on Windows?

I tried this project two years ago on Windows and OS X, and submitted the first issue. It's all good then.
Now it works fine on OS X, but it's really hard to build on Windows. I'm using msvc2015 Qt 5.9.

@paulovap
Copy link
Owner

Hi @coooooooorey, unfortunately, I don't have a Windows machine anymore, so it is hard to me to test on Windows. Can you send me the error message?

@coooooooorey
Copy link

I think it's the Marco issue.

It's looking for some Linux headers on windows

@coooooooorey
Copy link

It seems like some functions on windows didn't implement

@weis
Copy link

weis commented Sep 11, 2017

Hi coooooooorey,
with Qt 5.6.2, MSVC2015, 32bit I have done following steps:

  1. git bash console:
    git clone --recursive https://github.com/paulovap/qtpdfium
  2. Qt Creator:
    2.1 Open qtpdfium.pro, choose above kit,
    2.2 Run qmake
    2.3 Build project

Produced hundreds of warning, but no errors. All libs are placed in the output path.

@aquiles2k
Copy link

I managed to build it with some changes on win msys2 mingw with qt 5.9.1. @paulovap is there any chance you'll ever update the pdfium code? It seems its from 2015.

@paulovap
Copy link
Owner

paulovap commented Nov 5, 2017

@aquiles2k hey there. I don't have the time to update the project since I am not using it anymore, but I would welcome patches to keep it up to date. I also don't have a Windows machine, so its hard for me to make sure it is working on every platform. I would love to review your changes!

@Vadixem
Copy link

Vadixem commented Nov 29, 2017

qtpdf_compile_bug_2
Trying to compile on windows 10 x64 using qtcreator 4.1 and mscv2015_x32 I get 10 issues about missing file, lurking through filetree I found that file.
\qtpdf\src\3rdparty\pdfium\third_party\freetype\src\base\ftglyph.c:31: error: C1083: Cannot open include file: 'ft2build.h': No such file or directory
Please see picture attached. I don't know what to do
qtpdf_compile_bug

@JeromeDesfieux
Copy link

I have same issue as you Vadixem.
Did you find a solution?

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

8 participants