Bug 7107 - Windows portability fixes
Summary: Windows portability fixes
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Windows (All)
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-03 14:31 UTC by Krzysztof Kowalczyk
Modified: 2010-07-12 15:20 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
patch for windows portability fixes (10.01 KB, patch)
2006-06-03 14:32 UTC, Krzysztof Kowalczyk
Details | Splinter Review
alternative patch for VC7/8 and Windows support (6.80 KB, patch)
2006-06-03 17:45 UTC, Reece Dunn
Details | Splinter Review
Fixes for compilation using cygwin/mingw (1.97 KB, patch)
2006-10-09 16:49 UTC, Peter Johanson
Details | Splinter Review
fixes for building with cmake/mingw (2.06 KB, patch)
2010-03-20 13:28 UTC, Patrick Spendrin
Details | Splinter Review
0001-qt4-define-poppler_qt4_EXPORTS-when-building-with-au.patch (827 bytes, patch)
2010-06-30 02:53 UTC, Hib Eris
Details | Splinter Review
0002-qt4-Fix-cross-compiling-for-Windows-with-autotools.patch (941 bytes, patch)
2010-06-30 02:55 UTC, Hib Eris
Details | Splinter Review
0003-win32-Check-for-_WIN32-instead-of-_MSC_VER.patch (1.54 KB, patch)
2010-07-02 06:10 UTC, Hib Eris
Details | Splinter Review
0004-win32-Use-MAX_PATH-instead-of-_MAX_PATH-everywhere.patch (2.16 KB, patch)
2010-07-02 06:11 UTC, Hib Eris
Details | Splinter Review
0005-autotools-Set-ansi-compiler-flag-early-in-configure..patch (1.67 KB, patch)
2010-07-02 06:12 UTC, Hib Eris
Details | Splinter Review
0006-autotools-Check-for-declaration-of-gettimeofday.patch (1.86 KB, patch)
2010-07-02 06:12 UTC, Hib Eris
Details | Splinter Review
0007-autotools-Fix-compile-warnings-on-auto-imports-for-m.patch (1.42 KB, patch)
2010-07-02 06:13 UTC, Hib Eris
Details | Splinter Review
0007-autotools-Fix-compile-warnings-on-auto-imports-for-m.patch (2.79 KB, patch)
2010-07-03 08:36 UTC, Hib Eris
Details | Splinter Review
0008-poppler-Only-define-findModifier-when-used.patch (1000 bytes, patch)
2010-07-03 08:37 UTC, Hib Eris
Details | Splinter Review
0009-glib-Only-define-filename_g-when-used.patch (1.03 KB, patch)
2010-07-03 08:38 UTC, Hib Eris
Details | Splinter Review

Description Krzysztof Kowalczyk 2006-06-03 14:31:33 UTC
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
Comment 1 Krzysztof Kowalczyk 2006-06-03 14:32:12 UTC
Created attachment 5799 [details] [review]
patch for windows portability fixes
Comment 2 Reece Dunn 2006-06-03 17:45:31 UTC
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.
Comment 3 Peter Johanson 2006-10-09 16:49:04 UTC
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.
Comment 4 Patrick Spendrin 2008-10-05 10:29:53 UTC
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.
Comment 5 Carlo Bramini 2009-01-13 00:56:17 UTC
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.
Comment 6 Pino Toscano 2010-03-20 10:26:39 UTC
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!
Comment 7 Patrick Spendrin 2010-03-20 12:40:11 UTC
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
Comment 8 Patrick Spendrin 2010-03-20 13:23:47 UTC
(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.
Comment 9 Patrick Spendrin 2010-03-20 13:28:51 UTC
Created attachment 34268 [details] [review]
fixes for building with cmake/mingw

These are the fixes I spoke about
Comment 10 Pino Toscano 2010-03-22 03:43:23 UTC
(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.
Comment 11 Patrick Spendrin 2010-03-24 14:50:36 UTC
(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).
Comment 12 Hib Eris 2010-06-30 02:53:31 UTC
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.
Comment 13 Hib Eris 2010-06-30 02:55:55 UTC
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.
Comment 14 Hib Eris 2010-07-02 06:10:32 UTC
Created attachment 36682 [details] [review]
0003-win32-Check-for-_WIN32-instead-of-_MSC_VER.patch

Some patches for ansi compiler compliance
Comment 15 Hib Eris 2010-07-02 06:11:17 UTC
Created attachment 36683 [details] [review]
0004-win32-Use-MAX_PATH-instead-of-_MAX_PATH-everywhere.patch
Comment 16 Hib Eris 2010-07-02 06:12:04 UTC
Created attachment 36684 [details] [review]
0005-autotools-Set-ansi-compiler-flag-early-in-configure..patch
Comment 17 Hib Eris 2010-07-02 06:12:28 UTC
Created attachment 36685 [details] [review]
0006-autotools-Check-for-declaration-of-gettimeofday.patch
Comment 18 Hib Eris 2010-07-02 06:13:00 UTC
Created attachment 36686 [details] [review]
0007-autotools-Fix-compile-warnings-on-auto-imports-for-m.patch
Comment 19 Hib Eris 2010-07-03 08:36:06 UTC
Created attachment 36725 [details] [review]
0007-autotools-Fix-compile-warnings-on-auto-imports-for-m.patch

Improved patch
Comment 20 Hib Eris 2010-07-03 08:37:59 UTC
Created attachment 36726 [details] [review]
0008-poppler-Only-define-findModifier-when-used.patch
Comment 21 Hib Eris 2010-07-03 08:38:30 UTC
Created attachment 36727 [details] [review]
0009-glib-Only-define-filename_g-when-used.patch
Comment 22 Albert Astals Cid 2010-07-12 15:20:33 UTC
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.