There are a few fixes needed for poppler to compile under windows (Visual Studio 2005). See atached patch for details. The patch does the following: * wrap parts that cannot be understood on win with #ifndef WIN32. That includes: * fontconfig-related code in GlobalParams.cc * #include <unistd.h> * fix warning that vc compiler finds * remove unused variables * consistently define SplashFontSrc as a class
Created attachment 5799 [details] [review] patch for windows portability fixes
Created attachment 5801 [details] [review] alternative patch for VC7/8 and Windows support I have added my (alternative) patch for building Poppler with MS VC 7 or 8. It requires some work to the poppler-config.h.in file as I have patched the .in file with my auto-generated one that works with VC, as I don't understand how autoconf/make work. This patch does not address any of the warnings and makes the FontConfig library optionally specifiable for other platfoms that may not have access to it.
Created attachment 7314 [details] [review] Fixes for compilation using cygwin/mingw To further muddy the waters, this patch with a few small tweaks was all I needed to change in poppler to get this building using cygwin (but using -mno-cygwin and passing --host=i686-pc-mingw32 --build=i686-pc-mingw32). I successfully built both libpoppler-1.dll and libpoppler-glib-1.dll with this, although the second part required tweaking my pangowin32.pc file to remove the -lgdi32 (as with this it, libtool refuseed to create a .dll file). Hope this helps for those folks looking to compile poppler on win32 via the cygwin/MSYS approach.
Some comments: The first patch doesn't take in account that there are fontconfig packages for windows - It should rather take the approach of Reece and disable the Fontconfig parts with a more specific flag. The problem about the alternative patch are the changes to CDECL macro - is that really needed? I can't really say anything about the third one, that might be mostly ok (if used under cygwin). Just to add one more thing: The 0.8.7 version of poppler does compile under windows with the Qt backend (when using fontconfig). We (as in the KDE on Windows team) maintain binaries for that purpose as well, so if you have any interest, come around. Nevertheless a build without fontconfig could be worth a thought.
About patch number 3: It's not a problem the addition of AC_LIBTOOL_WIN32_DLL (if you want to add it, it does not matter), but now it should be a deprecated way for getting shared library support under Win32 by long time. It is also more significant the next error: if you must also remove -lgdi32 for getting stuff working, it seems to confirm that you must really upgrade your libtool/autoconf/automake to a newer version, which will also solve your need of AC_LIBTOOL_WIN32_DLL. I do not know if something changed recently, but I compiled poppler-0.10.0 under Mingw+MSYS without troubles.
Hello dear Windows porters! currently, our git/master version (that is >= 0.13) has support for choosing the font configuration backend, and on Windows poppler does not use fontconfig anymore (unless explicitly chosen, but should not be the case). This, plus the various fixes we got in the last 3 years, should make many of the changes in the patches attached obsolete. Can you please report whether poppler (as of current today's git/master) compiles correctly (please do specify also the "Building Poppler with support for:" summary with the features built) in various Mingw+MSYS, MSVC, autotools and CMake combinations? In case it does not, patches are welcome. Thanks!
Number 1: msvc with cmake font configuration: win32 splash output: yes cairo output: yes abiword output: yes qt wrapper: no qt4 wrapper: yes glib wrapper: no use GDK: no cpp wrapper: yes use gtk-doc: not supported with this CMake build system use libjpeg: yes use libpng: yes use zlib: no use libopenjpeg: yes use cms: yes command line utils: yes
(the last build on msvc worked btw.) on mingw there are several bugs 1) in goo/gfile.cc _MAX_PATH probably can be defined to MAX_PATH (which is defined on mingw) 2) in poppler/Annot.cc strdup is used which seems to be a non-ansi extension according to mingw. This means that the -ansi keyword would need to be removed or a replacement be found (also _strdup is not defined). 3) in poppler/GlobalParamsWin.cc was an error about settings _WIN32_IE to at least 0x0500, so I did that. This fix is the only one that could be committed directly. configuration is: Building Poppler with support for: font configuration: win32 splash output: yes cairo output: no abiword output: yes qt wrapper: no qt4 wrapper: yes glib wrapper: no use GDK: no cpp wrapper: yes use gtk-doc: not supported with this CMake build system use libjpeg: yes use libpng: yes use zlib: no use libopenjpeg: yes use cms: yes command line utils: yes As I currently don't have autotools available, I cannot test with mingw+msys, maybe I can find somebody else if nobody has the time to do that.
Created attachment 34268 [details] [review] fixes for building with cmake/mingw These are the fixes I spoke about
(In reply to comment #8) > 1) in goo/gfile.cc _MAX_PATH probably can be defined to MAX_PATH (which is > defined on mingw) In goo/gfile.cc I see a limits.h included only on !_WIN32; do both MSVC and mingw provide it? Also, does it provide such _MAX_PATH, or should it be changed to the "classic" PATH_MAX? > 2) in poppler/Annot.cc strdup is used which seems to be a non-ansi extension > according to mingw. This means that the -ansi keyword would need to be removed > or a replacement be found (also _strdup is not defined). Hm ok, I'll move it to a Linux-only section. > 3) in poppler/GlobalParamsWin.cc was an error about settings _WIN32_IE to at > least 0x0500, so I did that. This fix is the only one that could be committed > directly. Fixed locally.
(In reply to comment #10) > (In reply to comment #8) > > 1) in goo/gfile.cc _MAX_PATH probably can be defined to MAX_PATH (which is > > defined on mingw) > > In goo/gfile.cc I see a limits.h included only on !_WIN32; do both MSVC and > mingw provide it? Also, does it provide such _MAX_PATH, or should it be changed > to the "classic" PATH_MAX? Hm, after some more investigation I found this: both mingw and msvc contain _MAX_PATH in stdlib.h - and after removing -ansi, this is fixed for mingw too (__STRICT_ANSI__ is around _MAX_PATH) > > > 2) in poppler/Annot.cc strdup is used which seems to be a non-ansi extension > > according to mingw. This means that the -ansi keyword would need to be removed > > or a replacement be found (also _strdup is not defined). > > Hm ok, I'll move it to a Linux-only section. thanks, this error got fixed. > > > 3) in poppler/GlobalParamsWin.cc was an error about settings _WIN32_IE to at > > least 0x0500, so I did that. This fix is the only one that could be committed > > directly. > > Fixed locally. > got fixed as well. Ok, One more thing to complain about: could you rename the folder test within the poppler main source directory to tests? This way it won't collide with the test target added by ctest on msvc. Until now, nmake test will tell you that test target is already up to date (the folder).
Created attachment 36628 [details] [review] 0001-qt4-define-poppler_qt4_EXPORTS-when-building-with-au.patch This is a patch to allow building of the qt4 bindings for Windows with autotools.
Created attachment 36629 [details] [review] 0002-qt4-Fix-cross-compiling-for-Windows-with-autotools.patch This patch fixes _cross_ compiling the qt4 binding for Windows using autotools.
Created attachment 36682 [details] [review] 0003-win32-Check-for-_WIN32-instead-of-_MSC_VER.patch Some patches for ansi compiler compliance
Created attachment 36683 [details] [review] 0004-win32-Use-MAX_PATH-instead-of-_MAX_PATH-everywhere.patch
Created attachment 36684 [details] [review] 0005-autotools-Set-ansi-compiler-flag-early-in-configure..patch
Created attachment 36685 [details] [review] 0006-autotools-Check-for-declaration-of-gettimeofday.patch
Created attachment 36686 [details] [review] 0007-autotools-Fix-compile-warnings-on-auto-imports-for-m.patch
Created attachment 36725 [details] [review] 0007-autotools-Fix-compile-warnings-on-auto-imports-for-m.patch Improved patch
Created attachment 36726 [details] [review] 0008-poppler-Only-define-findModifier-when-used.patch
Created attachment 36727 [details] [review] 0009-glib-Only-define-filename_g-when-used.patch
I've commited all the patches and i'm closing this bug, in the future if needed please open a new bug. BTW if something fails in this autohell changes i'll hunt you down until you fix it again :-P
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.