Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 310209

Summary: sys-libs/zlib-1.2.4 installs broken zlib.h wrt largefile support on non-linux systems
Product: Gentoo Linux Reporter: Alexis Ballier <aballier>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: alt, kolcon, naota
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 316343    
Bug Blocks:    

Description Alexis Ballier gentoo-dev 2010-03-19 12:56:58 UTC
zlib.h now contains stuff like:

#ifdef _LARGEFILE64_SOURCE
   ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
   ZEXTERN off64_t ZEXPORT gzseek64 OF((gzFile, off64_t, int));
   ZEXTERN off64_t ZEXPORT gztell64 OF((gzFile));
   ZEXTERN off64_t ZEXPORT gzoffset64 OF((gzFile));
   ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, off64_t));
   ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off64_t));
#endif


afaik, off64_t is a glibc invention not to break the ABI for largefile support. We don't have it on FreeBSD and it breaks packages that try to #include it with lfs flags appended.
Comment 1 SpanKY gentoo-dev 2010-03-19 17:37:24 UTC
hmm, that's a pucker.  the fix might be to have configure detect LFS+off64_t support at configure time and then augment that _LARGEFILE64_SOURCE check with a 0/1 ...

could you try posting to the zlib list and see if they have a better idea ?
http://zlib.net/mailman/listinfo/zlib-devel_madler.net

i'm not sure of the off64_t origins, but it isnt specific to glibc.  all linux C libraries operate this way i believe.
Comment 2 Javier Villavicencio (RETIRED) gentoo-dev 2010-03-26 11:50:18 UTC
What about:

#if defined(_LARGEFILE64_SOURCE) && !(_FILE_OFFSET_BITS == 64)

?

Saw that on Solaris sources and looks like glibc itself also does that through features.h by setting __USE_LARGEFILE64 or __USE_FILE_OFFSET64.

So, if _FILE_OFFSET_BITS is 64 (the default on all BSDs), the off64_t types don't show up anywhere, and if it's not 64, and _LARGEFILE64_SOURCE was requested, the off64_t types get defined.
Comment 3 Javier Villavicencio (RETIRED) gentoo-dev 2010-03-27 07:27:36 UTC
Just for the record,
http://lists.freebsd.org/pipermail/freebsd-arch/2010-March/010057.html
FreeBSD discussion about the problem.
Comment 4 Javier Villavicencio (RETIRED) gentoo-dev 2010-03-31 14:22:18 UTC
Looks like the proper approach is being taken by upstream, they're following the spec down to the fine print and also checking that _LFS64_LARGEFILE is provided when _LARGEFILE64_SOURCE is requested.

See the new url.
Comment 5 Javier Villavicencio (RETIRED) gentoo-dev 2010-04-10 19:11:21 UTC
Newest tarball:
http://zlib.net/current/beta/zlib-1.2.4.2.tar.gz

It still fails on some cases, it needs
-#if _LARGEFILE64_SOURCES
+#if defined(_LARGEFILE64_SOURCES)
in 2 places.
Comment 6 Javier Villavicencio (RETIRED) gentoo-dev 2010-04-11 17:00:45 UTC
http://zlib.net/current/beta/zlib-1.2.4.3.tar.gz

This one is good.
Comment 7 Samuli Suominen (RETIRED) gentoo-dev 2010-04-20 11:46:15 UTC
1.2.5 (bug 316343)
Comment 8 SpanKY gentoo-dev 2010-04-20 12:50:08 UTC
zlib-1.2.5 now in the tree