I want to use openvino-opencv for my Qt (Qt5.7.1) based project. I have downloaded and installed openvino411 (corresponding to opencv411) following the instructions here in windows10 https://docs.openvinotoolkit.org/latest/_docs_install_guides_installing_openvino_windows.html#Configure_MO. I write a .pri file to demploy the opencv in Qt:
INCLUDEPATH += C:/openvino-411/openvino_2019.2.275/opencv/include
CONFIG(release, debug|release):{
LIBS += -LC:/openvino-411/openvino_2019.2.275/opencv/lib \
-lopencv_core411 -lopencv_highgui411 -lopencv_imgproc411 -lopencv_imgcodecs411 -lopencv_features2d411 -lopencv_ml411 -lopencv_objdetect411 -lopencv_dnn411
}
CONFIG(debug, debug|release):{
LIBS += -LC:/openvino-411/openvino_2019.2.275/opencv/lib \
-lopencv_core411d -lopencv_highgui411d -lopencv_imgproc411d -lopencv_imgcodecs411d -lopencv_features2d411d -lopencv_ml411d -lopencv_objdetect411d -lopencv_dnn411d
}
But it seeems opencv canot be run in Qt, since I tried running the qt program. The popping up cmd window goes directly to "Press <RETURN> to close this window..." without doing any actually.
First of all, keep in mind that OpenVINO for windows is compiled against MSBUILD instead of MinGW, so if your Qt project is compiled using MinGW, OpenVINO pre-built libraries will likely fail during linking
That said, I managed to integrate OpenVINO Inference Engine with OpenCV succesfully in a big and already existent Qt based project (QT 5.13.1), under LINUX (Ubuntu 16.04), it apperas that under Windows the dependencies fragmentation makes it harder
This configuration is quite tricky and also is a work in progress (to me), I am trying to completely isolate OpenVINO dependencies aiming to deploy them completely embedded in our app, anyway like this it works:
First I installed OpenVINO (https://docs.openvinotoolkit.org/latest/_docs_install_guides_installing_openvino_linux.html) paying particular attention in following each step precisely as it is described,
also DON'T MISS TO RUN the two examples demo_security_barrier_camera and demo_squeezenet_download_convert_run, they will produce two libraries libcpu_extension.so and libgflags_nothreads.a WITHOUT WHICH OpenVINO WILL NOT WORK UNDER YOUR PROJECT, the reason why it was made this way is unknown to me
I copied the following libraries under a subfolder of my project (ThirdPartyLibraries/OpenVINOInferenceEngine):
libinference_engine.so (found in OpenVINO installation folder: /opt/intel/openvino/inference_engine/lib/intel64/libinference_engine.so)
libtbb.so (found in OpenVINO installation folder: /opt/intel/openvino/inference_engine/external/tbb/lib/intel64/libtbb.so)
for the two "cpu extension" libraries, I created a subfolder named "extension", so:
extension/libgflags_nothreads.a (found in OpenVINO Inference Engine Demo BUILD FOLDER, for me it is /home/myuser/inference_engine_demos_build/Release/lib/libgflags_nothreads.a)
extension/libcpu_extensio.so (found in OpenVINO Inference Engine Demo BUILD FOLDER, for me it is /home/myuser/inference_engine_demos_build/Release/lib/libcpu_extensio.so)
Then I also copied the includes of Inference Engine and Lib Cpu Extension from their respective installation folders to my ThirdPartyLibraries:
All the content found under /opt/intel/openvino/inference_engine/include/ goes under /ThirdPartyLibraries/OpenVINOInferenceEngine/include
All the content found under /opt/intel/openvino/deployment_toos/inference_engine/src/extension/ goes under /ThirdPartyLibraries/OpenVINOInferenceEngine/extension/include
Finally here's my .pri file for Qt:
OPENVINODIR = /home/myuser/code_qt5_HG/Libraries/ThirdPartyLibraries/OpenVINOInferenceEngine
LIBS_OPENVINO += -L$$OPENVINODIR \
-linference_engine \
-ltbb \
-L$$OPENVINODIR/extension \
-lcpu_extension
INCLUDES_OPENVINO += $$OPENVINODIR/include \
+= $$OPENVINODIR/extension/include
LIBS += $$LIBS_OPENVINO
INCLUDEEPATH += $$INCLUDES_OPENVINO
That's it, doing so allows me to reference and use Inference Engine in my project like this:
#include <ie_core.hpp>
#include <ie_plugin_config.hpp>
#include <cpp/ie_cnn_net_reader.h>
#include <ext_list.hpp>
.....
InferenceEngine::Core ie;
ie.AddExtension(std::make_shared<InferenceEngine::Extensions::Cpu::CpuExtensions>(), "CPU");
InferenceEngine::CNNNetReader netReader;
netReader.ReadNetwork(detectorXmlPath);
netReader.getNetwork().setBatchSize(1);
netReader.ReadWeights(detectorBinPath);
InferenceEngine::InputsDataMap inputInfo(netReader.getNetwork().getInputsInfo());
.....
to deploy my App to a third party machine I need to install OpenVINO on the machine following the regular procedure (https://docs.openvinotoolkit.org/latest/_docs_install_guides_installing_openvino_linux.html) and to deploy my App as I usually do, the dependencies are then correctly resolved.
My last two cents: I am in direct contact with Intel, which is supporting me with the OpenVINO integration, according to them "all the .so files in in /deployment_tools/inference_engine/lib/intel64, from /deployment_tools/inference_engine/external/mkltiny_lnx/lib, and /deployment_tools/inference_engine/external/tbb/lib are pretty much all the dependencies required", I still didn't have the time to confirm that yet
Related
I'm attempting to install OpenSSL on Windows 10 for use with Qt development. I've tried installing from multiple sources, adding lines to my .pro file, and adding DLL files next to the built application, yet nothing works.
I've tried building and running the Qt HTTP request example, and that can't use HTTPS either, so it's not an issue with my code or configuration.
So, where should I get OpenSSL for Windows, and what do I do after installing it?
I've done this before.
For starters, you need to build OpenSSL 1.0.2 source code - available here. You'll need to follow the build instructions in the INSTALL.W32 file. And there are some amended instructions in the INSTALL.W64 file for 64-bit builds.
The two primary DLLs you will wind up building are libeay32.dll and ssleay32.dll. (Also copy off the libeay32.lib and ssleay32.lib stub files and corresponding .pdb files).
If your Qt sources are already built for OpenSSL, you can just drop these two DLLs into your Qt Bin folder (or wherever Qt5Networking.dll is loaded for your application).
If your Qt distribution is built from source, you might need to build Qt again with the openssl-linked option. This will enable Qt to be loaded via implicit DLL loading.
LIB=%LIB%;%c:\openssl\out32dll
configure -commercial release -opengl dynamic openssl-linked -force-debug-info -nomake examples -llibeay32 -lssleay32
jom
For a debug build to correspond to debug Qt5 binaries, you'll need to repeat the above steps, except follow the OpenSSL instructions for building debug binaries to the out32dll.dbg folder.
If your qt distribution was built with dynamic openssl loading, you just need to make sure ssleay32.dll and libeay32.dll are in a folder that is in your PATH environment variable.
The goal is to show pdf's on my target => imx6 board + display. My host's OS is Linux.
So far i'm having a program written in Qt 5.
It compiles fine and i'm able to see it on the display.
To show some pdfs i would like to use the poppler library.
The problem is that i'm not able to get this done. Properly ...
My steps so far:
I did the basic installation of poppler like it is described in the INSTALL file.
mkdir build
cd build
cmake ..
make
make install
then added
INCLUDEPATH += /home/user/poppler/include/poppler/qt5
LIBS += -L"/home/user/poppler/lib" -lpoppler-qt5
to my .pro file
and the #include <poppler-qt5.h> to my .cpp file.
And the result when running is this:
/home/user/poppler/lib/libpoppler-qt5.so:-1: error: file not recognized: File format not recognized
:-1: error: collect2: error: ld returned 1 exit status
Now i have just two ideas. First one is to cross-compile the poppler source code. (I tried this with a toolchain file but failed :'D)
Second idea is to put the library into Qt together with my project and compile it there - maybe that could work. I just don't know how. Help.
I'm also open for something else then poppler - i just want to show pdf's.
The problem, here, is you are somehow compiling Qt projects for ARM, using the corresponding toolchain and sysroot and ABI, and you can not just link to libraries you compiled for, say, x86_64, because they're just binary incompatible.
In the very lucky case you managed to configure creator for cross compilation, just make a creator project for the poppler library, using cmake, and configure the project with the same kit you use for the imx6 applications. Once you have it built for ARM, you can proper link it in your app, providing the full path to LIBS in the .pro file.
In case you're using Yocto, instead, just make a recipe for poppler. In case you're not, maybe you should.
I developing a GUI app with Qt 5.1 and QtCreator 2.8.0 and I'm using a shared library (also compiled with Qt 5.1).
This is what I'm using in the .pro file:
INCLUDEPATH += ../MyLib
QMAKE_LIBDIR += ../MyLib/build/release
LIBS += -lMyLib
Regarding the "Run Configuration" (QtCreator) and under Linux (Ubuntu 12.04) I set the LD_LIBRARY_PATH to "(...)/MyLib/build/release" and it works well. However, on Windows, appending the library path (.dll) to PATH doesn't work. I don't get any compiling nor linking errors but when I run the app it immediately exits. If I put the .dll on the same folder as the executable it runs without any problem. Am I missing something?
Hard to say from the information you gave. Surely Windows does find the dll if you put its path into PATH. But maybe your dll uses another dll, which is not in the normal search path?
You might want to try the dependency walker: http://www.dependencywalker.com/
If your dll is based on Qt it might be that it does not find necessary qt plugins.
Check this out: http://qt-project.org/doc/qt-4.8/deployment-windows.html#application-dependencies
Qt 4, but Qt 5 is the same in this regard.
I wanted to migrate my Qt 4 app to use Qt 5 instead. These instructions failed, due to some differences with how MXE builds Qt 5, including the fact that it uses modularised Qt tarballs, instead of one large tarball.
Here are the full instructions:
Get it:
git clone https://github.com/mxe/mxe.git
Install build dependencies
Build Qt 5 for Windows:
cd mxe && make qtbase
This will first build its dependencies and the cross-build tools;
It should take less than an hour on a fast machine with decent internet access.
Due to the new modular nature of Qt 5, various major Qt components are now in different tarballs. The one selected above, qtbase, should give you enough functionality to run ordinary GUI apps, which is all I needed for my own (smallish) app.
If you want to build all of Qt 5 instead, you'll need to run make qt5 (instead of make qtbase). Note that it will take a lot longer to complete, so be sure that you need the extra functionality.
Get to the directory of your app, and run the Qt Makefile generator tool:
<mxe root>/usr/bin/i686-w64-mingw32.static-qmake-qt5
Build your project:
make
You should find the binary in the ./release directory:
wine release/foo.exe
Some notes:
This was tested on my 64-bit Debian 8, and on Windows of course.
The output is a 32-bit static executable, which will work well on 64-bit Windows.
If you want a 64-bit executable, build Qt with:
make MXE_TARGETS=x86_64-w64-mingw32.static qtbase
The default MXE_TARGETS value is i686-w64-mingw32.static.
The git checkout command is not correct. You now have to get their stable branch or it will fail building.
git clone https://github.com/mxe/mxe.git
should be...
git clone -b stable https://github.com/mxe/mxe.git
That alone fixed all my issues with qtbase building but leaving no qt folder when done. Then qt5 target would fail with obscure errors. Deleted folder, checked out stable and it worked flawlessly.
For those who directly want a GCC10 64bit compiled Qt5 (for filesystem lib for example),
Here are the full instructions:
Get it:
git clone https://github.com/mxe/mxe.git
Install build dependencies
Build Qt 5 for Windows with gcc10 64bits plugin activated :
cd mxe && make MXE_TARGETS=x86_64-w64-mingw32.shared MXE_PLUGIN_DIRS=plugins/gcc10 qt5
After 2-3 hours of build you can build your app (in your .pro directory) :
<mxe root>/usr/x86_64-w64-mingw32.shared/qt5/bin/qmake
Export path of compiler & build your project:
export PATH=<mxe root>/usr/bin:$PATH
make
You should find the binary in the ./release directory & start it with wine (or wine64) :
wine foo.exe
I don't really know why, but I needed to add the MXE compiler directory to the wine path because it's couldn't find the DLLs :
WINEPATH="<mxe root>/usr/x86_64-w64-mingw32.shared/bin/" wine64 foo.exe
If you try to do this, for me work fine!
su
mv mxe /opt/mxe
cd /opt/mxe && make
I want to create a tiny app which needs global shortcuts. So, I have downloaded the current version of libqxt (0.5.1) and opened as a project in Qt Creator.
Libqxt compiles without problems in this way, so I thought that adding this in the tab Dependencies of my project it would get added automatically in the build, like Eclipse does with JAR libraries (I know that are different IDEs but it seems to be a common feature among them).
What happens? Qt Creator compiles qxt before my project, when needed, but when I want to include its headers Qt Creator keeps warning me that it cannot find them.
Probably I am missing the correct name of headers (I tried the headers showed in qxt documentation: http://doc.libqxt.org/0.5.0/classQxtGlobalShortcut.html)
By the way, I looked the code for global shortcuts and I think I can rip it out and use it in my app as is and I am going to credit qxt team and open the code of my app.
from the documentation
Add the following lines to your .pro file:
CONFIG += qxt
QXT += core gui
Note: While building the Qxt on Linux do not forget to do a sudo make install otherwise this little piece of magic may fail to work.
Qt Creator doesn't know how to expose different libraries to your projects. It's developer's duty. Dependency ensures only that mentioned projects are already built before building your main project.
Your real concern was using Qxt without proper installation. Assuming that configure have been run and libqxt have been built (using Qt Creator or manually via qmake+make), my solution is adding following snippet (with obvious QXT_DIR customization) to .pro file:
QXT_DIR = $${IN_PWD}/../libqxt-0.5.1
LIBS += -L$${QXT_DIR}/deploy/libs
INCLUDEPATH += $${QXT_DIR}/deploy/include
for(module, QXT) {
MODNAME = $$upper($$replace(module, "(.).*", "\1"))$$replace(module, "^.", "")
INCLUDEPATH += $${QXT_DIR}/deploy/include/Qxt$${MODNAME}
INCLUDEPATH += $${QXT_DIR}/src/$${module}
win32:CONFIG(debug, debug|release):MODNAME = $$join(MODNAME,,,d)
LIBS += -lQxt$${MODNAME}
}
Unfortunately I'm not sure whether it works in complex projects.
By default Qxt is built in release mode, but Qt Creator uses debug mode and it leads to broken binaries of projects depending on Qxt under Windows. You have to switch your project to release mode or build Qxt in debug mode (run configure -debug and rebuild Qxt).
Last thing: In Windows you won't be able to run your project from Qt Creator even if you successfully build it. You must copy needed Qwt*.dll files (use the d-suffix versions if you're in debug mode) from libqxt-0.5.1/deploy/libs to your_project/(release|debug) directory .