Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Zip archive in Qt. How and which library better to use? QuaZIP? Libzip?



  • Hello all!

    I've got issue to manage encrypted Zip-files and need to do it cross-platform:
    -- I need to add/delete/change files or directories on-fly in zip-archive
    -- I need to get information about file in archive
    -- I need to change password for zip-archive

    Does QuaZip can do this things for encrypted files? I haven't found methods for it.

    I found plain C library - libzip. Does anyone use it? Is it Ok for mobile platforms. Is there any manuals for building it for Qt project?



  • @bogong Yes QuaZip is able to work with password protection (cf. http://quazip.sourceforge.net/classQuaZipFile.html)

    //Opens a file for reading. 
    bool QuaZipFile::open (OpenMode mode, const char *password);
    
    //Opens a file for reading. 
    bool QuaZipFile::open (OpenMode mode, int *method, int *level, bool raw, const char *password=NULL)
    
    

    I have used QuaZip for some projects, it do the job!



  • @KroMignon Thanks a lot for rapid reply. Checked it but not found the definition of encryption type. Is there ability to define the length of key for AES? Is there ability to use different type of compression algorithm?



  • @bogong I don't know, don't used this feature of QuaZip



  • @bogong Looking at QuaZip project page => https://sourceforge.net/p/quazip/feature-requests/19/

    It seems that AES is not yet supported but should be include in next release.



  • @KroMignon Then I have no any chance to use it. Will try to use libzip. This library already has AES but adding it to Qt Project looks like not trivial way.



  • QuaZip and KArchive are both wrappers around zlib and that library does not support encryption.

    If you want to use libzip, you can use the C++ wrapped version http://hg.markand.fr/libzip if, like me, do not like C style very much



  • @VRonin
    For me no matter which library to use. I need encryption. If you know alternative that might be used for encryption - it would be best to share opinion.

    For now I am trying to build libzip and got failed. I've been following all of instructions but still have this:

    Undefined symbols for architecture x86_64:
      "_crc32", referenced from:
          __zip_string_crc32 in libzipstatic.a(zip_string.c.o)
         (maybe you meant: __zip_string_crc32)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [plainc_libzip.app/Contents/MacOS/plainc_libzip] Error 1
    19:20:30: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project plainc_libzip (kit: Desktop Qt 5.12.1 clang 64bit)
    When executing step "Make"
    

    in *.pro file

    macx: LIBS += -L$$PWD/libs/libzip/ -lzipstatic
    ios: LIBS += -L$$PWD/libs/libzip/ -lzipstatic
    
    INCLUDEPATH += $$PWD/libs/libzip
    DEPENDPATH += $$PWD/libs/libzip
    
    macx: PRE_TARGETDEPS += $$PWD/libs/libzip/libzipstatic.a
    ios: PRE_TARGETDEPS += $$PWD/libs/libzip/libzipstatic.a
    

    Everything building passing all self tests but when I am trying to add it to QT project got this error. Dynamic library do not working too. I've got this when been trying to add it:

    19:50:49: Running steps for project plainc_libzip...
    19:50:49: Configuration unchanged, skipping qmake step.
    19:50:49: Starting: "/usr/bin/make" -j8
    /Users/alexandr/Applications/Qt5.12/5.12.1/clang_64/bin/qmake -o Makefile ../plainc_libzip/plainc_libzip.pro -spec macx-clang CONFIG+=debug CONFIG+=x86_64 CONFIG+=qml_debug
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -stdlib=libc++ -headerpad_max_install_names  -arch x86_64 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.12 -Wl,-rpath,@executable_path/Frameworks -Wl,-rpath,/Users/alexandr/Applications/Qt5.12/5.12.1/clang_64/lib -o plainc_libzip.app/Contents/MacOS/plainc_libzip main.o qrc_qml.o   -F/Users/alexandr/Applications/Qt5.12/5.12.1/clang_64/lib -lzip.5.0 -framework QtQuick -framework QtQml -framework QtNetwork -framework QtCore -framework DiskArbitration -framework IOKit -framework QtGui -framework OpenGL -framework AGL   
    ld: library not found for -lzip.5.0
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [plainc_libzip.app/Contents/MacOS/plainc_libzip] Error 1
    19:50:50: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project plainc_libzip (kit: Desktop Qt 5.12.1 clang 64bit)
    When executing step "Make"
    19:50:50: Elapsed time: 00:00.
    

    but in *.pro file I have this:

    macx: LIBS += -lzip.5.0
    

    For now nothing works. But it shell be! And I hope it will.



  • Did you build libzip for your compiler & architecture? Looking at the CI log looks like this library as well relies on zlib in a way or another



  • @VRonin In following libzip build logs - there should be OK.

    $ make
    Scanning dependencies of target zipstatic
    [  0%] Building C object lib/CMakeFiles/zipstatic.dir/zip_add.c.o
    [  0%] Building C object lib/CMakeFiles/zipstatic.dir/zip_add_dir.c.o
    [  0%] Building C object lib/CMakeFiles/zipstatic.dir/zip_add_entry.c.o
    [  1%] Building C object lib/CMakeFiles/zipstatic.dir/zip_algorithm_deflate.c.o
    [  1%] Building C object lib/CMakeFiles/zipstatic.dir/zip_buffer.c.o
    [  1%] Building C object lib/CMakeFiles/zipstatic.dir/zip_close.c.o
    [  1%] Building C object lib/CMakeFiles/zipstatic.dir/zip_delete.c.o
    [  1%] Building C object lib/CMakeFiles/zipstatic.dir/zip_dir_add.c.o
    [  1%] Building C object lib/CMakeFiles/zipstatic.dir/zip_dirent.c.o
    [  3%] Building C object lib/CMakeFiles/zipstatic.dir/zip_discard.c.o
    [  3%] Building C object lib/CMakeFiles/zipstatic.dir/zip_entry.c.o
    [  3%] Building C object lib/CMakeFiles/zipstatic.dir/zip_err_str.c.o
    [  3%] Building C object lib/CMakeFiles/zipstatic.dir/zip_error.c.o
    [  3%] Building C object lib/CMakeFiles/zipstatic.dir/zip_error_clear.c.o
    [  4%] Building C object lib/CMakeFiles/zipstatic.dir/zip_error_get.c.o
    [  4%] Building C object lib/CMakeFiles/zipstatic.dir/zip_error_get_sys_type.c.o
    [  4%] Building C object lib/CMakeFiles/zipstatic.dir/zip_error_strerror.c.o
    [  4%] Building C object lib/CMakeFiles/zipstatic.dir/zip_error_to_str.c.o
    [  4%] Building C object lib/CMakeFiles/zipstatic.dir/zip_extra_field.c.o
    [  4%] Building C object lib/CMakeFiles/zipstatic.dir/zip_extra_field_api.c.o
    [  6%] Building C object lib/CMakeFiles/zipstatic.dir/zip_fclose.c.o
    [  6%] Building C object lib/CMakeFiles/zipstatic.dir/zip_fdopen.c.o
    [  6%] Building C object lib/CMakeFiles/zipstatic.dir/zip_file_add.c.o
    [  6%] Building C object lib/CMakeFiles/zipstatic.dir/zip_file_error_clear.c.o
    [  6%] Building C object lib/CMakeFiles/zipstatic.dir/zip_file_error_get.c.o
    [  7%] Building C object lib/CMakeFiles/zipstatic.dir/zip_file_get_comment.c.o
    [  7%] Building C object lib/CMakeFiles/zipstatic.dir/zip_file_get_external_attributes.c.o
    [  7%] Building C object lib/CMakeFiles/zipstatic.dir/zip_file_get_offset.c.o
    [  7%] Building C object lib/CMakeFiles/zipstatic.dir/zip_file_rename.c.o
    [  7%] Building C object lib/CMakeFiles/zipstatic.dir/zip_file_replace.c.o
    [  9%] Building C object lib/CMakeFiles/zipstatic.dir/zip_file_set_comment.c.o
    [  9%] Building C object lib/CMakeFiles/zipstatic.dir/zip_file_set_encryption.c.o
    [  9%] Building C object lib/CMakeFiles/zipstatic.dir/zip_file_set_external_attributes.c.o
    [  9%] Building C object lib/CMakeFiles/zipstatic.dir/zip_file_set_mtime.c.o
    [  9%] Building C object lib/CMakeFiles/zipstatic.dir/zip_file_strerror.c.o
    [  9%] Building C object lib/CMakeFiles/zipstatic.dir/zip_filerange_crc.c.o
    [ 10%] Building C object lib/CMakeFiles/zipstatic.dir/zip_fopen.c.o
    [ 10%] Building C object lib/CMakeFiles/zipstatic.dir/zip_fopen_encrypted.c.o
    [ 10%] Building C object lib/CMakeFiles/zipstatic.dir/zip_fopen_index.c.o
    [ 10%] Building C object lib/CMakeFiles/zipstatic.dir/zip_fopen_index_encrypted.c.o
    [ 10%] Building C object lib/CMakeFiles/zipstatic.dir/zip_fread.c.o
    [ 12%] Building C object lib/CMakeFiles/zipstatic.dir/zip_fseek.c.o
    [ 12%] Building C object lib/CMakeFiles/zipstatic.dir/zip_ftell.c.o
    [ 12%] Building C object lib/CMakeFiles/zipstatic.dir/zip_get_archive_comment.c.o
    [ 12%] Building C object lib/CMakeFiles/zipstatic.dir/zip_get_archive_flag.c.o
    [ 12%] Building C object lib/CMakeFiles/zipstatic.dir/zip_get_encryption_implementation.c.o
    [ 12%] Building C object lib/CMakeFiles/zipstatic.dir/zip_get_file_comment.c.o
    [ 13%] Building C object lib/CMakeFiles/zipstatic.dir/zip_get_name.c.o
    [ 13%] Building C object lib/CMakeFiles/zipstatic.dir/zip_get_num_entries.c.o
    [ 13%] Building C object lib/CMakeFiles/zipstatic.dir/zip_get_num_files.c.o
    [ 13%] Building C object lib/CMakeFiles/zipstatic.dir/zip_hash.c.o
    [ 13%] Building C object lib/CMakeFiles/zipstatic.dir/zip_io_util.c.o
    [ 15%] Building C object lib/CMakeFiles/zipstatic.dir/zip_libzip_version.c.o
    [ 15%] Building C object lib/CMakeFiles/zipstatic.dir/zip_memdup.c.o
    [ 15%] Building C object lib/CMakeFiles/zipstatic.dir/zip_name_locate.c.o
    [ 15%] Building C object lib/CMakeFiles/zipstatic.dir/zip_new.c.o
    [ 15%] Building C object lib/CMakeFiles/zipstatic.dir/zip_open.c.o
    [ 15%] Building C object lib/CMakeFiles/zipstatic.dir/zip_progress.c.o
    [ 16%] Building C object lib/CMakeFiles/zipstatic.dir/zip_rename.c.o
    [ 16%] Building C object lib/CMakeFiles/zipstatic.dir/zip_replace.c.o
    [ 16%] Building C object lib/CMakeFiles/zipstatic.dir/zip_set_archive_comment.c.o
    [ 16%] Building C object lib/CMakeFiles/zipstatic.dir/zip_set_archive_flag.c.o
    [ 16%] Building C object lib/CMakeFiles/zipstatic.dir/zip_set_default_password.c.o
    [ 18%] Building C object lib/CMakeFiles/zipstatic.dir/zip_set_file_comment.c.o
    [ 18%] Building C object lib/CMakeFiles/zipstatic.dir/zip_set_file_compression.c.o
    [ 18%] Building C object lib/CMakeFiles/zipstatic.dir/zip_set_name.c.o
    [ 18%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_begin_write.c.o
    [ 18%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_begin_write_cloning.c.o
    [ 18%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_buffer.c.o
    [ 20%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_call.c.o
    [ 20%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_close.c.o
    [ 20%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_commit_write.c.o
    [ 20%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_compress.c.o
    [ 20%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_crc.c.o
    [ 21%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_error.c.o
    [ 21%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_filep.c.o
    [ 21%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_free.c.o
    [ 21%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_function.c.o
    [ 21%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_get_compression_flags.c.o
    [ 23%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_is_deleted.c.o
    [ 23%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_layered.c.o
    [ 23%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_open.c.o
    [ 23%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_pkware.c.o
    [ 23%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_read.c.o
    [ 23%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_remove.c.o
    [ 24%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_rollback_write.c.o
    [ 24%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_seek.c.o
    [ 24%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_seek_write.c.o
    [ 24%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_stat.c.o
    [ 24%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_supports.c.o
    [ 26%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_tell.c.o
    [ 26%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_tell_write.c.o
    [ 26%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_window.c.o
    [ 26%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_write.c.o
    [ 26%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_zip.c.o
    [ 26%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_zip_new.c.o
    [ 27%] Building C object lib/CMakeFiles/zipstatic.dir/zip_stat.c.o
    [ 27%] Building C object lib/CMakeFiles/zipstatic.dir/zip_stat_index.c.o
    [ 27%] Building C object lib/CMakeFiles/zipstatic.dir/zip_stat_init.c.o
    [ 27%] Building C object lib/CMakeFiles/zipstatic.dir/zip_strerror.c.o
    [ 27%] Building C object lib/CMakeFiles/zipstatic.dir/zip_string.c.o
    [ 29%] Building C object lib/CMakeFiles/zipstatic.dir/zip_unchange.c.o
    [ 29%] Building C object lib/CMakeFiles/zipstatic.dir/zip_unchange_all.c.o
    [ 29%] Building C object lib/CMakeFiles/zipstatic.dir/zip_unchange_archive.c.o
    [ 29%] Building C object lib/CMakeFiles/zipstatic.dir/zip_unchange_data.c.o
    [ 29%] Building C object lib/CMakeFiles/zipstatic.dir/zip_utf-8.c.o
    [ 29%] Building C object lib/CMakeFiles/zipstatic.dir/zip_algorithm_bzip2.c.o
    [ 30%] Building C object lib/CMakeFiles/zipstatic.dir/zip_crypto_commoncrypto.c.o
    [ 30%] Building C object lib/CMakeFiles/zipstatic.dir/zip_winzip_aes.c.o
    [ 30%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_winzip_aes_decode.c.o
    [ 30%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_winzip_aes_encode.c.o
    [ 30%] Building C object lib/CMakeFiles/zipstatic.dir/zip_source_file.c.o
    [ 32%] Linking C static library libzipstatic.a
    [ 32%] Built target zipstatic
    

    And self tests passing well

    $ make test
    Running tests...
    Test project /Users/alexandr/Projects/arboreus/arboreus_storage_mobile_libs/libzip/build
            Start   1: add_dir.test
      1/128 Test   #1: add_dir.test .....................................   Passed    0.07 sec
            Start   2: add_from_buffer.test
      2/128 Test   #2: add_from_buffer.test .............................   Passed    0.04 sec
            Start   3: add_from_file.test
      3/128 Test   #3: add_from_file.test ...............................   Passed    0.04 sec
            Start   4: add_from_file_duplicate.test
      4/128 Test   #4: add_from_file_duplicate.test .....................   Passed    0.04 sec
            Start   5: add_from_file_twice_duplicate.test
      5/128 Test   #5: add_from_file_twice_duplicate.test ...............   Passed    0.04 sec
            Start   6: add_from_filep.test
      6/128 Test   #6: add_from_filep.test ..............................   Passed    0.04 sec
            Start   7: add_from_stdin.test
      7/128 Test   #7: add_from_stdin.test ..............................   Passed    0.05 sec
            Start   8: add_from_zip_closed.test
      8/128 Test   #8: add_from_zip_closed.test .........................   Passed    0.04 sec
            Start   9: add_from_zip_deflated.test
      9/128 Test   #9: add_from_zip_deflated.test .......................   Passed    0.04 sec
            Start  10: add_from_zip_deflated2.test
     10/128 Test  #10: add_from_zip_deflated2.test ......................   Passed    0.05 sec
            Start  11: add_from_zip_partial_deflated.test
     11/128 Test  #11: add_from_zip_partial_deflated.test ...............   Passed    0.05 sec
            Start  12: add_from_zip_partial_stored.test
     12/128 Test  #12: add_from_zip_partial_stored.test .................   Passed    0.04 sec
            Start  13: add_from_zip_stored.test
     13/128 Test  #13: add_from_zip_stored.test .........................   Passed    0.05 sec
            Start  14: add_stored.test
     14/128 Test  #14: add_stored.test ..................................   Passed    0.04 sec
            Start  15: add_stored_in_memory.test
     15/128 Test  #15: add_stored_in_memory.test ........................   Passed    0.04 sec
            Start  16: buffer-fragment-read.test
     16/128 Test  #16: buffer-fragment-read.test ........................   Passed    0.04 sec
            Start  17: buffer-fragment-write.test
     17/128 Test  #17: buffer-fragment-write.test .......................   Passed    0.04 sec
            Start  18: clone-buffer-add.test
     18/128 Test  #18: clone-buffer-add.test ............................   Passed    0.04 sec
            Start  19: clone-buffer-delete.test
     19/128 Test  #19: clone-buffer-delete.test .........................   Passed    0.04 sec
            Start  20: clone-buffer-replace.test
     20/128 Test  #20: clone-buffer-replace.test ........................   Passed    0.04 sec
            Start  21: clone-fs-add.test
     21/128 Test  #21: clone-fs-add.test ................................   Passed    0.04 sec
            Start  22: clone-fs-delete.test
     22/128 Test  #22: clone-fs-delete.test .............................   Passed    0.04 sec
            Start  23: clone-fs-replace.test
     23/128 Test  #23: clone-fs-replace.test ............................   Passed    0.04 sec
            Start  24: cm-default.test
     24/128 Test  #24: cm-default.test ..................................   Passed    0.05 sec
            Start  25: count_entries.test
     25/128 Test  #25: count_entries.test ...............................   Passed    1.17 sec
            Start  26: decrypt-correct-password-aes128.test
     26/128 Test  #26: decrypt-correct-password-aes128.test .............   Passed    0.04 sec
            Start  27: decrypt-correct-password-aes192.test
     27/128 Test  #27: decrypt-correct-password-aes192.test .............   Passed    0.04 sec
            Start  28: decrypt-correct-password-aes256.test
     28/128 Test  #28: decrypt-correct-password-aes256.test .............   Passed    0.04 sec
            Start  29: decrypt-correct-password-pkware.test
     29/128 Test  #29: decrypt-correct-password-pkware.test .............   Passed    0.04 sec
            Start  30: decrypt-no-password-aes256.test
     30/128 Test  #30: decrypt-no-password-aes256.test ..................   Passed    0.04 sec
            Start  31: decrypt-wrong-password-aes128.test
     31/128 Test  #31: decrypt-wrong-password-aes128.test ...............   Passed    0.04 sec
            Start  32: decrypt-wrong-password-aes192.test
     32/128 Test  #32: decrypt-wrong-password-aes192.test ...............   Passed    0.04 sec
            Start  33: decrypt-wrong-password-aes256.test
     33/128 Test  #33: decrypt-wrong-password-aes256.test ...............   Passed    0.04 sec
            Start  34: decrypt-wrong-password-pkware.test
     34/128 Test  #34: decrypt-wrong-password-pkware.test ...............   Passed    0.04 sec
            Start  35: delete_add_same.test
     35/128 Test  #35: delete_add_same.test .............................   Passed    0.04 sec
            Start  36: delete_invalid.test
     36/128 Test  #36: delete_invalid.test ..............................   Passed    0.04 sec
            Start  37: delete_last.test
     37/128 Test  #37: delete_last.test .................................   Passed    0.04 sec
            Start  38: delete_multiple_last.test
     38/128 Test  #38: delete_multiple_last.test ........................   Passed    0.04 sec
            Start  39: delete_multiple_partial.test
     39/128 Test  #39: delete_multiple_partial.test .....................   Passed    0.04 sec
            Start  40: delete_renamed_rename.test
     40/128 Test  #40: delete_renamed_rename.test .......................   Passed    0.04 sec
            Start  41: encrypt.test
     41/128 Test  #41: encrypt.test .....................................   Passed    0.04 sec
            Start  42: encryption-nonrandom-aes128.test
     42/128 Test  #42: encryption-nonrandom-aes128.test .................***Skipped   0.04 sec
            Start  43: encryption-nonrandom-aes192.test
     43/128 Test  #43: encryption-nonrandom-aes192.test .................***Skipped   0.04 sec
            Start  44: encryption-nonrandom-aes256.test
     44/128 Test  #44: encryption-nonrandom-aes256.test .................***Skipped   0.04 sec
            Start  45: encryption-remove.test
     45/128 Test  #45: encryption-remove.test ...........................   Passed    0.04 sec
            Start  46: extra_add.test
     46/128 Test  #46: extra_add.test ...................................   Passed    0.04 sec
            Start  47: extra_add_multiple.test
     47/128 Test  #47: extra_add_multiple.test ..........................   Passed    0.04 sec
            Start  48: extra_count.test
     48/128 Test  #48: extra_count.test .................................   Passed    0.04 sec
            Start  49: extra_count_by_id.test
     49/128 Test  #49: extra_count_by_id.test ...........................   Passed    0.04 sec
            Start  50: extra_count_ignore_zip64.test
     50/128 Test  #50: extra_count_ignore_zip64.test ....................   Passed    0.04 sec
            Start  51: extra_delete.test
     51/128 Test  #51: extra_delete.test ................................   Passed    0.05 sec
            Start  52: extra_delete_by_id.test
     52/128 Test  #52: extra_delete_by_id.test ..........................   Passed    0.05 sec
            Start  53: extra_field_align.test
     53/128 Test  #53: extra_field_align.test ...........................   Passed    0.05 sec
            Start  54: extra_get.test
     54/128 Test  #54: extra_get.test ...................................   Passed    0.04 sec
            Start  55: extra_get_by_id.test
     55/128 Test  #55: extra_get_by_id.test .............................   Passed    0.04 sec
            Start  56: extra_set.test
     56/128 Test  #56: extra_set.test ...................................   Passed    0.04 sec
            Start  57: extra_set_modify_c.test
     57/128 Test  #57: extra_set_modify_c.test ..........................   Passed    0.04 sec
            Start  58: extra_set_modify_l.test
     58/128 Test  #58: extra_set_modify_l.test ..........................   Passed    0.04 sec
            Start  59: fdopen_ok.test
     59/128 Test  #59: fdopen_ok.test ...................................   Passed    0.04 sec
            Start  60: file_comment_encmismatch.test
     60/128 Test  #60: file_comment_encmismatch.test ....................   Passed    0.04 sec
            Start  61: fopen_unchanged.test
     61/128 Test  #61: fopen_unchanged.test .............................   Passed    0.04 sec
            Start  62: fread.test
     62/128 Test  #62: fread.test .......................................   Passed    0.05 sec
            Start  63: fseek_deflated.test
     63/128 Test  #63: fseek_deflated.test ..............................   Passed    0.04 sec
            Start  64: fseek_fail.test
     64/128 Test  #64: fseek_fail.test ..................................   Passed    0.04 sec
            Start  65: fseek_ok.test
     65/128 Test  #65: fseek_ok.test ....................................   Passed    0.04 sec
            Start  66: get_comment.test
     66/128 Test  #66: get_comment.test .................................   Passed    0.04 sec
            Start  67: junk_at_end.test
     67/128 Test  #67: junk_at_end.test .................................   Passed    0.04 sec
            Start  68: junk_at_start.test
     68/128 Test  #68: junk_at_start.test ...............................   Passed    0.04 sec
            Start  69: name_locate.test
     69/128 Test  #69: name_locate.test .................................   Passed    0.04 sec
            Start  70: open_cons_extrabytes.test
     70/128 Test  #70: open_cons_extrabytes.test ........................   Passed    0.04 sec
            Start  71: open_empty.test
     71/128 Test  #71: open_empty.test ..................................   Passed    0.04 sec
            Start  72: open_empty_2.test
     72/128 Test  #72: open_empty_2.test ................................   Passed    0.04 sec
            Start  73: open_extrabytes.test
     73/128 Test  #73: open_extrabytes.test .............................   Passed    0.04 sec
            Start  74: open_file_count.test
     74/128 Test  #74: open_file_count.test .............................   Passed    0.04 sec
            Start  75: open_filename_duplicate.test
     75/128 Test  #75: open_filename_duplicate.test .....................   Passed    0.04 sec
            Start  76: open_filename_duplicate_consistency.test
     76/128 Test  #76: open_filename_duplicate_consistency.test .........   Passed    0.04 sec
            Start  77: open_filename_duplicate_empty.test
     77/128 Test  #77: open_filename_duplicate_empty.test ...............   Passed    0.04 sec
            Start  78: open_filename_duplicate_empty_consistency.test
     78/128 Test  #78: open_filename_duplicate_empty_consistency.test ...   Passed    0.04 sec
            Start  79: open_filename_empty.test
     79/128 Test  #79: open_filename_empty.test .........................   Passed    0.04 sec
            Start  80: open_incons.test
     80/128 Test  #80: open_incons.test .................................   Passed    0.06 sec
            Start  81: open_many_fail.test
     81/128 Test  #81: open_many_fail.test ..............................   Passed    4.10 sec
            Start  82: open_many_ok.test
     82/128 Test  #82: open_many_ok.test ................................   Passed    5.57 sec
            Start  83: open_multidisk.test
     83/128 Test  #83: open_multidisk.test ..............................   Passed    0.04 sec
            Start  84: open_new_but_exists.test
     84/128 Test  #84: open_new_but_exists.test .........................   Passed    0.04 sec
            Start  85: open_new_ok.test
     85/128 Test  #85: open_new_ok.test .................................   Passed    0.04 sec
            Start  86: open_nonarchive.test
     86/128 Test  #86: open_nonarchive.test .............................   Passed    0.04 sec
            Start  87: open_nosuchfile.test
     87/128 Test  #87: open_nosuchfile.test .............................   Passed    0.04 sec
            Start  88: open_ok.test
     88/128 Test  #88: open_ok.test .....................................   Passed    0.04 sec
            Start  89: open_too_short.test
     89/128 Test  #89: open_too_short.test ..............................   Passed    0.04 sec
            Start  90: open_truncate.test
     90/128 Test  #90: open_truncate.test ...............................   Passed    0.04 sec
            Start  91: open_zip64_3mf.test
     91/128 Test  #91: open_zip64_3mf.test ..............................   Passed    0.05 sec
            Start  92: open_zip64_ok.test
     92/128 Test  #92: open_zip64_ok.test ...............................   Passed    0.05 sec
            Start  93: preload.test
     93/128 Test  #93: preload.test .....................................***Skipped   0.04 sec
            Start  94: progress.test
     94/128 Test  #94: progress.test ....................................   Passed    0.05 sec
            Start  95: rename_ascii.test
     95/128 Test  #95: rename_ascii.test ................................   Passed    0.05 sec
            Start  96: rename_cp437.test
     96/128 Test  #96: rename_cp437.test ................................   Passed    0.05 sec
            Start  97: rename_deleted.test
     97/128 Test  #97: rename_deleted.test ..............................   Passed    0.05 sec
            Start  98: rename_fail.test
     98/128 Test  #98: rename_fail.test .................................   Passed    0.05 sec
            Start  99: rename_ok.test
     99/128 Test  #99: rename_ok.test ...................................   Passed    0.05 sec
            Start 100: rename_utf8.test
    100/128 Test #100: rename_utf8.test .................................   Passed    0.04 sec
            Start 101: rename_utf8_encmismatch.test
    101/128 Test #101: rename_utf8_encmismatch.test .....................   Passed    0.04 sec
            Start 102: set_comment_all.test
    102/128 Test #102: set_comment_all.test .............................   Passed    0.05 sec
            Start 103: set_comment_localonly.test
    103/128 Test #103: set_comment_localonly.test .......................   Passed    0.05 sec
            Start 104: set_comment_removeglobal.test
    104/128 Test #104: set_comment_removeglobal.test ....................   Passed    0.05 sec
            Start 105: set_comment_revert.test
    105/128 Test #105: set_comment_revert.test ..........................   Passed    0.05 sec
            Start 106: set_compression_bzip2_to_deflate.test
    106/128 Test #106: set_compression_bzip2_to_deflate.test ............   Passed    0.05 sec
            Start 107: set_compression_deflate_to_bzip2.test
    107/128 Test #107: set_compression_deflate_to_bzip2.test ............   Passed    0.04 sec
            Start 108: set_compression_deflate_to_deflate.test
    108/128 Test #108: set_compression_deflate_to_deflate.test ..........   Passed    0.05 sec
            Start 109: set_compression_deflate_to_store.test
    109/128 Test #109: set_compression_deflate_to_store.test ............   Passed    0.05 sec
            Start 110: set_compression_store_to_bzip2.test
    110/128 Test #110: set_compression_store_to_bzip2.test ..............   Passed    0.05 sec
            Start 111: set_compression_store_to_deflate.test
    111/128 Test #111: set_compression_store_to_deflate.test ............   Passed    0.05 sec
            Start 112: set_compression_store_to_store.test
    112/128 Test #112: set_compression_store_to_store.test ..............   Passed    0.05 sec
            Start 113: set_compression_unknown.test
    113/128 Test #113: set_compression_unknown.test .....................   Passed    0.05 sec
            Start 114: stat_index_cp437_guess.test
    114/128 Test #114: stat_index_cp437_guess.test ......................   Passed    0.05 sec
            Start 115: stat_index_cp437_raw.test
    115/128 Test #115: stat_index_cp437_raw.test ........................   Passed    0.05 sec
            Start 116: stat_index_cp437_strict.test
    116/128 Test #116: stat_index_cp437_strict.test .....................   Passed    0.05 sec
            Start 117: stat_index_fileorder.test
    117/128 Test #117: stat_index_fileorder.test ........................   Passed    0.04 sec
            Start 118: stat_index_streamed.test
    118/128 Test #118: stat_index_streamed.test .........................   Passed    0.04 sec
            Start 119: stat_index_streamed_zip64.test
    119/128 Test #119: stat_index_streamed_zip64.test ...................   Passed    0.04 sec
            Start 120: stat_index_utf8_guess.test
    120/128 Test #120: stat_index_utf8_guess.test .......................   Passed    0.05 sec
            Start 121: stat_index_utf8_raw.test
    121/128 Test #121: stat_index_utf8_raw.test .........................   Passed    0.05 sec
            Start 122: stat_index_utf8_strict.test
    122/128 Test #122: stat_index_utf8_strict.test ......................   Passed    0.05 sec
            Start 123: stat_index_utf8_unmarked_strict.test
    123/128 Test #123: stat_index_utf8_unmarked_strict.test .............   Passed    0.05 sec
            Start 124: stat_index_zip64.test
    124/128 Test #124: stat_index_zip64.test ............................   Passed    0.90 sec
            Start 125: utf-8-standardization.test
    125/128 Test #125: utf-8-standardization.test .......................   Passed    0.04 sec
            Start 126: zip-in-archive-comment.test
    126/128 Test #126: zip-in-archive-comment.test ......................   Passed    0.05 sec
            Start 127: zip64_creation.test
    127/128 Test #127: zip64_creation.test ..............................   Passed   15.32 sec
            Start 128: zip64_stored_creation.test
    128/128 Test #128: zip64_stored_creation.test .......................   Passed    9.76 sec
    
    100% tests passed, 0 tests failed out of 128
    
    Total Test time (real) =  42.26 sec
    
    The following tests did not run:
    	 42 - encryption-nonrandom-aes128.test (Skipped)
    	 43 - encryption-nonrandom-aes192.test (Skipped)
    	 44 - encryption-nonrandom-aes256.test (Skipped)
    	 93 - preload.test (Skipped)
    


  • @VRonin But when I am trying to add to QT - fail. I've been trying to add like shared *.dylib (do not see the library) and I've been trying to add like static (the problem with function from another lib - zlib, the error mentioned in Qt logs - mean that somehow in static library do not included zlib functions, but self test is passing well)



  • @VRonin In following CMake logs - every required library found

    $ cmake ..
    -- The C compiler identification is AppleClang 10.0.0.10001145
    -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
    -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Looking for include file CommonCrypto/CommonCrypto.h
    -- Looking for include file CommonCrypto/CommonCrypto.h - found
    -- Found NETTLE: /usr/local/lib/libnettle.dylib
    -- Could NOT find GnuTLS (missing: GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR)
    -- Found OpenSSL: /usr/lib/libcrypto.dylib (found version "1.0.2o")
    -- Looking for _chmod
    -- Looking for _chmod - not found
    -- Looking for _close
    -- Looking for _close - not found
    -- Looking for _dup
    -- Looking for _dup - not found
    -- Looking for _fdopen
    -- Looking for _fdopen - not found
    -- Looking for _fileno
    -- Looking for _fileno - not found
    -- Looking for _open
    -- Looking for _open - not found
    -- Looking for _setmode
    -- Looking for _setmode - not found
    -- Looking for _snprintf
    -- Looking for _snprintf - not found
    -- Looking for _strdup
    -- Looking for _strdup - not found
    -- Looking for _stricmp
    -- Looking for _stricmp - not found
    -- Looking for _strtoi64
    -- Looking for _strtoi64 - not found
    -- Looking for _strtoui64
    -- Looking for _strtoui64 - not found
    -- Looking for _umask
    -- Looking for _umask - not found
    -- Looking for _unlink
    -- Looking for _unlink - not found
    -- Looking for clonefile
    -- Looking for clonefile - found
    -- Looking for explicit_bzero
    -- Looking for explicit_bzero - not found
    -- Looking for explicit_memset
    -- Looking for explicit_memset - not found
    -- Looking for fileno
    -- Looking for fileno - found
    -- Looking for fseeko
    -- Looking for fseeko - found
    -- Looking for ftello
    -- Looking for ftello - found
    -- Looking for getprogname
    -- Looking for getprogname - found
    -- Looking for open
    -- Looking for open - found
    -- Looking for mkstemp
    -- Looking for mkstemp - found
    -- Looking for setmode
    -- Looking for setmode - found
    -- Looking for snprintf
    -- Looking for snprintf - found
    -- Looking for strcasecmp
    -- Looking for strcasecmp - found
    -- Looking for strdup
    -- Looking for strdup - found
    -- Looking for stricmp
    -- Looking for stricmp - not found
    -- Looking for strtoll
    -- Looking for strtoll - found
    -- Looking for strtoull
    -- Looking for strtoull - found
    -- Looking for 3 include files sys/types.h, ..., fts.h
    -- Looking for 3 include files sys/types.h, ..., fts.h - found
    -- Looking for include file stdbool.h
    -- Looking for include file stdbool.h - found
    -- Looking for include file strings.h
    -- Looking for include file strings.h - found
    -- Looking for include file unistd.h
    -- Looking for include file unistd.h - found
    -- Looking for include file inttypes.h
    -- Looking for include file inttypes.h - found
    -- Looking for include file stdint.h
    -- Looking for include file stdint.h - found
    -- Looking for include file sys/types.h
    -- Looking for include file sys/types.h - found
    -- Looking for sys/types.h
    -- Looking for sys/types.h - found
    -- Looking for stdint.h
    -- Looking for stdint.h - found
    -- Looking for stddef.h
    -- Looking for stddef.h - found
    -- Check size of __int8
    -- Check size of __int8 - failed
    -- Check size of int8_t
    -- Check size of int8_t - done
    -- Check size of uint8_t
    -- Check size of uint8_t - done
    -- Check size of __int16
    -- Check size of __int16 - failed
    -- Check size of int16_t
    -- Check size of int16_t - done
    -- Check size of uint16_t
    -- Check size of uint16_t - done
    -- Check size of __int32
    -- Check size of __int32 - failed
    -- Check size of int32_t
    -- Check size of int32_t - done
    -- Check size of uint32_t
    -- Check size of uint32_t - done
    -- Check size of __int64
    -- Check size of __int64 - failed
    -- Check size of int64_t
    -- Check size of int64_t - done
    -- Check size of uint64_t
    -- Check size of uint64_t - done
    -- Check size of short
    -- Check size of short - done
    -- Check size of int
    -- Check size of int - done
    -- Check size of long
    -- Check size of long - done
    -- Check size of long long
    -- Check size of long long - done
    -- Check size of off_t
    -- Check size of off_t - done
    -- Check size of size_t
    -- Check size of size_t - done
    -- Check size of ssize_t
    -- Check size of ssize_t - done
    -- Performing Test HAVE_FICLONERANGE
    -- Performing Test HAVE_FICLONERANGE - Failed
    -- Check if the system is big endian
    -- Searching 16 bit integer
    -- Check size of unsigned short
    -- Check size of unsigned short - done
    -- Using unsigned short
    -- Check if the system is big endian - little endian
    -- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.11")
    -- Found BZip2: /usr/lib/libbz2.dylib (found version "1.0.6")
    -- Looking for BZ2_bzCompressInit
    -- Looking for BZ2_bzCompressInit - found
    -- Looking for getopt
    -- Looking for getopt - found
    -- Configuring done
    CMake Warning (dev) at lib/CMakeLists.txt:232 (ADD_LIBRARY):
      Policy CMP0063 is not set: Honor visibility properties for all target
      types.  Run "cmake --help-policy CMP0063" for policy details.  Use the
      cmake_policy command to set the policy and suppress this warning.
    
      Target "zipstatic" of type "STATIC_LIBRARY" has the following visibility
      properties set for C:
    
        C_VISIBILITY_PRESET
    
      For compatibility CMake is not honoring them for this target.
    This warning is for project developers.  Use -Wno-dev to suppress it.
    
    -- Generating done
    -- Build files have been written to: /Users/alexandr/Projects/arboreus/arboreus_storage_mobile_libs/libzip/build
    


  • Solution found for MacOS and iOS.
    It's might be working well for another platforms. I haven't tested it yet.

    Every library that is using by libzip should be added manually to the QT project and if it's not by default in the system you need to build it like static. If there zlib - then add it manually, if there SSL - then add it manually, etc

    The step-by-step guidance for building libzip published by me on Github

    There are couple of strange things that I found (I don't know the cause of it):

    • In the directory where located library appeared couple of symlinks on the real shared library file when I am attaching it to QT project via symlinks it's not working, only direct original file attaching to project working well (it's mean important for attaching zlib from system folder). See the screenshot

    0_1551431264962_Screen Shot 2019-03-01 at 12.04.58.png

    • The libzip library only working when you attaching it to QT Project like statical library (*.a), all of attempts of using like shared/dynamic libraray (*.dylib) have got failed, even it's installed like the operational system part.

    Code from that works for me *.pro file:

    macx {
    
    LIBS += -lz.1
    LIBS += -L$$PWD/libs/libzip/ -lzipstatic
    
    INCLUDEPATH += $$PWD/libs/libzip
    DEPENDPATH += $$PWD/libs/libzip
    
    PRE_TARGETDEPS += $$PWD/libs/libzip/libzipstatic.a
    
    }
    
    ios {
    
    LIBS += -lz.1
    LIBS += -L$$PWD/libs/libzip/ -lzipstatic
    
    INCLUDEPATH += $$PWD/libs/libzip
    DEPENDPATH += $$PWD/libs/libzip
    
    PRE_TARGETDEPS += $$PWD/libs/libzip/libzipstatic.a
    
    }
    

    SUPER-MEGA-HUGE (SMH) thanks to Thomas Klausner (one of authors of libzip). He has been helping me to solve this trouble.


Log in to reply