Hello,
I am trying to compile poppler-0.16.7 on Fedora 15. mingw32-configure fails to link libopenjpeg: checking for opj_cio_open in -lopenjpeg... no checking openjpeg.h usability... yes checking openjpeg.h presence... yes checking for openjpeg.h... yes
Why? But running mingw32-cmake instead of mingw32-configure enables libopenjpeg support.
Later it fails: In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/winnt.h:192:0, from /usr/i686-pc-mingw32/sys-root/mingw/include/windef.h:253, from /home/nerijus/rpmbuild/BUILD/poppler-0.16.7/poppler/poppler-config.h:83, from /home/nerijus/rpmbuild/BUILD/poppler-0.16.7/poppler/Error.h:33, from /home/nerijus/rpmbuild/BUILD/poppler-0.16.7/goo/JpegWriter.cc:17: /usr/i686-pc-mingw32/sys-root/mingw/include/basetsd.h:52:13: error: conflicting declaration 'typedef int INT32' /usr/i686-pc-mingw32/sys-root/mingw/include/jmorecfg.h:164:14: error: 'INT32' has a previous declaration as 'typedef long int INT32'
It is a known problem, I know wxWidgets have workaround for it. Which one should I use?
Regards, Nerijus
On Thu, 7 Jul 2011 04:04:08 +0300 Nerijus Baliunas nerijus@users.sourceforge.net wrote:
I am trying to compile poppler-0.16.7 on Fedora 15. mingw32-configure fails to link libopenjpeg: checking for opj_cio_open in -lopenjpeg... no checking openjpeg.h usability... yes checking openjpeg.h presence... yes checking for openjpeg.h... yes
Why?
config.log: configure:19021: checking for opj_cio_open in -lopenjpeg configure:19046: i686-pc-mingw32-g++ -o conftest.exe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -mms-bitfields conftest.cpp -lopenjpeg >&5 /tmp/cc08LQZR.o: In function `main': /home/nerijus/rpmbuild/BUILD/poppler-0.16.7/conftest.cpp:41: undefined reference to `_opj_cio_open' collect2: ld returned 1 exit status configure:19046: $? = 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "poppler" | #define PACKAGE_TARNAME "poppler" | #define PACKAGE_VERSION "0.16.7" | #define PACKAGE_STRING "poppler 0.16.7" | #define PACKAGE_BUGREPORT "https://bugs.freedesktop.org/enter_bug.cgi?product=poppler" | #define PACKAGE_URL "" | #define PACKAGE "poppler" | #define VERSION "0.16.7" | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define LT_OBJDIR ".libs/" | #define OPI_SUPPORT 1 | #define MULTITHREADED 1 | #define TEXTOUT_WORD_LIST 1 | #define HAVE_PTHREAD 1 | #define ENABLE_RELOCATABLE 1 | #define POPPLER_DATADIR "/usr/i686-pc-mingw32/sys-root/mingw/share/poppler" | #define HAVE_DIRENT_H 1 | #define HAVE_GETTIMEOFDAY 1 | /* end confdefs.h. */ | | /* Override any GCC internal prototype to avoid an error. | Use char because int might match the return type of a GCC | builtin and then its argument prototype would still apply. */ | #ifdef __cplusplus | extern "C" | #endif | char opj_cio_open (); | int | main () | { | return opj_cio_open (); | ; | return 0; | } configure:19055: result: no configure:19065: checking openjpeg.h usability
But running mingw32-cmake instead of mingw32-configure enables libopenjpeg support.
But I still like to use mingw32-configure, because it enables glib support which I need. "ccmake ." has WITH_GLIB ON, but after running mingw32-cmake at the end it writes: glib wrapper: no
Regards, Nerijus
On 07/07/2011 04:04 AM, Nerijus Baliunas wrote:
I am trying to compile poppler-0.16.7 on Fedora 15. mingw32-configure fails to link libopenjpeg: checking for opj_cio_open in -lopenjpeg... no checking openjpeg.h usability... yes checking openjpeg.h presence... yes checking for openjpeg.h... yes
Why? But running mingw32-cmake instead of mingw32-configure enables libopenjpeg support.
Probably a bug in poppler's configure script.
Later it fails: In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/winnt.h:192:0, from /usr/i686-pc-mingw32/sys-root/mingw/include/windef.h:253, from /home/nerijus/rpmbuild/BUILD/poppler-0.16.7/poppler/poppler-config.h:83, from /home/nerijus/rpmbuild/BUILD/poppler-0.16.7/poppler/Error.h:33, from /home/nerijus/rpmbuild/BUILD/poppler-0.16.7/goo/JpegWriter.cc:17: /usr/i686-pc-mingw32/sys-root/mingw/include/basetsd.h:52:13: error: conflicting declaration 'typedef int INT32' /usr/i686-pc-mingw32/sys-root/mingw/include/jmorecfg.h:164:14: error: 'INT32' has a previous declaration as 'typedef long int INT32'
It is a known problem, I know wxWidgets have workaround for it. Which one should I use?
That would be a bug in mingw32-openjpeg. Public openjpeg headers shouldn't redefine types from WIN32 headers.
Nerijus Baliunas schreef op do 07-07-2011 om 04:04 [+0300]:
Hello,
I am trying to compile poppler-0.16.7 on Fedora 15. mingw32-configure fails to link libopenjpeg: checking for opj_cio_open in -lopenjpeg... no checking openjpeg.h usability... yes checking openjpeg.h presence... yes checking for openjpeg.h... yes
Why? But running mingw32-cmake instead of mingw32-configure enables libopenjpeg support.
Apparently the configure script of poppler tries to find a function named opj_cio_open in the openjpeg library, but fails to do so. I'm not familiar with openjpeg, but it might be possible that the version of openjpeg bundled in Fedora is too old or broken. Adam Goode (http://fedoraproject.org/wiki/User:Agoode) is the package maintainer of mingw32-openjpeg. Perhaps he can help you with this?
Later it fails: In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/winnt.h:192:0, from /usr/i686-pc-mingw32/sys-root/mingw/include/windef.h:253, from /home/nerijus/rpmbuild/BUILD/poppler-0.16.7/poppler/poppler-config.h:83, from /home/nerijus/rpmbuild/BUILD/poppler-0.16.7/poppler/Error.h:33, from /home/nerijus/rpmbuild/BUILD/poppler-0.16.7/goo/JpegWriter.cc:17: /usr/i686-pc-mingw32/sys-root/mingw/include/basetsd.h:52:13: error: conflicting declaration 'typedef int INT32' /usr/i686-pc-mingw32/sys-root/mingw/include/jmorecfg.h:164:14: error: 'INT32' has a previous declaration as 'typedef long int INT32'
This is a known issue which is completely unrelated to openjpeg. As the configure check for openjpeg failed, the poppler configure script decided to use mingw32-libjpeg as fallback.
The conflict happens when some .c file tries to #include both basetsd.h and jmorecfg.h. Both contain a declaration for the INT32 data type. To workaround it you can try to strip the #include <basetsd.h> from the file JpegWriter.cc (perhaps other files are affected too).
In Fedora Rawhide this problem is already solved in a more proper way. Recently, the package mingw32-libjpeg was replaced by mingw32-libjpeg-turbo. Several (upstreamed!) changes have been done to prevent these kind of conflicts. If it's possible, I would recommend you to use the mingw32 packages which are currently in Fedora Rawhide.
Kind regards,
Erik van Pienbroek
On Sat, 09 Jul 2011 16:29:55 +0200 Erik van Pienbroek erik@vanpienbroek.nl wrote:
In Fedora Rawhide this problem is already solved in a more proper way. Recently, the package mingw32-libjpeg was replaced by mingw32-libjpeg-turbo. Several (upstreamed!) changes have been done to prevent these kind of conflicts. If it's possible, I would recommend you to use the mingw32 packages which are currently in Fedora Rawhide.
mingw32-libjpeg-turbo helped, thanks. But I was unable to compile later because of:
CXX CairoFontEngine.lo In file included from CairoFontEngine.cc:38:0: CairoFontEngine.h:36:22: fatal error: cairo-ft.h: No such file or directory
Why freetype support is disabled in mingw32-cairo? I recompiled it with the following patch and then was able to build poppler:
--- mingw32-cairo.spec.orig 2011-04-28 14:17:55.000000000 +0300 +++ mingw32-cairo.spec 2011-07-13 18:36:58.260028908 +0300 @@ -29,6 +29,7 @@ BuildRequires: mingw32-pixman BuildRequires: mingw32-libpng BuildRequires: mingw32-iconv +BuildRequires: mingw32-freetype BuildRequires: mingw32-zlib BuildRequires: mingw32-glib2 BuildRequires: pkgconfig @@ -71,7 +72,6 @@ --enable-png \ --enable-static \ --disable-pthread \ - --disable-ft \ --enable-gobject make %{?_smp_mflags}
@@ -102,6 +102,8 @@ %{_mingw32_libdir}/libcairo-script-interpreter.dll.a %{_mingw32_libdir}/libcairo-script-interpreter.la %{_mingw32_libdir}/pkgconfig/cairo-gobject.pc +%{_mingw32_libdir}/pkgconfig/cairo-fc.pc +%{_mingw32_libdir}/pkgconfig/cairo-ft.pc %{_mingw32_libdir}/pkgconfig/cairo-pdf.pc %{_mingw32_libdir}/pkgconfig/cairo-png.pc %{_mingw32_libdir}/pkgconfig/cairo-ps.pc
Regards, Nerijus
Nerijus Baliunas schreef op wo 13-07-2011 om 23:45 [+0300]:
Why freetype support is disabled in mingw32-cairo? I recompiled it with the following patch and then was able to build poppler:
Freetype is disabled in cairo to avoid dependency bloat. If we enable it, then it will cause all gtk2/gtk3 applications to start depending on freetype and fontconfig (as the freetype + fontconfig dependencies will then be added to the cairo dll). This seems like an useless dependency to me as the entire gtk stack contains native implementations for the stuff that freetype and fontconfig provide, so that makes the use of freetype and fontconfig obsolete.
Up until now there hasn't been any application or library known to us which really depends on freetype support in cairo. I personally only see freetype and fontconfig as a temporary method to get applications and libraries working on win32 until there's native win32 support for font related stuff. Because of that I don't see a good reason to include freetype support in cairo.
I just did a checkout of the poppler code to see how dependent poppler really is on cairo-ft and I only found two calls to a cairo-ft specific function. The file poppler/CairoFontEngine.cc contains two calls to the cairo-ft function cairo_ft_font_face_create_for_ft_face. Perhaps you could ask upstream to implement a method to make these 2 calls optional (so that poppler still remains to work even if cairo-ft is missing) ?
Kind regards,
Erik van Pienbroek
On 07/14/2011 12:34 AM, Erik van Pienbroek wrote:
Nerijus Baliunas schreef op wo 13-07-2011 om 23:45 [+0300]:
Why freetype support is disabled in mingw32-cairo? I recompiled it with the following patch and then was able to build poppler:
Freetype is disabled in cairo to avoid dependency bloat.
It turned out that there are several apps besides poppler that need freetype support in cairo. Erik and I discussed this on IRC and we've now enabled cairo-fc and cairo-ft in Fedora 17 mingw32-cairo builds.
If we enable it, then it will cause all gtk2/gtk3 applications to start depending on freetype and fontconfig (as the freetype + fontconfig dependencies will then be added to the cairo dll).
We'll be able to get rid of the the extra freetype + fontconfig dependencies once we switch to the mingw-w64 toolchain, using delay loading. But for now, looks like we'll have to live with the extra deps to be able to support cairo-ft.
By the way, Nerijus, if you are interested in making a mingw32-poppler package and getting it in Fedora, I'd be happy to help. Just drop by the #fedora-mingw IRC channel on Freenode.