- Unable to build working Win32 libzip-1.1.3, Lisa Matias (2017/01/11 01:41:05)
After manually hacking at libzip build files, and the make files generated by cmake, I was finally able to get a working release+static build with VC++ 2008 for libzip (zipstatic.lib), which I tested and works properly in my own application. Note that my application is built just with LIBCMT.LIB, not MSVCRT.LIB, but libzip defaults to using MSVCRT.LIB which was the cause of my previous side-by-side errors.
Specifically this meant removing all debug options and flags (such as replacing /MD with /MT), and disabling creation of shared targets: zip.dll & zip.lib, and enabling static targets: zipstatic.lib (especially in lib/CMakeLists.txt).
Unfortunately most of the hacks I did to get a working release+static build would not be appropriate to push back as a change-sets to the libzip repository, since it would likely break most other build targets.
I do think that you strtoull & strtoll fix is better than mine, and should be pushed back into the repo.
On 11 January 2017 at 07:13, Andrew Molyneux <andrew%molyneuxfamily.co.uk@localhost> wrote:
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,proces
sorArchitecture="x86",publicKe yToken="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.exeziptool.c.obj : error LNK2019: unresolved external symbol _strtoll referenced in function _add_fileziptool.c.obj : error LNK2019: unresolved external symbol _strtoull referenced in function _add_fileziptool.exe : fatal error LNK1120: 2 unresolved externalsHowever starting in line 43 of src/ziptool.c if I change:#ifdef _WIN32/* WIN32 needs <fcntl.h> for _O_BINARY */#include <fcntl.h>#endifto this:#ifdef _WIN32/* WIN32 needs <fcntl.h> for _O_BINARY */#include <fcntl.h>#define strtoull strtoul#define strtoll strtol#endifziptool 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#endifNote 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.