List Archive


Thread Index


From: Boaz Stolk <>
To: Thomas Klausner <>
Subject: RE: Seek error when libzip is compiled with CMake
Date: Fri, 22 Jan 2016 17:06:31 +0000


I think I found the reason and a possible solution.

zipconf.h defines ZIP_INT64_MIN as -0x8000000000000000LL, but comparing a 
positive zip_int64_t for smaller than (<) ZIP_INT64_MIN always evaluates to 

This is exactly what is going on in _zip_fseek() at 

If I cast ZIP_FSEEK_MIN to (zip_int64_t) here everything seems to work as 

I think it may be related to something like this: 

I've also first tried your suggestion with largefile support, but that doesn't 
fix it. Also if I remove the AC_SYS_LARGEFILE from and recompile 
using configure generated Makefiles the issue doesn't occur. However there must 
be a compiler setting, flag or generated file that is different from cmake, I'm 
just not able to find it..

This is the code I found on the Internet to define the appropriate _LARGE_FILES 
(only the ac_sys_largefile function)


-----Original Message-----
From: Thomas Klausner [] 
Sent: 20 January 2016 23:24
To: Boaz Stolk
Subject: Re: Seek error when libzip is compiled with CMake

On Wed, Jan 20, 2016 at 03:42:25PM +0000, Boaz Stolk wrote:
> I am encountering the following issue when libzip is compiled with the 
> Makefiles that CMake has generated.
> When I do a zip_fopen_index on an (successfully opened archive), 
> zip_fopen_index returns NULL and the error is: Seek error: Value too large 
> for defined data type.
> Note that this does *not* occur when I build libzip using autoconf / 
> configure.
> System:
> CentOS 6.6 (Final)
> Kernel Linux 2.6.32-504.16.2.el6.x86_64

The intention was to provide CMake for Windows and let the other systems that 
can deal with it use the configure script, that's why you see problems like 

In this particular case, I think autoconf is smart enough to test for various 
#defines that might be necessary to get proper large file support (see 
--enable-largefile). I think it tries _FILE_OFFSET_BITS and _LARGE_FILES. I 
guess one or both might be needed on CentOS?

If you are interested in this, perhaps you can come up with a patch for the 
cmake files that checks for these as well?


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.

Made by MHonArc.