List Archive

Thread

Thread Index

Message

From: Andrew Molyneux <andrew%molyneuxfamily.co.uk@localhost>
To: Lisa Matias <lisa.matias%gmail.com@localhost>
Subject: Re: Unable to build working Win32 libzip-1.1.3
Date: Wed, 11 Jan 2017 15:13:01 +0000

Hi Lisa,

On 11 January 2017 at 01:41, Lisa Matias <lisa.matias%gmail.com@localhost> wrote:
Has anyone had any success in building a Win32 (32 bit) port of libzip?

I have VC++ (from Visual Studio 9 2008) with cmake & cmake-gui, and zlib (zlibd.lib version 1.2.9) installed, and although I can build the libzip libraries, there are unusable when I link them with any application.

Specifically when I run any subsystem console application linked with zipstatic.lib or zip.lib + zip.dll, I get the following error:

The application has failed to start because its side-by-side configuration is incorrect.

Which in the event viewer shows as:

Activation context generation failed for "Z:\myziptest.exe.Manifest". Dependent Assembly Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" could not be found. Please use sxstrace.exe for detailed diagnosis.

Note that after getting this error, I have reinstalled the most current version of "vcredist_x86.exe", which is the Microsoft Visual C++ 2008 Redistributable Package (x86), but I am still getting this error.


I'm afraid I don't have VS2008, but I've just tried with VS2010 and it builds OK (apart from the strtoull and strtoll issue you also mentioned) and ziptool runs OK after building.
 
Does anyone have any detailed instructions on how to build libzip-1.1.3 for 32-bit windows?  After many attempts, I cannot get a proper build for it.

How did you try to build libzip? Did you follow the instructions in vstudio/readme.txt and use vsbuild.cmd?

 
Alternatively, if anyone was successful in building for Win32, could they please share the binaries?  Release static binaries with "zipstatic.lib" is preferred, but shared binaries with "zip.lib" & "zip.dll" is acceptable.

On a separate note, 

But ziptool does not link for me:

[ 88%] Linking C executable ziptool.exe
ziptool.c.obj : error LNK2019: unresolved external symbol _strtoll referenced in function _add_file
ziptool.c.obj : error LNK2019: unresolved external symbol _strtoull referenced in function _add_file
ziptool.exe : fatal error LNK1120: 2 unresolved externals

However starting in line 43 of src/ziptool.c if I change:

#ifdef _WIN32
/* WIN32 needs <fcntl.h> for _O_BINARY */
#include <fcntl.h>
#endif

to this:

#ifdef _WIN32
/* WIN32 needs <fcntl.h> for _O_BINARY */
#include <fcntl.h>
#define strtoull strtoul
#define strtoll  strtol
#endif

ziptool does build successfully.

But of course it still does not run, and gets the same side-by-side configuration error.


I believe VS2013 is the first version of Visual C++ that includes the C99 functions strtoull and strtoll. Earlier versions do have _strtoui64 and _strtoi64 though, which seem to be exactly equivalent, so this is probably the way to go:
#if (_MSVC_VER < 1800)
#define strtoull _strtoui64
#define strtoll _strtoi64
#endif

Note that I was able to successful build zlib and openssl, and link them into working console Win32 applications.  But I am only experiencing issues with libzip.

Thank you in advance.

Lisa.




Made by MHonArc.