Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Quazip-1.3 static linking issue
Qt 6.11 is out! See what's new in the release blog

Quazip-1.3 static linking issue

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 2 Posters 2.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • VRoninV VRonin

    Seems like you forgot to install QuaZip...

    add -DCMAKE_INSTALL_PREFIX="C:/ZipDev/QuaZip" to the first cmake call (the configuration) and, after the build, call cmake --build C:/ZipDev/quazip-1.3/msvc2019/static/x86/debug --config Debug --target install. You will now have the Quazip library installed in C:/ZipDev/QuaZip that you can reference in your .pro file

    Cobra91151C Offline
    Cobra91151C Offline
    Cobra91151
    wrote on last edited by
    #3

    @VRonin

    I have tried your solution but it still leads to these linking errors.

    .pro file:

    QT -= gui
    CONFIG += c++latest console static
    CONFIG -= app_bundle
    
    # You can make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += \
            main.cpp
    
    # Default rules for deployment.
    #qnx: target.path = /tmp/$${TARGET}/bin
    #else: unix:!android: target.path = /opt/$${TARGET}/bin
    #!isEmpty(target.path): INSTALLS += target
    MOC_DIR = ./resources/moc
    OBJECTS_DIR = ./resources/objects
    RCC_DIR = ./resources/resource
    DEFINES += QUAZIP_STATIC
    INCLUDEPATH += "C:/ZipDev/QuaZip/include/QuaZip-Qt5-1.3/quazip"
    INCLUDEPATH += "C:/ZipDev/zlib-win-build-1.2.12"
    
    CONFIG(debug, debug|release) {
        DESTDIR = $$OUT_PWD/debug
        LIBS += -L"C:/ZipDev/QuaZip/lib" -lquazip1-qt5d
        LIBS += -L"C:/ZipDev/zlib-win-build-1.2.12/build-VS2019-MT/Debug" -llibz-static
    }
    
    #QMAKE_POST_LINK = $$(QTDIR)/bin/windeployqt.exe $$shell_quote($$DESTDIR/$$shell_quote($$TARGET).exe) --no-compiler-runtime
    

    Full error log: https://pastebin.com/raw/GL0tK7xV

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #4

      unresolved external symbol "__declspec(dllimport)

      Seems like it's trying to link QuaZip dinamically, ignoring DEFINES += QUAZIP_STATIC

      What's the content of C:/ZipDev/QuaZip and its subfolders now?

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      Cobra91151C 1 Reply Last reply
      0
      • VRoninV VRonin

        unresolved external symbol "__declspec(dllimport)

        Seems like it's trying to link QuaZip dinamically, ignoring DEFINES += QUAZIP_STATIC

        What's the content of C:/ZipDev/QuaZip and its subfolders now?

        Cobra91151C Offline
        Cobra91151C Offline
        Cobra91151
        wrote on last edited by Cobra91151
        #5

        @VRonin

        Yes, I think it ignores the DEFINES += QUAZIP_STATIC and links to dynamic libs for some reason.

        The content of C:/ZipDev/QuaZip folder: QuaZip content.gif

        VRoninV 1 Reply Last reply
        0
        • Cobra91151C Cobra91151

          @VRonin

          Yes, I think it ignores the DEFINES += QUAZIP_STATIC and links to dynamic libs for some reason.

          The content of C:/ZipDev/QuaZip folder: QuaZip content.gif

          VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #6

          @Cobra91151 said in Quazip-1.3 static linking issue:

          The content of C:/ZipDev/QuaZip folder:

          Looks good.

          #include "JlCompress.h"

          Did you try to unpack QuaZip directly in your source code? Do you have another instance of JlCompress.h in your source tree? If so delete it and also change it to #include <JlCompress.h> just in case

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          Cobra91151C 2 Replies Last reply
          0
          • VRoninV VRonin

            @Cobra91151 said in Quazip-1.3 static linking issue:

            The content of C:/ZipDev/QuaZip folder:

            Looks good.

            #include "JlCompress.h"

            Did you try to unpack QuaZip directly in your source code? Do you have another instance of JlCompress.h in your source tree? If so delete it and also change it to #include <JlCompress.h> just in case

            Cobra91151C Offline
            Cobra91151C Offline
            Cobra91151
            wrote on last edited by
            #7

            @VRonin

            No, my project source code is available: C:\Users\cobra\Documents\Projects\CPP\QuaZipTest
            QuaZip is installed: C:\ZipDev\QuaZip
            I have only 1 instance of JlCompress in the source tree, please check out the following screenshot:

            2022-04-20_132140.png

            I changed to <JlCompress.h> but it still displays these errors.

            1 Reply Last reply
            0
            • VRoninV VRonin

              @Cobra91151 said in Quazip-1.3 static linking issue:

              The content of C:/ZipDev/QuaZip folder:

              Looks good.

              #include "JlCompress.h"

              Did you try to unpack QuaZip directly in your source code? Do you have another instance of JlCompress.h in your source tree? If so delete it and also change it to #include <JlCompress.h> just in case

              Cobra91151C Offline
              Cobra91151C Offline
              Cobra91151
              wrote on last edited by Cobra91151
              #8

              @VRonin

              I have tried to unpack QuaZip directly to the source code:

              2022-04-20_133628.png

              .pro file:
              QT -= gui
              CONFIG += c++latest console static
              CONFIG -= app_bundle
              
              # You can make your code fail to compile if it uses deprecated APIs.
              # In order to do so, uncomment the following line.
              #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
              
              SOURCES += \
                      main.cpp
              
              # Default rules for deployment.
              #qnx: target.path = /tmp/$${TARGET}/bin
              #else: unix:!android: target.path = /opt/$${TARGET}/bin
              #!isEmpty(target.path): INSTALLS += target
              MOC_DIR = ./resources/moc
              OBJECTS_DIR = ./resources/objects
              RCC_DIR = ./resources/resource
              DEFINES += QUAZIP_STATIC
              #INCLUDEPATH += "C:/ZipDev/QuaZip/include/QuaZip-Qt5-1.3/quazip"
              #INCLUDEPATH += "C:/ZipDev/zlib-win-build-1.2.12"
              
              CONFIG(debug, debug|release) {
                  DESTDIR = $$OUT_PWD/debug
                  LIBS += -L"C:/Users/cobra/Documents/Projects/CPP/QuaZipTest" -lquazip1-qt5d
                  LIBS += -L"C:/ZipDev/zlib-win-build-1.2.12/build-VS2019-MT/Debug" -llibz-static
              }
              
              #QMAKE_POST_LINK = $$(QTDIR)/bin/windeployqt.exe $$shell_quote($$DESTDIR/$$shell_quote($$TARGET).exe) --no-compiler-runtime
              
              HEADERS += \
                  JlCompress.h \
                  ioapi.h \
                  minizip_crypt.h \
                  quaadler32.h \
                  quachecksum32.h \
                  quacrc32.h \
                  quagzipfile.h \
                  quaziodevice.h \
                  quazip.h \
                  quazip_global.h \
                  quazip_qt_compat.h \
                  quazipdir.h \
                  quazipfile.h \
                  quazipfileinfo.h \
                  quazipnewinfo.h \
                  unzip.h \
                  zconf.h \
                  zip.h \
                  zlib.h
              

              The same issues are still exists. Compilation log: https://pastebin.com/raw/sPKErHen

              1 Reply Last reply
              0
              • Cobra91151C Offline
                Cobra91151C Offline
                Cobra91151
                wrote on last edited by
                #9

                I have an idea. When selecting cmake compiler: -G "Visual Studio 16 2019" -A "Win32"

                It produces the following output:

                -- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19044.
                -- The C compiler identification is MSVC 19.29.30143.0
                -- The CXX compiler identification is MSVC 19.29.30143.0
                

                So, I will try to build it using VS 2022: -G "Visual Studio 17 2022" -A "Win32" to check for such issues.

                1 Reply Last reply
                0
                • VRoninV Offline
                  VRoninV Offline
                  VRonin
                  wrote on last edited by
                  #10

                  @Cobra91151 said in Quazip-1.3 static linking issue:

                  I have tried to unpack QuaZip directly to the source code:

                  No, that's a mess, please revert.

                  When selecting cmake compiler: -G "Visual Studio 16 2019" -A "Win32"

                  I wouldn't bother, just use -G"NMake Makefiles", it's a bit slower but QuaZip is not a big project and that will automatically select the compiler you are using and you won't even need to specify --config Debug.

                  In any case, this does not seem like a problem in the QuaZip build side. The library is installed correctly so that side worked, the problem is in your program using it. Can you try with a brand new project?

                  "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                  ~Napoleon Bonaparte

                  On a crusade to banish setIndexWidget() from the holy land of Qt

                  Cobra91151C 4 Replies Last reply
                  0
                  • VRoninV VRonin

                    @Cobra91151 said in Quazip-1.3 static linking issue:

                    I have tried to unpack QuaZip directly to the source code:

                    No, that's a mess, please revert.

                    When selecting cmake compiler: -G "Visual Studio 16 2019" -A "Win32"

                    I wouldn't bother, just use -G"NMake Makefiles", it's a bit slower but QuaZip is not a big project and that will automatically select the compiler you are using and you won't even need to specify --config Debug.

                    In any case, this does not seem like a problem in the QuaZip build side. The library is installed correctly so that side worked, the problem is in your program using it. Can you try with a brand new project?

                    Cobra91151C Offline
                    Cobra91151C Offline
                    Cobra91151
                    wrote on last edited by
                    #11

                    @VRonin

                    I know, it is the mess. That's why I always linking instead of unpacking everything to the source. Actually, this is the brand new project which I have created to test Quazip because in my real project it leads to the same issues. Previously, I have used the quazip-0.9.1 and it worked without issue. This issue is only with Quazip-1.3. I do not think it is related to the program. I think, something is wrong with Quazip static library. Anyway, I will try my and your solution: -G"NMake Makefiles" and reply soon.

                    1 Reply Last reply
                    0
                    • VRoninV VRonin

                      @Cobra91151 said in Quazip-1.3 static linking issue:

                      I have tried to unpack QuaZip directly to the source code:

                      No, that's a mess, please revert.

                      When selecting cmake compiler: -G "Visual Studio 16 2019" -A "Win32"

                      I wouldn't bother, just use -G"NMake Makefiles", it's a bit slower but QuaZip is not a big project and that will automatically select the compiler you are using and you won't even need to specify --config Debug.

                      In any case, this does not seem like a problem in the QuaZip build side. The library is installed correctly so that side worked, the problem is in your program using it. Can you try with a brand new project?

                      Cobra91151C Offline
                      Cobra91151C Offline
                      Cobra91151
                      wrote on last edited by
                      #12

                      @VRonin

                      I have tried both solutions with VS 2022 and NMake Makefiles, but it still displays these linking errors. So, I have found this old article: https://forum.qt.io/topic/8492/solved-cannot-get-quazip-test-to-work/2, it maked as solved but I can not find the actual post with a solution. Any ideas?

                      1 Reply Last reply
                      0
                      • VRoninV VRonin

                        @Cobra91151 said in Quazip-1.3 static linking issue:

                        I have tried to unpack QuaZip directly to the source code:

                        No, that's a mess, please revert.

                        When selecting cmake compiler: -G "Visual Studio 16 2019" -A "Win32"

                        I wouldn't bother, just use -G"NMake Makefiles", it's a bit slower but QuaZip is not a big project and that will automatically select the compiler you are using and you won't even need to specify --config Debug.

                        In any case, this does not seem like a problem in the QuaZip build side. The library is installed correctly so that side worked, the problem is in your program using it. Can you try with a brand new project?

                        Cobra91151C Offline
                        Cobra91151C Offline
                        Cobra91151
                        wrote on last edited by
                        #13

                        @VRonin

                        QuaZip VS solution uses by default: Use Multi-Byte Character Set and it could be changed to: Use Unicode Character Set or Not Set.
                        When I try to add my test project using VS 2019 -> Qt extension, it displays the charset as: Not Set.
                        So, I think it could be Use Unicode Character Set or better to set the Not Set option for this QuaZip static library when building QuaZip lib.

                        1 Reply Last reply
                        0
                        • VRoninV VRonin

                          @Cobra91151 said in Quazip-1.3 static linking issue:

                          I have tried to unpack QuaZip directly to the source code:

                          No, that's a mess, please revert.

                          When selecting cmake compiler: -G "Visual Studio 16 2019" -A "Win32"

                          I wouldn't bother, just use -G"NMake Makefiles", it's a bit slower but QuaZip is not a big project and that will automatically select the compiler you are using and you won't even need to specify --config Debug.

                          In any case, this does not seem like a problem in the QuaZip build side. The library is installed correctly so that side worked, the problem is in your program using it. Can you try with a brand new project?

                          Cobra91151C Offline
                          Cobra91151C Offline
                          Cobra91151
                          wrote on last edited by
                          #14

                          @VRonin

                          No, it does not work. I have tried a lot of different solutions but it still fails with linking issues. This is the library issue. So, I do not have any options left but to drop QuaZip and create my own library.

                          VRoninV 1 Reply Last reply
                          0
                          • Cobra91151C Cobra91151

                            @VRonin

                            No, it does not work. I have tried a lot of different solutions but it still fails with linking issues. This is the library issue. So, I do not have any options left but to drop QuaZip and create my own library.

                            VRoninV Offline
                            VRoninV Offline
                            VRonin
                            wrote on last edited by
                            #15

                            @Cobra91151 said in Quazip-1.3 static linking issue:

                            drop QuaZip and create my own library

                            That's a giant leap.

                            1. try compilying it dinamically and use it as a dll, why not
                            2. consider alternatives, like KArchive

                            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                            ~Napoleon Bonaparte

                            On a crusade to banish setIndexWidget() from the holy land of Qt

                            Cobra91151C 1 Reply Last reply
                            0
                            • VRoninV VRonin

                              @Cobra91151 said in Quazip-1.3 static linking issue:

                              drop QuaZip and create my own library

                              That's a giant leap.

                              1. try compilying it dinamically and use it as a dll, why not
                              2. consider alternatives, like KArchive
                              Cobra91151C Offline
                              Cobra91151C Offline
                              Cobra91151
                              wrote on last edited by
                              #16

                              @VRonin

                              Using DLL is not an option in my case because it must be only .exe file for installer. I do not think KArchive is worth trying since it could be the same issue at some point. I prefer code it by my own and have a full control over it. Simple lib to zip/unzip archives wrapper for Qt. Thanks.

                              1 Reply Last reply
                              0
                              • Cobra91151C Offline
                                Cobra91151C Offline
                                Cobra91151
                                wrote on last edited by
                                #17

                                Hello!

                                I have created my own CZip library which adds content to archive and extracts it.
                                The issue is resolved.

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved