Bug 33710

Summary: 'make' for poppler-0.16.2 fails even though 'configure' is OK
Product: poppler Reporter: Sergei Steshenko <sergstesh>
Component: generalAssignee: poppler-bugs <poppler-bugs>
Status: NEW --- QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: autogenerated wrapper used to run 'configure'
the requested /mnt/sdb8/sergei/AFSWD_debug/install/libpng-1.4.5/include/libpng14/png.h
/mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h

Description Sergei Steshenko 2011-01-29 23:41:13 UTC
Created attachment 42706 [details]
autogenerated wrapper used to run 'configure'

Under exactly the same settings poppler-0.14.5 builds fine. Please see the attached autogenerated wrapper used to run 'configure'.

The failure is:

"
  CXX    libpoppler_cpp_la-poppler-image.lo
In file included from /mnt/sdb8/sergei/AFSWD_debug/install/libpng-1.4.5/include/libpng14/png.h:405,
                 from ../goo/PNGWriter.h:23,
                 from poppler-image.cpp:26:
/mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1583: error: declaration of C function 'off_t gzseek64(void*, off_t, int)' conflicts with
/mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1567: error: previous declaration 'off64_t gzseek64(void*, off64_t, int)' here
/mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1584: error: declaration of C function 'off_t gztell64(void*)' conflicts with
/mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1568: error: previous declaration 'off64_t gztell64(void*)' here
/mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1585: error: declaration of C function 'off_t gzoffset64(void*)' conflicts with
/mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1569: error: previous declaration 'off64_t gzoffset64(void*)' here
/mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1586: error: declaration of C function 'uLong adler32_combine64(uLong, uLong, off_t)' conflicts with
/mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1570: error: previous declaration 'uLong adler32_combine64(uLong, uLong, off64_t)' here
/mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1587: error: declaration of C function 'uLong crc32_combine64(uLong, uLong, off_t)' conflicts with
/mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1571: error: previous declaration 'uLong crc32_combine64(uLong, uLong, off64_t)' here
make[3]: *** [libpoppler_cpp_la-poppler-image.lo] Error 1
make[3]: Leaving directory `/mnt/sdb8/sergei/AFSWD_debug/build/poppler-0.16.2/cpp'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/mnt/sdb8/sergei/AFSWD_debug/build/poppler-0.16.2/cpp'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/mnt/sdb8/sergei/AFSWD_debug/build/poppler-0.16.2'
make: *** [all] Error 2
"
Comment 1 Albert Astals Cid 2011-01-30 02:15:57 UTC
Can you please attach your png.h system include?
Comment 2 Sergei Steshenko 2011-01-30 02:46:24 UTC
Created attachment 42708 [details]
the requested /mnt/sdb8/sergei/AFSWD_debug/install/libpng-1.4.5/include/libpng14/png.h
Comment 3 Sergei Steshenko 2011-01-30 02:47:35 UTC
Created attachment 42709 [details]
/mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h
Comment 4 Albert Astals Cid 2011-01-30 03:01:22 UTC
Your png.h seems fine.

There seems to be something wrong in your system in which it thinks 
  gzseek64(void*, off_t, int)
and 
  gzseek64(void*, off64_t, int)
are the same function. 

Sincerely i don't know what's the issue.
Comment 5 Sergei Steshenko 2011-01-30 03:11:39 UTC
(In reply to comment #4)
> Your png.h seems fine.
> 
> There seems to be something wrong in your system in which it thinks 
>   gzseek64(void*, off_t, int)
> and 
>   gzseek64(void*, off64_t, int)
> are the same function. 
> 
> Sincerely i don't know what's the issue.

Why can build without a problem poppler-0.14.5 ?
Comment 6 Albert Astals Cid 2011-01-30 03:39:08 UTC
Because there is no poppler-image.cpp in 0.14.

BTW i've changed the blocker to normal, that is there for us developers to use not for people reporting bugs. This might be a blocker for you, but is in no way a blocker for us since for the moment building poppler works for everyone except you so.
Comment 7 Sergei Steshenko 2011-01-30 03:46:26 UTC
I am using the same version of 'libpng' and of 'zlib' in a whole bunch of other targets - everything builds fine.

The two conflicting functions:

gzseek64(void*, off_t, int);
gzseek64(void*, off64_t, int);

can look the same to compiler if somehow 'off_t' and 'off64_t' are set to be the same type. Any ideas how this can happen ?
Comment 8 Sergei Steshenko 2011-01-30 07:03:01 UTC
(In reply to comment #4)
> Your png.h seems fine.
> 
> There seems to be something wrong in your system in which it thinks 
>   gzseek64(void*, off_t, int)
> and 
>   gzseek64(void*, off64_t, int)
> are the same function. 
> 
> Sincerely i don't know what's the issue.

Here is the relevant piece of 'zlib.h' file:

   1565 #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
   1566    ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
   1567    ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
   1568    ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
   1569    ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
   1570    ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
   1571    ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
   1572 #endif
   1573
   1574 #if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
   1575 #  define gzopen gzopen64
   1576 #  define gzseek gzseek64
   1577 #  define gztell gztell64
   1578 #  define gzoffset gzoffset64
   1579 #  define adler32_combine adler32_combine64
   1580 #  define crc32_combine crc32_combine64
   1581 #  ifdef _LARGEFILE64_SOURCE
   1582      ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
   1583      ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
   1584      ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
   1585      ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
   1586      ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
   1587      ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
   1588 #  endif
   1589 #else
   1590    ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
   1591    ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
   1592    ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
   1593    ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
   1594    ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
   1595    ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
   1596 #endif

- as one can see, the conflict which is between line #1567 and line #1583 (according to the error message) is quite possible - this is because conditions for the two lines to become active are _not_ mutually exclusive; the conditions are:

   1565 #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0

vs

   1574 #if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0

in conjunction with

   1581 #  ifdef _LARGEFILE64_SOURCE
.

Anybody has any idea how/by whom the conditions on lines #1565, #1574, #1581 are supposed to be set ?
Comment 9 Albert Astals Cid 2011-01-30 07:22:24 UTC
Gahh, i can't read :D

It is very interesting since if I diff my zlib.h and yours i get this

tsdgeos@ahtec:~$ diff -ub attachment.cgi\?id\=42709 /usr/include/zlib.h 
--- attachment.cgi?id=42709     2011-01-30 15:22:37.813333338 +0000
+++ /usr/include/zlib.h 2010-11-20 03:32:03.000000000 +0000
@@ -1578,7 +1578,7 @@
 #  define gzoffset gzoffset64
 #  define adler32_combine adler32_combine64
 #  define crc32_combine crc32_combine64
-#  ifdef _LARGEFILE64_SOURCE
+#  ifndef _LARGEFILE64_SOURCE
      ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
      ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
      ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));

So it seems your zlib.h is broken?
Comment 10 Sergei Steshenko 2011-01-30 07:40:41 UTC
(In reply to comment #9)
> Gahh, i can't read :D
> 
> It is very interesting since if I diff my zlib.h and yours i get this
> 
> tsdgeos@ahtec:~$ diff -ub attachment.cgi\?id\=42709 /usr/include/zlib.h 
> --- attachment.cgi?id=42709     2011-01-30 15:22:37.813333338 +0000
> +++ /usr/include/zlib.h 2010-11-20 03:32:03.000000000 +0000
> @@ -1578,7 +1578,7 @@
>  #  define gzoffset gzoffset64
>  #  define adler32_combine adler32_combine64
>  #  define crc32_combine crc32_combine64
> -#  ifdef _LARGEFILE64_SOURCE
> +#  ifndef _LARGEFILE64_SOURCE
>       ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
>       ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
>       ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
> 
> So it seems your zlib.h is broken?

(In reply to comment #0)
> Created an attachment (id=42706) [details]
> autogenerated wrapper used to run 'configure'
> 
> Under exactly the same settings poppler-0.14.5 builds fine. Please see the
> attached autogenerated wrapper used to run 'configure'.
> 
> The failure is:
> 
> "
>   CXX    libpoppler_cpp_la-poppler-image.lo
> In file included from
> /mnt/sdb8/sergei/AFSWD_debug/install/libpng-1.4.5/include/libpng14/png.h:405,
>                  from ../goo/PNGWriter.h:23,
>                  from poppler-image.cpp:26:
> /mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1583: error:
> declaration of C function 'off_t gzseek64(void*, off_t, int)' conflicts with
> /mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1567: error:
> previous declaration 'off64_t gzseek64(void*, off64_t, int)' here
> /mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1584: error:
> declaration of C function 'off_t gztell64(void*)' conflicts with
> /mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1568: error:
> previous declaration 'off64_t gztell64(void*)' here
> /mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1585: error:
> declaration of C function 'off_t gzoffset64(void*)' conflicts with
> /mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1569: error:
> previous declaration 'off64_t gzoffset64(void*)' here
> /mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1586: error:
> declaration of C function 'uLong adler32_combine64(uLong, uLong, off_t)'
> conflicts with
> /mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1570: error:
> previous declaration 'uLong adler32_combine64(uLong, uLong, off64_t)' here
> /mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1587: error:
> declaration of C function 'uLong crc32_combine64(uLong, uLong, off_t)'
> conflicts with
> /mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h:1571: error:
> previous declaration 'uLong crc32_combine64(uLong, uLong, off64_t)' here
> make[3]: *** [libpoppler_cpp_la-poppler-image.lo] Error 1
> make[3]: Leaving directory
> `/mnt/sdb8/sergei/AFSWD_debug/build/poppler-0.16.2/cpp'
> make[2]: *** [all-recursive] Error 1
> make[2]: Leaving directory
> `/mnt/sdb8/sergei/AFSWD_debug/build/poppler-0.16.2/cpp'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/mnt/sdb8/sergei/AFSWD_debug/build/poppler-0.16.2'
> make: *** [all] Error 2
> "

How can my 'zlib.h' be broken if it's installed by standard 'make install' ? I don't build manually, I don't change header files through tools unless I really do - not the case with 'zlib.h'.

Please note that I'm using zlib-1.2.5 - downloaded directly from one of sourceforge mirrors. The following:

"
sergei@amdam2:~/junk> diff /mnt/sdb8/sergei/AFSWD_debug/build/zlib-1.2.5/zlib.h /mnt/sdb8/sergei/AFSWD_debug/install/zlib-1.2.5/include/zlib.h
sergei@amdam2:~/junk> ls -ltr /mnt/sdb8/sergei/AFSWD_debug/build/zlib-1.2.5/zlib.h
-rw-r--r-- 1 qemu users 79564 2010-04-20 07:12 /mnt/sdb8/sergei/AFSWD_debug/build/zlib-1.2.5/zlib.h
"

shows that the installed (and attached here) 'zlib.h' is identical to the one inside the tarball (the /mnt/sdb8/sergei/AFSWD_debug/build/zlib-1.2.5/zlib.h file) and the file timestamp.

Please to download zlib-1.2.5 from sourceforge and compare 'zlib.h' with mine.
Comment 12 Sergei Steshenko 2011-01-30 09:22:48 UTC
(In reply to comment #11)
> Then zlib 1.2.5 is broken, you can see that distros patch it to work
> 
> http://pkgs.fedoraproject.org/gitweb/?p=zlib.git;a=blob;f=zlib-1.2.5-gentoo.patch;h=82c7f39732ddd8ab66a7ccb23ab4fdafadda847a;hb=HEAD
> 
> http://projects.archlinux.org/svntogit/packages.git/tree/zlib/trunk/zlib-1.2.5-lfs-decls.patch
> 
> http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-libs/zlib/files/zlib-1.2.5-lfs-decls.patch?revision=1.3&view=markup

Well, I do see there are patches. The question is, however: "what should be changed - 'zlib' or existing code ?".

I'll try to apply one of these patches.
Comment 13 Sergei Steshenko 2011-01-30 09:29:41 UTC
Please update the documentation, and/or (better yet) introduce a 'configure' check for this.
Comment 14 Albert Astals Cid 2011-01-30 14:20:11 UTC
Sorry, but i don't plan adding a check to see if the zlib version is broken. If you can prove this is the fault in our code i'll fix it. Also if you want to write that configure check, patches are welcome.
Comment 15 Sergei Steshenko 2011-01-30 23:44:12 UTC
(In reply to comment #14)
> Sorry, but i don't plan adding a check to see if the zlib version is broken. If
> you can prove this is the fault in our code i'll fix it. Also if you want to
> write that configure check, patches are welcome.

'configure' happily accepts stock zlib-1.2.5, and 'make' fails. So, 'configure' does not do its job of properly checking the prerequistes. For example, here is how part of XML-LibXML-1.70/Makefile.PL looks:

    115     my @blacklist = (
    116                      # format X,Y,Z,is_ok, X,Y,Z is version,
    117                      # is_ok applies also to *preceding* versions
    118                      [2,4,22,0],
    119                      [2,4,25,0], # broken XPath
    120                      [2,4,28,0], # unsupported, may work fine with earlier XML::LibXML versions
    121                      [2,4,29,0], # broken
    122                      [2,4,30,0], # broken
    123                      [2,5,0,0], # unsupported
    124                      [2,5,1,0], # all pre 2.5.4 version have broken attr output
    125                      [2,5,5,0], # tests pass, but known as broken
    126                      [2,5,11,0], # will partially work
    127                      [2,6,0,0], # unsupported
    128                      [2,6,4,0], # schema error
    129                      [2,6,5,0], # broken xincludes
    130                      [2,6,15,0],
    131                    # [2,6,16,1], # first version to pass all tests
    132                      [2,6,18,1], # up to 2.6.18 all ok
    133                      [2,6,19,0], # broken c14n
    134                      [2,6,20,0], # broken schemas
    135                      [2,6,24,1], # all tests pass
    136                      [2,6,25,0], # broken XPath
    137                      [2,6,32,1], # tested, works ok
    138                      [2,7,1,0], # broken release, broken utf-16
    139                      [2,7,6,1], # tested, ok
    140                     );
.

If adding a check to 'configure' is difficult, README file then can be updated with, say

stock zlib-1.2.5 is broken, see https://bugs.freedesktop.org/show_bug.cgi?id=33710 for details.

line.