libpqxx on raspberry pi - qt

I have a desktop(ubuntu 14.04 64 bit) QT application which uses libpqxx(c++ library for Postgres). The GUI app is an interface to the postgress database and does a lot of operations. Now, I am trying to port this application to a raspberry pi3. I started with a test QT app. Used cross-compile tool chain to build the test app on desktop and deployed it on pi. It works like a charm. However, when I follow the same steps to deploy my actual app on pi, its giving me compile time error
fatal error: pqxx/pqxx: No such file directory.
I have the library linked in .pro file via -lpqxx -lpq. I have also installed libpqxx on pi3. It works on my desktop with Qt 5.6.1 GCC 64 bit kit but doesn't work on pi with Rpi3 Qt kit. Please help.
New Edit:
I added pqxx library path in my .pro file. It looks like this now :
target.path = /home/pi
INSTALLS +=target
unix: LIBS += -L$$PWD/../../../../../../usr/local/lib/ -lpqxx
INCLUDEPATH += $$PWD/../../../../../../usr/local/include/pqxx
DEPENDPATH += $$PWD/../../../../../../usr/local/include/pqxx
unix: PRE_TARGETDEPS += $$PWD/../../../../../../usr/local/lib/libpqxx.a
The previous error is gone. However, it gives me this error now:
/home/pragya/ep/PHOENIX/GUI/LUXE_GUI/../../../../../../usr/local/lib//libpqxx.a: error adding symbols: File format not recognized
Any Ideas?

Related

Qt Quick Designer Components module Static Linking not working

I'm trying to cross compile Qt Quick Designer Components to get QtQuick.Studio.Effects module on Qt 6.5 on arm64 target as I'm getting "module 'QtQuick.Studio.Effects' is not installed" when I try to to run my cross compiled qt application.
So far I have cross compiled Qt Quick Designer Components with help of this and it outputs libQuickStudioEffects.a static library. I tried to link it in .Pro file by adding the library with qt creator which generated following lines.
unix:!macx: LIBS += -L/home/user/qt/ -lQuickStudioEffects
INCLUDEPATH += /home/user/qt/
DEPENDPATH += /home/user/qt/
unix:!macx: PRE_TARGETDEPS += /home/user/qt/libQuickStudioEffects.a
lib file and executable both are in /home/user/qt/ location in target and host pc.
also I tried with following line.
LIBS += /home/user/qt/libQuickStudioEffects.a
So far executable is not detecting the lib file and giving me the above mentioned error. I can run other cross compiled qt6 programs on my target device without any issue. My host runs Ubuntu 20 and target runs on debian 11. Any help is really appreciated. Thanks.
Build the dev branch from here and it will give the dynamic QtQuick.Studio.Effects library which can be cross compiled.

how to deploy openvino-opencv in Qt

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

QtCreator (2.8.0), using shared libraries

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.

Qt linker errors: cannot find -lQtCored

A problem with a Qt *.pro file:
TARGET = ProgName
TEMPLATE = app
CONFIG += console
QT += core
QT += gui
LIBS += -LC:\\Qt\\4.8.5\\bin
LIBS += -LC:\\Qt\\4.8.5\\lib
LIBS += -LS:\\lib
# LIBS += -lQtCored4 # not necessary
# LIBS += -lQtCore4
# LIBS += -lQtGuid4
# LIBS += -lQtGui4
SOURCES += ...
HEADERS += ...
I get these linker errors:
:-1: error: cannot find -lQtGuid
:-1: error: cannot find -lQtCored
collect2.exe:-1: error: error: ld returned 1 exit status
All the DLLs exist in the specified directories.
The documentation did not help much.
This pro file worked a few days ago, and it seems to have issues since I installed Qt 5.1 (this is not used, yet; I am still working with Qt4).
Platform: Windows 7, MinGW, Qt 4.8.4
You only need the following content:
TARGET = ProgName
TEMPLATE = app
CONFIG += console
QT -= gui
SOURCES += ...
HEADERS += ...
That is because core and gui are added to the QT variable automatically. In this particular case however, you can remove the gui default if you wish to build a console application as you seem. Although "CONFIG += console" could eventually do that for you. Besides this, everything will work automatically for you, so you do not need to pass the library path to the qt libraries and so forth. You would only need to use QT += widgets and similar lines if you used further Qt modules there are not there by default. Even then, you would not need to set the Qt library path as you did in your question.
Besides, if you wanna target cross-platform later, you may wish to add this:
CONFIG -= app_bundle
to avoid creating Mac bundle for console based applications.
If you have multiple versions of Qt installed as it seems, you need to use the qmake from the required version, and it will be fine. Just to give an example: I use qmake for Qt 5 on my Archlinux system, and qmake-qt4 for Qt4.
On windows, you should either have the desired qt installation bin in the path before the undesired, or you need to call desired qmake explicitly, something like C:\path\to\my\desired\qmake.
There's no need to link to any Qt libraries afaik.
If you're using Qt Creator you need to make sure Qt 4.8.4 is properly recognized in Tools - Options - Build & Run - Kits. Since you installed 5.1 this may no longer be true. Then set the 4.8.4 kit for your project and compile it (cleaning the build directory also helps sometimes).

c++ Using PortAudio in Windows with Qt

I have managed to compile PortAudio on windows using MSYS.
this process has created 2 files: libportaudio-2.dll and libportaudio.dll.a
Now i want to link the libraries in QtCreator, but i can not since it requires a .lib file.
If anybody have experience of compiling and using libraries with MSYS under windows, your input is appreciated.
(Note: they are compiled using MindGW compiler. I dont want to compile it with Microsoft Visual Studio, since then i will have to compile QT)
to solve your problem is very simple. Here I report an example of a file. pros who need to use:
QT += core
QT -= gui
TARGET = mioTestAudio
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
LIBS += -lportaudio.dll <-------- this is the part you are interested
SOURCES += main.cpp

Resources