Coder Social home page Coder Social logo

Comments (8)

paulvojta avatar paulvojta commented on June 22, 2024 3

The problem is on line 54: #ifndef ZIP_CODEC_ENCODE
In Version 0.10.1-1.2 of libzip-dev (on Ubuntu), the file /usr/include/zip.h defines ZIP_CODEC_ENCODE, but in Version 1.1.2-1.1 (on Debian), this is not defined.
One way to fix the bug would be to replace line 54 with something like
#if !(defined(ZIP_CODEC_ENCODE) || LIBZIP_VERSION_MAJOR > 0 || LIBZIP_VERSION_MINOR >= 10)
It would be better to have a test based solely on the version number, but I don't know what the cutoff is.

from ideviceinstaller.

sohgoh avatar sohgoh commented on June 22, 2024 1

Hi, I got same error with libzip 1.1.2 on OSX 10.12 Beta (16A201w).
The follow patch will get success to build and run ideviceinstaller command.

diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c
index f70ba25..e9c4a82 100644
--- a/src/ideviceinstaller.c
+++ b/src/ideviceinstaller.c
@@ -903,7 +903,7 @@ run_again:
                                        dstpath = NULL;

                                        zip_uint64_t zfsize = 0;
-                                       while (zfsize < zs.size) {
+                                       while (zfsize < (zip_int64_t)zs.size) {
                                                zip_int64_t amount = zip_fread(zfile, buf, sizeof(buf));
                                                if (amount == 0) {
                                                        break;
@@ -921,7 +921,7 @@ run_again:
                                                                total += written;
                                                        }
                                                        if (total != amount) {
-                                                               fprintf(stderr, "Error: wrote only %d of %" PRIi64 "\n", total, amount);
+                                                               fprintf(stderr, "Error: wrote only %d of %" PRIi64 "\n", total, (uint64_t)amount);
                                                                afc_file_close(afc, af);
                                                                zip_fclose(zfile);
                                                                free(dstpath);

from ideviceinstaller.

andrewmichaelsmith avatar andrewmichaelsmith commented on June 22, 2024

Also seeing this on Ubuntu 16.04 with libzip 1.0.1.

#38 was closed saying to use libzip >= 0.10, I assume the 1.0 libzip change is what broke this:

➜  ideviceinstaller git:(master) ✗ make
make  all-recursive
make[1]: Entering directory '/home/andrew/git/ideviceinstaller'
Making all in src
make[2]: Entering directory '/home/andrew/git/ideviceinstaller/src'
  CC       ideviceinstaller-ideviceinstaller.o
ideviceinstaller.c: In function ‘main’:
ideviceinstaller.c:906:20: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      while (zfsize < zs.size) {
                    ^
cc1: all warnings being treated as errors
➜  ideviceinstaller git:(master) ✗ dpkg -s libzip-dev
Package: libzip-dev
Status: install ok installed
Priority: optional
Section: libdevel
Installed-Size: 419
Maintainer: Ubuntu Developers <[email protected]>
Architecture: amd64
Multi-Arch: same
Source: libzip
Version: 1.0.1-0ubuntu1

The following patch will get it building but I then get the error Could not start com.apple.mobile.installation_proxy!, and I'm not clear if that's because of my tinkering with the build flags:

diff --git a/configure.ac b/configure.ac
index 52d2a5d..3839896 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,7 +55,7 @@ if test "x${have_lstat}" = "xyes" ; then
   AC_DEFINE([HAVE_LSTAT], 1, [Define if lstat syscall is supported])
 fi

-AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith  -Wwrite-strings -Wswitch-default -Wno-unused-parameter -Werror -g")
+AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith  -Wwrite-strings -Wswitch-default -Wno-unused-parameter -g")
 AC_SUBST(GLOBAL_CFLAGS)

 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])

from ideviceinstaller.

shusso avatar shusso commented on June 22, 2024

#53 seems to fix this issue for me using xcode8 GM

from ideviceinstaller.

paulvojta avatar paulvojta commented on June 22, 2024

The problem is lines 56-58 of src/ideviceinstaller.c. As mentioned on line 55, they are for old versions of libzip -- versions prior to 0.10. The file uses the presence of ZIP_CODEC_ENCODE to distinguish libzip version 0.10 from earlier versions. The problem, though, is that ZIP_CODEC_ENCODE was moved to the (non-public) header file zipint.h sometime after version 0.11.2c. So, if a newer version of libzip is being used, lines 56-58 are used, and cause compilation errors.
In case you want to check on your own, here's the diff (in the libzip mercurial web access repository) where ZIP_CODEC_ENCODE was added: https://hg.nih.at/libzip/diff/2d8141cb2fa3/lib/zip.h (dated 14 Feb 2009), and here it was removed (actually moved to a non-public file): https://hg.nih.at/libzip/diff/1e4d47d717ef/lib/zip.h (dated 10 Oct 2014).
As was noted by pachoo in pull request #65, the configure script requires version 0.10 or higher of libzip, so lines 56-58 are moot at best, and cause compile errors at worst.
In an earlier comment I recommended replacing line 54, but I now believe that it's better to delete lines 54-60. See attached patch.
ideviceinstaller.c.pat.txt

from ideviceinstaller.

tux-mind avatar tux-mind commented on June 22, 2024

The problem is the #define zip_uint64_t off_t at the beginning as @paulvojta already figured out.
I would like to add that would be sufficient to check the libzip version according to zip_stat.
It should do those defines if zlib version is less than 0.10 and the target value is not off_t but int.

from ideviceinstaller.

paulvojta avatar paulvojta commented on June 22, 2024

Yes, but line 20 of configure.ac already requires libzip version 0.10 or higher: PKG_CHECK_MODULES(libzip, libzip >= 0.10)
So ideviceinstaller won't build with a lower version.
Also, note: libzip != zlib.

from ideviceinstaller.

nikias avatar nikias commented on June 22, 2024

Fixed with #85

from ideviceinstaller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.