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. ZBar / QZBar -> error while loading shared libraries: libzbarqt.so.0: cannot open shared object file: No such file or directory
QtWS25 Last Chance

ZBar / QZBar -> error while loading shared libraries: libzbarqt.so.0: cannot open shared object file: No such file or directory

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 3 Posters 3.1k 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.
  • M Offline
    M Offline
    MHermann
    wrote on last edited by
    #1

    Hi all,

    I want to use the ZBar / QZBar library for barcode scanning.
    I have included the header files in my source code and I think the libraries are also included correctly in the .pro file.

    INCLUDEPATH += $$PWD/QZBar/include
    INCLUDEPATH += $$PWD/QZBar/include/zbar
    DEPENDPATH += $$PWD/QZBar
    
    LIBS += -L$$PWD/QZBar/ -lzbar
    PRE_TARGETDEPS += $$PWD/QZBar/libzbar.a
    
    LIBS += -L$$PWD/QZBar/ -lzbarqt
    PRE_TARGETDEPS += $$PWD/QZBar/libzbarqt.a
    
    QMAKE_LFLAGS += -Wl,-rpath,"'$$ORIGIN/QZBar'"
    

    But everytime I try to create a new instance of e.g. QZBar or ImageScanner, I get the error:

    error while loading shared libraries: libzbarqt.so.0: cannot open shared object file: No such file or directory
    
    Child exited with status 127
    

    Does anyone know what is the cause for this?
    Has anyone used ZBar / QZBar successfully in qt / qml before and can share a running example?
    Maybe also a snippet of the .pro file how the libraries are included would be helpful.

    Kind regards,
    MHermann

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      HI
      are those libzbar.a and libzbarqt.a compiled(created) with same compiler as
      the one you are using for the test program ?

      M 1 Reply Last reply
      0
      • mrjjM mrjj

        HI
        are those libzbar.a and libzbarqt.a compiled(created) with same compiler as
        the one you are using for the test program ?

        M Offline
        M Offline
        MHermann
        wrote on last edited by
        #3

        @mrjj :
        Yes. I compiled the libraries with the same compiler.
        I have libzbar.a/.so and libzbarqt./.so.

        jsulmJ 1 Reply Last reply
        0
        • M MHermann

          @mrjj :
          Yes. I compiled the libraries with the same compiler.
          I have libzbar.a/.so and libzbarqt./.so.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @MHermann Is the lib really inside $$PWD/QZBar? Maybe it is in a subdirectory? Can you post the linker call?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          M 1 Reply Last reply
          2
          • jsulmJ jsulm

            @MHermann Is the lib really inside $$PWD/QZBar? Maybe it is in a subdirectory? Can you post the linker call?

            M Offline
            M Offline
            MHermann
            wrote on last edited by MHermann
            #5

            @jsulm : Sorry for answering late...
            Yes. I think it is in the right directory.

            Development environment:

            /home/me/Repos/Cam_Test/Cam_Test.pro
            /home/me/Repos/Cam_Test/QZBar/libzbar.a
            /home/me/Repos/Cam_Test/QZBar/libzbarqt.a
            

            Running environment:

            /home/other/Cam_Test/executable
            /home/other/Cam_Test/QZBar/libzbar.a
            /home/other/Cam_Test/QZBar/libzbarqt.a
            

            And here is the linker call:

            g++ -Wl,-rpath,'/QZBar' -Wl,-rpath,/usr/local/qt5/lib -Wl,-rpath,/home/me/Qt/5.9.1/gcc_64/lib -Wl,-rpath-link,/home/me/Qt/5.9.1/gcc_64/lib -o CamTest main.o qzxingBarcodeReader.o adaptorQZXingBarcodeReader.o adaptorZBarBarcodeReader.o qzbarBarcodeReader.o CameraImageWrapper.o QZXing.o ImageHandler.o ResultIO.o InvertedLuminanceSource.o ChecksumException.o ResultPointCallback.o ResultPoint.o Result.o Reader.o MultiFormatReader.o LuminanceSource.o FormatException.o Exception.o DecodeHints.o BinaryBitmap.o Binarizer.o BarcodeFormat.o AztecReader.o AztecDetectorResult.o StringUtils.o Str.o PerspectiveTransform.o IllegalArgumentException.o HybridBinarizer.o GridSampler.o GreyscaleRotatedLuminanceSource.o GreyscaleLuminanceSource.o GlobalHistogramBinarizer.o DetectorResult.o DecoderResult.o CharacterSetECI.o BitSource.o BitMatrix.o BitArray.o BitArrayIO.o WhiteRectangleDetector.o MonochromeRectangleDetector.o ReedSolomonException.o ReedSolomonDecoder.o GenericGFPoly.o GenericGF.o DataMatrixReader.o UPCEReader.o UPCEANReader.o UPCAReader.o OneDResultPoint.o OneDReader.o MultiFormatUPCEANReader.o MultiFormatOneDReader.o ITFReader.o EAN13Reader.o EAN8Reader.o Code128Reader.o Code39Reader.o CodaBarReader.o Code93Reader.o QRCodeReader.o MultipleBarcodeReader.o GenericMultipleBarcodeReader.o ByQuadrantReader.o QRCodeMultiReader.o MultiFinderPatternFinder.o MultiDetector.o AztecDecoder.o AztecDetector.o DataMatrixVersion.o DataMatrixDecoder.o DataMatrixBitMatrixParser.o DataMatrixDataBlock.o DataMatrixDecodedBitStreamParser.o DataMatrixCornerPoint.o DataMatrixDetector.o DataMatrixDetectorException.o QRBitMatrixParser.o QRDataBlock.o QRDataMask.o QRDecodedBitStreamParser.o QRDecoder.o QRMode.o QRAlignmentPattern.o QRAlignmentPatternFinder.o QRDetector.o QRFinderPattern.o QRFinderPatternFinder.o QRFinderPatternInfo.o QRVersion.o QRFormatInformation.o QRErrorCorrectionLevel.o ErrorCorrection.o ModulusGF.o ModulusPoly.o PDF417BitMatrixParser.o PDF417DecodedBitStreamParser.o PDF417Decoder.o PDF417Detector.o LinesSampler.o PDF417Reader.o BigUnsignedInABase.o BigUnsigned.o BigIntegerUtils.o BigIntegerAlgorithms.o BigInteger.o ByteMatrix.o QREncoder.o MaskUtil.o MatrixUtil.o QRCode.o EncodeHint.o ReedSolomonEncoder.o qrc_qml.o moc_qzxingBarcodeReader.o moc_adaptorQZXingBarcodeReader.o moc_adaptorZBarBarcodeReader.o moc_qzbarBarcodeReader.o moc_ImageHandler.o moc_QZXing.o   -L/home/me/Repos/Cam_Test/QZBar/ -lzbar -lzbarqt -L/home/me/Qt/5.9.1/gcc_64/lib -lQt5Quick -lQt5MultimediaWidgets -lpulse-mainloop-glib -lpulse -lglib-2.0 -lQt5Widgets -lQt5Multimedia -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGL -lpthread 
            

            I copied the folder with the libs and include files from my developing environment to my running environment. Is this correct? Maybe there are some problems with some links?

            jsulmJ 1 Reply Last reply
            0
            • M MHermann

              @jsulm : Sorry for answering late...
              Yes. I think it is in the right directory.

              Development environment:

              /home/me/Repos/Cam_Test/Cam_Test.pro
              /home/me/Repos/Cam_Test/QZBar/libzbar.a
              /home/me/Repos/Cam_Test/QZBar/libzbarqt.a
              

              Running environment:

              /home/other/Cam_Test/executable
              /home/other/Cam_Test/QZBar/libzbar.a
              /home/other/Cam_Test/QZBar/libzbarqt.a
              

              And here is the linker call:

              g++ -Wl,-rpath,'/QZBar' -Wl,-rpath,/usr/local/qt5/lib -Wl,-rpath,/home/me/Qt/5.9.1/gcc_64/lib -Wl,-rpath-link,/home/me/Qt/5.9.1/gcc_64/lib -o CamTest main.o qzxingBarcodeReader.o adaptorQZXingBarcodeReader.o adaptorZBarBarcodeReader.o qzbarBarcodeReader.o CameraImageWrapper.o QZXing.o ImageHandler.o ResultIO.o InvertedLuminanceSource.o ChecksumException.o ResultPointCallback.o ResultPoint.o Result.o Reader.o MultiFormatReader.o LuminanceSource.o FormatException.o Exception.o DecodeHints.o BinaryBitmap.o Binarizer.o BarcodeFormat.o AztecReader.o AztecDetectorResult.o StringUtils.o Str.o PerspectiveTransform.o IllegalArgumentException.o HybridBinarizer.o GridSampler.o GreyscaleRotatedLuminanceSource.o GreyscaleLuminanceSource.o GlobalHistogramBinarizer.o DetectorResult.o DecoderResult.o CharacterSetECI.o BitSource.o BitMatrix.o BitArray.o BitArrayIO.o WhiteRectangleDetector.o MonochromeRectangleDetector.o ReedSolomonException.o ReedSolomonDecoder.o GenericGFPoly.o GenericGF.o DataMatrixReader.o UPCEReader.o UPCEANReader.o UPCAReader.o OneDResultPoint.o OneDReader.o MultiFormatUPCEANReader.o MultiFormatOneDReader.o ITFReader.o EAN13Reader.o EAN8Reader.o Code128Reader.o Code39Reader.o CodaBarReader.o Code93Reader.o QRCodeReader.o MultipleBarcodeReader.o GenericMultipleBarcodeReader.o ByQuadrantReader.o QRCodeMultiReader.o MultiFinderPatternFinder.o MultiDetector.o AztecDecoder.o AztecDetector.o DataMatrixVersion.o DataMatrixDecoder.o DataMatrixBitMatrixParser.o DataMatrixDataBlock.o DataMatrixDecodedBitStreamParser.o DataMatrixCornerPoint.o DataMatrixDetector.o DataMatrixDetectorException.o QRBitMatrixParser.o QRDataBlock.o QRDataMask.o QRDecodedBitStreamParser.o QRDecoder.o QRMode.o QRAlignmentPattern.o QRAlignmentPatternFinder.o QRDetector.o QRFinderPattern.o QRFinderPatternFinder.o QRFinderPatternInfo.o QRVersion.o QRFormatInformation.o QRErrorCorrectionLevel.o ErrorCorrection.o ModulusGF.o ModulusPoly.o PDF417BitMatrixParser.o PDF417DecodedBitStreamParser.o PDF417Decoder.o PDF417Detector.o LinesSampler.o PDF417Reader.o BigUnsignedInABase.o BigUnsigned.o BigIntegerUtils.o BigIntegerAlgorithms.o BigInteger.o ByteMatrix.o QREncoder.o MaskUtil.o MatrixUtil.o QRCode.o EncodeHint.o ReedSolomonEncoder.o qrc_qml.o moc_qzxingBarcodeReader.o moc_adaptorQZXingBarcodeReader.o moc_adaptorZBarBarcodeReader.o moc_qzbarBarcodeReader.o moc_ImageHandler.o moc_QZXing.o   -L/home/me/Repos/Cam_Test/QZBar/ -lzbar -lzbarqt -L/home/me/Qt/5.9.1/gcc_64/lib -lQt5Quick -lQt5MultimediaWidgets -lpulse-mainloop-glib -lpulse -lglib-2.0 -lQt5Widgets -lQt5Multimedia -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGL -lpthread 
              

              I copied the folder with the libs and include files from my developing environment to my running environment. Is this correct? Maybe there are some problems with some links?

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @MHermann *.a are static libraries not shared.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              M 2 Replies Last reply
              0
              • jsulmJ jsulm

                @MHermann *.a are static libraries not shared.

                M Offline
                M Offline
                MHermann
                wrote on last edited by
                #7

                @jsulm : All the libraries with the suffix .so are also in the same folders like the .a.

                1 Reply Last reply
                0
                • jsulmJ jsulm

                  @MHermann *.a are static libraries not shared.

                  M Offline
                  M Offline
                  MHermann
                  wrote on last edited by MHermann
                  #8

                  @jsulm : In the folder QZBar I have the following files:

                  • libzbar.a

                  • libzbar.la

                  • libzbar.so (link to libzbar.so.0.2.0)

                  • libzbar.so.0 (link to libzbar.so.0.2.0)

                  • libzbar.so.0.2.0

                  • libzbarqt.a

                  • libzbarqt.la

                  • libzbarqt.so (link to libzbarqt.0.0.2)

                  • libzbarqt.so.0 (link to libzbarqt.0.0.2)

                  • libzbarqt.0.0.2

                  jsulmJ 1 Reply Last reply
                  0
                  • M MHermann

                    @jsulm : In the folder QZBar I have the following files:

                    • libzbar.a

                    • libzbar.la

                    • libzbar.so (link to libzbar.so.0.2.0)

                    • libzbar.so.0 (link to libzbar.so.0.2.0)

                    • libzbar.so.0.2.0

                    • libzbarqt.a

                    • libzbarqt.la

                    • libzbarqt.so (link to libzbarqt.0.0.2)

                    • libzbarqt.so.0 (link to libzbarqt.0.0.2)

                    • libzbarqt.0.0.2

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @MHermann Your problem isn't building but starting the app, right?
                    If so, then you need to deploy your app, see http://doc.qt.io/qt-5/linux-deployment.html
                    You need to create a directory containing your executable and needed libraries, else the loader cannot find these libraries as they are not in any of the directories the loader is looking into to find libraries. Try to copy libzbarqt.so.0 into the same directory where your executable is.

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    M 1 Reply Last reply
                    2
                    • jsulmJ jsulm

                      @MHermann Your problem isn't building but starting the app, right?
                      If so, then you need to deploy your app, see http://doc.qt.io/qt-5/linux-deployment.html
                      You need to create a directory containing your executable and needed libraries, else the loader cannot find these libraries as they are not in any of the directories the loader is looking into to find libraries. Try to copy libzbarqt.so.0 into the same directory where your executable is.

                      M Offline
                      M Offline
                      MHermann
                      wrote on last edited by
                      #10

                      @jsulm : Thanks for your answers.
                      I found the solution. I had a typing error when indicating the LD_LIBRARY_PATH in the Run Environment.
                      I corrected the path for LD_LIBRARY_PATH and now my application is running on the target system.

                      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