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

QuaZip Import



  • Hey!

    I stuck on some other libraries but I think that QuaZip is still the best one cuz it delivers me more. What I tried was to include the source code into the project but that didn't work. How have you added QuaZip to your project? I have this "undefined reference" problem for days and I tried many solutions so I just want to end up this whole thing by implementing QuaZip into my project. I'm thankful to all who try to deliver me a reliable solution.



  • QuaZip as almost every other zip library is just a wrapper around zlib so I'm not sure you can call one better than the other. Personally I'm a fan of KArchive as it manages other formats, not just the zip one.

    Now to the core of your question.
    Compile QuaZip and then add it as an external library.

    If you decide to use KArchive instead the building of the library can be a bit overwhelming the first time so you can downloand a pre-compiled version (including all the dependencies) for MSVC2019 from here (x64/x86)



  • @VRonin So I have to use MSVC2019 to compile my project when using KArchive (btw big thx ive already heard of karchive but the problem was that i havent found any download link)



  • @FluentCoding said in QuaZip Import:

    So I have to use MSVC2019 to compile my project when using KArchive

    If you use my pre-compiled version, yes



  • @VRonin Aight, thanks! Are there any instructions on how to compile it? I still want to stay at MinGW :/



  • Instructions do not include the optional liblzma as it would need some testing on my part and I don't have MinGW on my pc atm.

    • install CMake if you don't have it already (https://cmake.org/)
    • install git if you don't have it already (https://git-scm.com/)
    • start a command prompt (cmd.exe), all the instructions beyond this point need to be run inside this cmd terminal
    • type cmake --version. if an error appears, call set PATH=path\to\cmake\bin;%PATH% where path/to/cmake/bin is the path to the bin folder of CMake (for me it's C:\Program Files\CMake\bin). Run cmake --version again to confirm no more errors
    • type git --version. if an error appears, call set PATH=path\to\git\bin;%PATH% where path/to/git/bin is the path to the bin folder of git(for me it's C:\Program Files\Git\bin). Run git --version again to confirm no more errors
    • cd into the bin folder of Qt (for me it's C:\Qt\5.15.0\msvc2019_64\bin)
    • call qtenv2.bat
    • cd into an empty folder and run these commands:
    set CMAKEGENERATOR="MinGW Makefiles"
    git clone --depth=1 https://gitlab.com/federicomenaquintero/bzip2.git bzip2src
    cd .\bzip2src
    mkdir .\build 
    cd .\build
    cmake -G %CMAKEGENERATOR% -DENABLE_LIB_ONLY=ON -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX=../../bzip2 ../
    cmake --build . --config Release
    cmake --build . --target install --config Release
    cd ..\..\
    rmdir /Q /S bzip2src
    set PATH=%CD%\bzip2;%PATH%
    git clone --depth=1 https://github.com/madler/zlib.git zlibBuild
    cd zlibBuild
    mkdir .\build
    cd .\build
    cmake -G %CMAKEGENERATOR% -DCMAKE_INSTALL_PREFIX=../../zlib -DCMAKE_BUILD_TYPE=RELEASE ../
    cmake --build .
    cmake --build . --target install
    cd ..\..\
    rmdir /Q /S zlibBuild
    set PATH=%CD%\zlib;%PATH%
    git clone --depth=1 git://anongit.kde.org/extra-cmake-modules ECM
    cd ECM
    mkdir .\build 
    cd .\build
    cmake -G %CMAKEGENERATOR% -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=../../ECMbuild -DCMAKE_BUILD_TYPE=RELEASE ../
    cmake --build .
    cmake --build . --target install
    cd ..\..\
    set PATH=%CD%\ECMbuild;%PATH%
    git clone --depth=1 git://anongit.kde.org/karchive.git KArchive
    cd KArchive
    mkdir .\build 
    cd .\build
    cmake -G %CMAKEGENERATOR% -DBUILD_TESTING=OFF -DCMAKE_DEBUG_POSTFIX=d -DCMAKE_INSTALL_PREFIX=../../KDEAPI -DCMAKE_BUILD_TYPE=DEBUG ../
    cmake --build .
    cmake --build . --target install
    cmake -G %CMAKEGENERATOR% -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=../../KDEAPI -DCMAKE_BUILD_TYPE=RELEASE ../
    cmake --build .
    cmake --build . --target install
    cd ..\..\
    rmdir /Q /S ECMbuild
    rmdir /Q /S ECM
    rmdir /Q /S KArchive
    

    Now you should have 3 folders. KDEAPI will contain the KArchive to link to it in Qt Creator the other 2 will contain the dlls required by KArchive to function



  • @VRonin Big thanks to you! I'm currently stuck at this: 7cedaad4-7430-4256-90b2-5ac765e131ef-image.png
    ... but I'll write to you when I have progress. Thanks bud!



  • @VRonin I got an error.

    5a99c22a-490b-4ce0-b4bb-6ddacace2f26-image.png

    ... in this step: cmake -G %CMAKEGENERATOR% -DBUILD_TESTING=OFF -DCMAKE_DEBUG_POSTFIX=d -DCMAKE_INSTALL_PREFIX=../../KDEAPI -DCMAKE_BUILD_TYPE=DEBUG ../ (one of the last ones).

    Should I update the config file?



  • KArchive requires Qt 5.12 or newer, you have Qt 5.6 installed so it's not enough



  • @VRonin I have the (almost) newest version installed :/ weird...



  • After the "call qtenv2.bat" step, try calling qmake --version to check what Qt version you are using





  • and it still fails? very strange.
    After calling qtenv2.bat could you type echo %PATH% and tell us what it prints?





  • wow, that's a messy PATH, you have more than 3 versions of mingw and apparently 2 of Qt in there.
    before set CMAKEGENERATOR="MinGW Makefiles" run set PATH=C:\Program Files\CMake\bin;C:\Program Files\Git\cmd.

    This hould get rid of the junk in there but you should really think about cleaning up that variable permanently from the variable editor removing stuff you don't need.



  • @VRonin a8ebe3c7-d4a1-4cf2-ba5c-ee21d2cf4e6f-image.png

    Didn't work, even when setting QtCore_DIR ...



  • did you run qtenv2.bat? can you tell us what echo %PATH% prints just before calling KArchive's CMake?





  • ok, let's start from scratch:
    Now I know where you installed stuff so I can do it all in one script.
    Open a new cmd window and run the following comands:

    set PATH=C:\Program Files\CMake\bin;C:\Program Files\Git\cmd
    set CMAKEGENERATOR="MinGW Makefiles"
    cd /D D:\dev\Qt\5.14.2\mingw73_64\bin
    qtenv2.bat
    cd /D C:\Users\einst\Desktop
    rmdir /Q /S KArchive
    mkdir KArchive
    cd KArchive
    git clone --depth=1 https://gitlab.com/federicomenaquintero/bzip2.git bzip2src
    cd .\bzip2src
    mkdir .\build 
    cd .\build
    cmake -G %CMAKEGENERATOR% -DENABLE_LIB_ONLY=ON -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX=../../bzip2 ../
    cmake --build . --config Release
    cmake --build . --target install --config Release
    cd ..\..\
    rmdir /Q /S bzip2src
    set PATH=%CD%\bzip2;%PATH%
    git clone --depth=1 https://github.com/madler/zlib.git zlibBuild
    cd zlibBuild
    mkdir .\build
    cd .\build
    cmake -G %CMAKEGENERATOR% -DCMAKE_INSTALL_PREFIX=../../zlib -DCMAKE_BUILD_TYPE=RELEASE ../
    cmake --build .
    cmake --build . --target install
    cd ..\..\
    rmdir /Q /S zlibBuild
    set PATH=%CD%\zlib;%PATH%
    git clone --depth=1 git://anongit.kde.org/extra-cmake-modules ECM
    cd ECM
    mkdir .\build 
    cd .\build
    cmake -G %CMAKEGENERATOR% -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=../../ECMbuild -DCMAKE_BUILD_TYPE=RELEASE ../
    cmake --build .
    cmake --build . --target install
    cd ..\..\
    set PATH=%CD%\ECMbuild;%PATH%
    git clone --depth=1 git://anongit.kde.org/karchive.git KArchive
    cd KArchive
    mkdir .\build 
    cd .\build
    cmake -G %CMAKEGENERATOR% -DBUILD_TESTING=OFF -DCMAKE_DEBUG_POSTFIX=d -DCMAKE_INSTALL_PREFIX=../../KDEAPI -DCMAKE_BUILD_TYPE=DEBUG ../
    cmake --build .
    cmake --build . --target install
    cmake -G %CMAKEGENERATOR% -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=../../KDEAPI -DCMAKE_BUILD_TYPE=RELEASE ../
    cmake --build .
    cmake --build . --target install
    cd ..\..\
    rmdir /Q /S ECMbuild
    rmdir /Q /S ECM
    rmdir /Q /S KArchive
    


  • @VRonin Nah, I'm giving up tbh. I get errors and erros and even then, is it worth it? I mean I just want to download a zip from my application and extract it from memory, but it wouldnt be so hard for the computer that it saves the zip into local storage and then extracts it from there. Also, I have an ETA for my application that I set myself. :/ But thank you so much for your help! I owe you..


Log in to reply