Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. The conflict between quazip and mupdf-qt
Forum Updated to NodeBB v4.3 + New Features

The conflict between quazip and mupdf-qt

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
9 Posts 4 Posters 4.0k Views 2 Watching
  • 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.
  • AlexorleonA Offline
    AlexorleonA Offline
    Alexorleon
    wrote on last edited by
    #1

    Hi.

    In my project, I use quazip to work with the archive. Now it was necessary to draw a PDF document. For this, I decided to use mupdf-qt, but if they are used simultaneously, an error occurs. I absolutely do not understand what this is connected with.
    Maybe you can tell me what the problem is?

    QuaZIP
    https://github.com/mnafees/quazip

    mupdf-qt
    https://github.com/xiangxw/mupdf-qt

    Ubuntu 14.04, 64bit
    Qt 5.7.1

    .pro

    ...
    
    DEFINES += QUAZIP_STATIC
    
    unix {
        # quazip
        QUAZIPCODEDIR = "/home/alexorleon/QtProjects/libs/quazip-0.7.2/quazip"
        ZLIBCODEDIR = "/home/alexorleon/QtProjects/libs/Libs"
        INCLUDEPATH += $${QUAZIPCODEDIR}
        LIBS += -L$${ZLIBCODEDIR} -lz
    
        # mupdf-qt
        INCLUDEPATH += "/home/alexorleon/Development/Projects/mupdf-qt/include"
        LIBS += -L/home/alexorleon/Development/Projects/mupdf-qt/build/lib -lmupdf-qt
        LIBS += -L/home/alexorleon/Development/Projects/mupdf-qt/mupdf/build/debug/ -lmupdf  -ljpeg -lfreetype -lz -ljbig2dec -lcrypto -ldl -lmujs -lopenjpeg
    }
    
    SOURCES += main.cpp \
        $${QUAZIPCODEDIR}/*.cpp \
        $${QUAZIPCODEDIR}/*.c
    
    HEADERS += $${QUAZIPCODEDIR}/*.h
    ...
    
    

    main.cpp

    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    #include <QImage>
    #include <QDebug>
    
    #include "JlCompress.h"
    #include "mupdf-qt.h"
    
    int main(int argc, char *argv[])
    {
        QGuiApplication app(argc, argv);
    
    
        QQmlApplicationEngine engine;
        engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    
        JlCompress::extractDir("/home/alexorleon/Deployment/doc.zip", "/home/alexorleon/Deployment/temp");
    
        QString filename("/home/alexorleon/doc.pdf");
        MuPDF::Document *document = MuPDF::loadDocument(filename);
        if (document) {
    
            // number of pages
            qDebug() << "pages: " << document->numPages();
            // other informations
            qDebug() << "version: " << document->pdfVersion();
            qDebug() << "title: " << document->title();
            qDebug() << "author: " << document->author();
            qDebug() << "subject: " << document->subject();
            qDebug() << "keywords: " << document->keywords();
            qDebug() << "creator: " << document->creator();
            qDebug() << "producer: " << document->producer();
            //qDebug() << "creation date: " << document->creationDate();
            //qDebug() << "recently modify date: " << document->modDate();
    
            MuPDF::Page *page = document->page(1);
            if (page) {
                float scaleX = 1.0f;
                float scaleY = 1.0f;
                float rotation = 0.0f;
                QImage image = page->renderImage(scaleX, scaleY, rotation);
                // do something with the QImage
                image.save("/home/alexorleon/test.jpeg", "JPEG");
                // do not forget this
                delete page;
            }
    
            // do not forget to delete it
            delete document;
        }
    
        return app.exec();
    }
    

    error: quagzipfile.o: undefined character reference «gzdopen»
    /lib/x86_64-linux-gnu/libz.so.1:-1: error: error adding symbols: DSO missing from command line
    error: collect2: error: ld returned 1 exit status

    But if I comment out one of the libraries, then everything works.
    For example:

    # quazip
    #QUAZIPCODEDIR = "/home/alexorleon/QtProjects/libs/quazip-0.7.2/quazip"
    #ZLIBCODEDIR = "/home/alexorleon/QtProjects/libs/Libs"
    #INCLUDEPATH += $${QUAZIPCODEDIR}
    #LIBS += -L$${ZLIBCODEDIR} -lz
    
    //#include "JlCompress.h"
    
    //JlCompress::extractDir("/home/alexorleon/Deployment/doc.zip", "/home/alexorleon/Deployment/temp");
    
    A 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Did you build these two libraries yourself ?
      Which version of gcc are you using ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      AlexorleonA 1 Reply Last reply
      0
      • AlexorleonA Alexorleon

        Hi.

        In my project, I use quazip to work with the archive. Now it was necessary to draw a PDF document. For this, I decided to use mupdf-qt, but if they are used simultaneously, an error occurs. I absolutely do not understand what this is connected with.
        Maybe you can tell me what the problem is?

        QuaZIP
        https://github.com/mnafees/quazip

        mupdf-qt
        https://github.com/xiangxw/mupdf-qt

        Ubuntu 14.04, 64bit
        Qt 5.7.1

        .pro

        ...
        
        DEFINES += QUAZIP_STATIC
        
        unix {
            # quazip
            QUAZIPCODEDIR = "/home/alexorleon/QtProjects/libs/quazip-0.7.2/quazip"
            ZLIBCODEDIR = "/home/alexorleon/QtProjects/libs/Libs"
            INCLUDEPATH += $${QUAZIPCODEDIR}
            LIBS += -L$${ZLIBCODEDIR} -lz
        
            # mupdf-qt
            INCLUDEPATH += "/home/alexorleon/Development/Projects/mupdf-qt/include"
            LIBS += -L/home/alexorleon/Development/Projects/mupdf-qt/build/lib -lmupdf-qt
            LIBS += -L/home/alexorleon/Development/Projects/mupdf-qt/mupdf/build/debug/ -lmupdf  -ljpeg -lfreetype -lz -ljbig2dec -lcrypto -ldl -lmujs -lopenjpeg
        }
        
        SOURCES += main.cpp \
            $${QUAZIPCODEDIR}/*.cpp \
            $${QUAZIPCODEDIR}/*.c
        
        HEADERS += $${QUAZIPCODEDIR}/*.h
        ...
        
        

        main.cpp

        #include <QGuiApplication>
        #include <QQmlApplicationEngine>
        #include <QImage>
        #include <QDebug>
        
        #include "JlCompress.h"
        #include "mupdf-qt.h"
        
        int main(int argc, char *argv[])
        {
            QGuiApplication app(argc, argv);
        
        
            QQmlApplicationEngine engine;
            engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
        
            JlCompress::extractDir("/home/alexorleon/Deployment/doc.zip", "/home/alexorleon/Deployment/temp");
        
            QString filename("/home/alexorleon/doc.pdf");
            MuPDF::Document *document = MuPDF::loadDocument(filename);
            if (document) {
        
                // number of pages
                qDebug() << "pages: " << document->numPages();
                // other informations
                qDebug() << "version: " << document->pdfVersion();
                qDebug() << "title: " << document->title();
                qDebug() << "author: " << document->author();
                qDebug() << "subject: " << document->subject();
                qDebug() << "keywords: " << document->keywords();
                qDebug() << "creator: " << document->creator();
                qDebug() << "producer: " << document->producer();
                //qDebug() << "creation date: " << document->creationDate();
                //qDebug() << "recently modify date: " << document->modDate();
        
                MuPDF::Page *page = document->page(1);
                if (page) {
                    float scaleX = 1.0f;
                    float scaleY = 1.0f;
                    float rotation = 0.0f;
                    QImage image = page->renderImage(scaleX, scaleY, rotation);
                    // do something with the QImage
                    image.save("/home/alexorleon/test.jpeg", "JPEG");
                    // do not forget this
                    delete page;
                }
        
                // do not forget to delete it
                delete document;
            }
        
            return app.exec();
        }
        

        error: quagzipfile.o: undefined character reference «gzdopen»
        /lib/x86_64-linux-gnu/libz.so.1:-1: error: error adding symbols: DSO missing from command line
        error: collect2: error: ld returned 1 exit status

        But if I comment out one of the libraries, then everything works.
        For example:

        # quazip
        #QUAZIPCODEDIR = "/home/alexorleon/QtProjects/libs/quazip-0.7.2/quazip"
        #ZLIBCODEDIR = "/home/alexorleon/QtProjects/libs/Libs"
        #INCLUDEPATH += $${QUAZIPCODEDIR}
        #LIBS += -L$${ZLIBCODEDIR} -lz
        
        //#include "JlCompress.h"
        
        //JlCompress::extractDir("/home/alexorleon/Deployment/doc.zip", "/home/alexorleon/Deployment/temp");
        
        A Offline
        A Offline
        ambershark
        wrote on last edited by
        #3

        @Alexorleon said in The conflict between quazip and mupdf-qt:

        error: quagzipfile.o: undefined character reference «gzdopen»
        /lib/x86_64-linux-gnu/libz.so.1:-1: error: error adding symbols: DSO missing from command line

        This error comes from linking order. You are linking your objects that use the library after the library itself. Change your link order and it should work.

        Your problem should be in these lines:

            LIBS += -L/home/alexorleon/Development/Projects/mupdf-qt/build/lib -lmupdf-qt
            LIBS += -L/home/alexorleon/Development/Projects/mupdf-qt/mupdf/build/debug/ -lmupdf  -ljpeg -lfreetype -lz -ljbig2dec -lcrypto -ldl -lmujs -lopenjpeg
        

        My guess is move that -lz further down the line... try at the end maybe.

        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

        kshegunovK AlexorleonA 2 Replies Last reply
        2
        • A ambershark

          @Alexorleon said in The conflict between quazip and mupdf-qt:

          error: quagzipfile.o: undefined character reference «gzdopen»
          /lib/x86_64-linux-gnu/libz.so.1:-1: error: error adding symbols: DSO missing from command line

          This error comes from linking order. You are linking your objects that use the library after the library itself. Change your link order and it should work.

          Your problem should be in these lines:

              LIBS += -L/home/alexorleon/Development/Projects/mupdf-qt/build/lib -lmupdf-qt
              LIBS += -L/home/alexorleon/Development/Projects/mupdf-qt/mupdf/build/debug/ -lmupdf  -ljpeg -lfreetype -lz -ljbig2dec -lcrypto -ldl -lmujs -lopenjpeg
          

          My guess is move that -lz further down the line... try at the end maybe.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4
          SOURCES += main.cpp \
              $${QUAZIPCODEDIR}/*.cpp \
              $${QUAZIPCODEDIR}/*.c
          
          HEADERS += $${QUAZIPCODEDIR}/*.h
          

          ??!

          Why do you add the source directly in your build tree?

          Read and abide by the Qt Code of Conduct

          A 1 Reply Last reply
          3
          • kshegunovK kshegunov
            SOURCES += main.cpp \
                $${QUAZIPCODEDIR}/*.cpp \
                $${QUAZIPCODEDIR}/*.c
            
            HEADERS += $${QUAZIPCODEDIR}/*.h
            

            ??!

            Why do you add the source directly in your build tree?

            A Offline
            A Offline
            ambershark
            wrote on last edited by
            #5

            @kshegunov said in The conflict between quazip and mupdf-qt:

            SOURCES += main.cpp \
                $${QUAZIPCODEDIR}/*.cpp \
                $${QUAZIPCODEDIR}/*.c
            
            HEADERS += $${QUAZIPCODEDIR}/*.h
            

            ??!

            Why do you add the source directly in your build tree?

            I didn't even notice that. I wasn't looking thoroughly though since I knew what was the likely culprit based on the error. That is definitely a contributing factor to the error though.

            He definitely needs to remove that from his qmake. Good catch!

            My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

            1 Reply Last reply
            2
            • SGaistS SGaist

              Hi,

              Did you build these two libraries yourself ?
              Which version of gcc are you using ?

              AlexorleonA Offline
              AlexorleonA Offline
              Alexorleon
              wrote on last edited by
              #6

              @SGaist Yes, both libraries I compiled by myself. gcc version 4.8.4

              1 Reply Last reply
              0
              • A ambershark

                @Alexorleon said in The conflict between quazip and mupdf-qt:

                error: quagzipfile.o: undefined character reference «gzdopen»
                /lib/x86_64-linux-gnu/libz.so.1:-1: error: error adding symbols: DSO missing from command line

                This error comes from linking order. You are linking your objects that use the library after the library itself. Change your link order and it should work.

                Your problem should be in these lines:

                    LIBS += -L/home/alexorleon/Development/Projects/mupdf-qt/build/lib -lmupdf-qt
                    LIBS += -L/home/alexorleon/Development/Projects/mupdf-qt/mupdf/build/debug/ -lmupdf  -ljpeg -lfreetype -lz -ljbig2dec -lcrypto -ldl -lmujs -lopenjpeg
                

                My guess is move that -lz further down the line... try at the end maybe.

                AlexorleonA Offline
                AlexorleonA Offline
                Alexorleon
                wrote on last edited by
                #7

                @ambershark Yes, I tried to do so. It did not help.

                @kshegunov This is necessary to use .c files. Maybe, I do not remember ;) Maybe I should try to add only specific files.

                1 Reply Last reply
                0
                • AlexorleonA Offline
                  AlexorleonA Offline
                  Alexorleon
                  wrote on last edited by
                  #8

                  From time to time I try different solutions, but for now I decided to use poppler. Everything is working.

                  1 Reply Last reply
                  0
                  • AlexorleonA Offline
                    AlexorleonA Offline
                    Alexorleon
                    wrote on last edited by
                    #9

                    If I comment the lines

                    SOURCES += main.cpp# \
                        #$${QUAZIPCODEDIR}/*.cpp \
                        #$${QUAZIPCODEDIR}/*.c
                    
                    #HEADERS += $${QUAZIPCODEDIR}/*.h
                    

                    error: undefined reference to `JlCompress::extractDir(QString, QString)'

                    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