Bug 19219 - Build DLL with mingw cross compiler
Summary: Build DLL with mingw cross compiler
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Windows (All)
: medium enhancement
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-21 09:52 UTC by Hib Eris
Modified: 2008-12-29 04:30 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
patch-1-Let_libtool_build_DLLs (521 bytes, patch)
2008-12-21 09:52 UTC, Hib Eris
Details | Splinter Review
patch-2-Fix_compile_warnings_on_auto_imports_for_mingw32 (2.12 KB, patch)
2008-12-21 09:53 UTC, Hib Eris
Details | Splinter Review
new-patch-1-Let_libtool_build_DLLs (503 bytes, patch)
2008-12-21 15:29 UTC, Hib Eris
Details | Splinter Review
patch-3-Let_compiler_figure_out_CDECL (1.14 KB, patch)
2008-12-23 09:58 UTC, Hib Eris
Details | Splinter Review

Description Hib Eris 2008-12-21 09:52:05 UTC
Hi,

To port Evince to Windows, I needed a poppler dll. Cross compiling poppler with the mingw32 compiler on Ubuntu did built static libraries, but failed to build DLLs.

It appeared that libtool needs to be told to build dll's when initialized. The first patch will do this, thus making it possible to cross compile poppler DLLs.

When linking to these DLLs, the linker automatically imports what needs to be imported for windows, but gives warnings about this if you do not give the --enable-auto-import option to the linker. The second patch will provide this option to the linker.
Comment 1 Hib Eris 2008-12-21 09:52:48 UTC
Created attachment 21357 [details] [review]
patch-1-Let_libtool_build_DLLs
Comment 2 Hib Eris 2008-12-21 09:53:08 UTC
Created attachment 21358 [details] [review]
patch-2-Fix_compile_warnings_on_auto_imports_for_mingw32
Comment 3 Albert Astals Cid 2008-12-21 15:10:31 UTC
The first patch gives me 

splash/Makefile.am:6: Libtool library used but `LIBTOOL' is undefined
splash/Makefile.am:6:   The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'
splash/Makefile.am:6:   to `configure.ac' and run `aclocal' and `autoconf' again.
splash/Makefile.am:6:   If `AC_PROG_LIBTOOL' is in `configure.ac', make sure
splash/Makefile.am:6:   its definition is in aclocal's search path.


make: *** [Makefile.in] Error 1

Comment 4 Hib Eris 2008-12-21 15:29:44 UTC
Created attachment 21369 [details] [review]
new-patch-1-Let_libtool_build_DLLs

Albert, can you try this patch? It uses older libtool syntax.
Maybe my libtool version is too new, or yours too old. Mine is version 2.2.4.
Comment 5 Hib Eris 2008-12-23 09:58:45 UTC
Created attachment 21441 [details] [review]
patch-3-Let_compiler_figure_out_CDECL

When cross compiling, I get the following warnings, indicating a problem with defining and re-defining the macro CDECL differently.

hiberis:mingw32> LIBTOOLFLAGS=--silent make -s
Making all in goo
Making all in fofi
Making all in splash
Making all in poppler
In file included from ../../poppler/GlobalParams.h:35,
                 from ../../poppler/SplashOutputDev.cc:37:
./poppler-config.h:80:1: warning: "CDECL" redefined
In file included from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/windows.h:48,
                 from ../../goo/gfile.h:37,
                 from ../../poppler/SplashOutputDev.cc:36:
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/windef.h:111:1: warning: this is the location of the previous definition
In file included from ../../goo/gmem.h:29,
                 from ../../poppler/GlobalParams.cc:45:
../poppler/poppler-config.h:80:1: warning: "CDECL" redefined
In file included from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/windows.h:48,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/rpc.h:2,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/objbase.h:3,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/ole2.h:9,
                 from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/shlobj.h:11,
                 from ../../poppler/GlobalParams.cc:43:
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/windef.h:111:1: warning: this is the location of the previous definition
In file included from ../../poppler/PDFDoc.cc:43:
./poppler-config.h:80:1: warning: "CDECL" redefined
In file included from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/windows.h:48,
                 from ../../poppler/PDFDoc.cc:40:
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/windef.h:111:1: warning: this is the location of the previous definition
Creating library file: .libs/libpoppler.dll.a
In file included from ../../poppler/GlobalParams.h:35,
                 from ../../poppler/CairoOutputDev.cc:44:
./poppler-config.h:80:1: warning: "CDECL" redefined
In file included from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/windows.h:48,
                 from ../../goo/gfile.h:37,
                 from ../../poppler/CairoOutputDev.cc:43:
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/windef.h:111:1: warning: this is the location of the previous definition
Making all in utils
Making all in glib
Making all in .
Creating library file: .libs/libpoppler-glib.dll.a
Making all in reference
Making all in demo
Making all in test
In file included from ../../poppler/Error.h:33,
                 from ../../test/perf-test.cc:47:
../poppler/poppler-config.h:80:1: warning: "CDECL" redefined
In file included from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/windows.h:48,
                 from ../../test/perf-test.cc:24:
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/windef.h:111:1: warning: this is the location of the previous definition
hiberis:mingw32> 



This patch will fix this. As indicated in the patch, I think CDECL should not be defined by poppler, but included from windef.h.

This patch will work when cross compiling on Ubuntu. I did not test it with mingw on windows, but do not expect any problems there. For Visual C compiler and/or Cmake, there are different versions of poppler-config.h in git, so those compilers do not use poppler-config.h.in I guess.
Comment 6 Albert Astals Cid 2008-12-26 13:28:38 UTC
Patches new-1 and 2 commited.
Comment 7 Albert Astals Cid 2008-12-28 14:00:28 UTC
Patch 3 commited.

I've only commited this patches to trunk, that is what will be poppler 0.12 not for future poppler 0.10.x versions, do you need them there too?
Comment 8 Hib Eris 2008-12-29 04:30:49 UTC
(In reply to comment #7)
> Patch 3 commited.

Thanks!

> I've only commited this patches to trunk, that is what will be poppler 0.12 not
> for future poppler 0.10.x versions, do you need them there too?

No, I do not need it for 0.10. Trunk is fine for me.



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.