ZBar / QZBar -> error while loading shared libraries: libzbarqt.so.0: cannot open shared object file: No such file or directory
-
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 -
HI
are those libzbar.a and libzbarqt.a compiled(created) with same compiler as
the one you are using for the test program ? -
HI
are those libzbar.a and libzbarqt.a compiled(created) with same compiler as
the one you are using for the test program ? -
@mrjj :
Yes. I compiled the libraries with the same compiler.
I have libzbar.a/.so and libzbarqt./.so. -
@MHermann Is the lib really inside $$PWD/QZBar? Maybe it is in a subdirectory? Can you post the linker call?
@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?
-
@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?
-
@jsulm : In the folder QZBar I have the following files:
-
libzbar.a
-
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.so (link to libzbarqt.0.0.2)
-
libzbarqt.so.0 (link to libzbarqt.0.0.2)
-
libzbarqt.0.0.2
-
-
@jsulm : In the folder QZBar I have the following files:
-
libzbar.a
-
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.so (link to libzbarqt.0.0.2)
-
libzbarqt.so.0 (link to libzbarqt.0.0.2)
-
libzbarqt.0.0.2
@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. -
-
@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.