I have an application that I'm writing that uses QtWebkit and OpenSSL which deploys fine on Mac OS X 10.6 or higher and Windows XP SP2 or higher, but I'm having problems deploying the application on Linux (Unix) platforms. I've made a tarball of the application including a bin and lib folder and set the LD_LIBRARY_PATH to the local lib folder and included all Qt and external libraries on the lib folder. When my application tries to load webpages using SSL, it can't resolve the functions necessary for SSL. I've gotten deployment to work if I install the development libraries for OpenSSL on my target machine, but I'd like to have my application use the release libraries for OpenSSL on the user's machine. Am I missing something in my pro file?
Here's the relevant code from my pro file:
QT += core gui webkit network sql xml
unix:LIBS += -L$$PWD/../../../usr/local/lib/ -lqjson
unix:INCLUDEPATH += $$PWD/../../../usr/local/include
unix:DEPENDPATH += $$PWD/../../../usr/local/include
macx:LIBS += -L$$PWD/../../../usr/local/lib/ -lqjson
macx:INCLUDEPATH += $$PWD/../../../usr/local/include
macx:DEPENDPATH += $$PWD/../../../usr/local/include
win32:LIBS += -L C:/qjson/lib/ -llibqjson
win32:INCLUDEPATH += C:/qjson/include
win32:DEPENDPATH += C:/qjson/include
I'm considering making a deb and rpm package to resolve dependency problems, but I'd rather not make several packages for each available Linux distribution. This is why I went the tarball method first. I'm open to suggestions.
Maybe you didn't compile Qt with support for SSL. Read about it here
Related
TLDR: Linking OpenCV with QT MingW makes application crash in Debug but not release.
I am trying to use OpenCV in a large multi OS project based on Qt. I have easily managed to build OpenCV for Mac and Linux but I am very much struggling to use it on Windows.
Environment:
Qt 5.12.2 MinGW
MinGW 8.1.0 64bit
OpenCV basically all versions since 4.1.0
CMake 3.19
What I tried
I first tried to build OpenCV from source following his link https://wiki.qt.io/How_to_setup_Qt_and_openCV_on_Windows but had some issues running the application in Debug such as Entry Point not Found in opencv Library (exact error below)
I lately used prebuilt packages from MSys2 using its pacman and tried version 4.2 to 4.5 without real success. I managed a couple of time to link the OpenCV libraries from the installation path of msys (C:\msys64\mingw64\bin) and with this path in the environment PATH I was able to launch the application using the .exe generated by Qt. However once I dragged the needed libraries into our third party libraries folder for deployment the application can't start anymore in Debug (with Qt nor with the .exe).
I tried in Release mode and everything works fine
Now everytime I run the application in Debug with Qt the program crash immediately without even entering the main. I have the following error when I use the .exe:
I have seen that it could be a TBB issue so I tried using a different version from MSys without success.
I tried to change the PATH variables from Qt for the Build and the Run without success.
My includes and Libs in my .pri are used as follow (they are all found during the build)
INCLUDEPATH += -I $$PWD/../../ext/OpenCV/include/opencv4
DEPENDPATH += -$$PWD/../../ext/OpenCV/include/opencv4
LIBS += -L$$PWD/../../ext/OpenCV/lib/$$OSFOLDER/$$ARCHFOLDER -lopencv_imgproc430
LIBS += -L$$PWD/../../ext/OpenCV/lib/$$OSFOLDER/$$ARCHFOLDER -lopencv_core430
LIBS += -L$$PWD/../../ext/OpenCV/lib/$$OSFOLDER/$$ARCHFOLDER -lopencv_dnn430
LIBS += -L$$PWD/../../ext/OpenCV/lib/$$OSFOLDER/$$ARCHFOLDER -lopencv_imgcodecs430
LIBS += -L$$PWD/../../ext/OpenCV/lib/$$OSFOLDER/$$ARCHFOLDER -lopencv_highgui430
Okay so I finally managed to get it work!
As I said in my question this error happens sometimes when the TBB version is not correct so here's what I did:
Build manually TBB with this repository: https://github.com/wjakob/tbb which contains a CMake-based build system of the official repository : https://github.com/oneapi-src/oneTBB
Build OpenCV with the version needed using the compilers you will use later in your application:
Uncheck 'BUILD_TBB', check 'WITH_TBB' and point to the previously built TBB libraries and include.
Add the flags you need ( OPENCV_ENABLE_ALLOCATOR_STATS=OFF for instance ) and build it.
Finally add the libraries from 'path/to/opencv-build/bin' instead of 'path/to/opencv-build/install/bin' (maybe that's what we should always do but I wasn't sure) and it worked for me!
I am working on a qt app which runs on am ios device. I am building the app on a Mac OSX laptop. It uses C++ for most part of it. I need to build the app with boost C++ library to use boost asio. So following are the steps I did:
1. Install boost on my mac laptop using port install boost. This puts boost headers into /opt/local/include & boost libs into /opt/local/lib as I see.
2.Next, I used the following lines in my qt app`s .pro file to build
INCLUDEPATH += /opt/local/include
LIBS += -L/opt/local/lib
LIBS += -lboost_system-mt -lboost_thread-mt
Then, I build it. It says "symbols not found for architecture arm64" & "linker command failed with exit code 1"
Can anyone please point out what is the correct way to build boost for a qt app running on ios ?
To use boost on iOS, you need a "cross-compiled" version, for the iPhone's processor architecture. The version you installed locally on your Mac was compiled for architecture x86_64. For an iOS app you need armv7 and arm64.
Fortunately, there seems to be a precompiled boost library for iOS available under https://github.com/danoli3/ofxiOSBoost, which looks like it's exactly what you need. Maybe you can have a look at that.
I'm a newcomer to Qt and I'm having a hard time embedding a web browser control in my application.
When I try to #include <QtWebKit> or #include <QWebView>, the compiler complains that neither of those header files exist. The same goes for QtWebKitWidgets, as well.
When I add QT += webkit or QT += webkitwidgets in my qmake .pro file, I get an error saying Unknown module(s) in QT: webkit.
How do I install these modules / headers so I can use QWebView in my application? (My Qt version is 5.2.1.)
Try to install qtwebkit from repository.
On Ubuntu: sudo apt-get install libqt5webkit5-qmlwebkitplugin libqt5webkit5
On ArchLinux: sudo pacman -S qtwebkit
You may be missing your distro's QtWebKit dev package. Double check that you have the headers. A good command for this is find /usr/include -iname "*qtwebkit*". You should get some files back, one of them should be called QtWebKit, and if you open it in a text editor, you should see the text of the header.
In some distributions, the QtWebKit headers are in a separate package from the base Qt development files. Make sure you have that package installed if applicable. I know that in Arch Linux and Manjaro, the packages you need are qt5-base and qt5-webkit, and if I remember correctly, Debian-based distros (Debian, Ubuntu, Linux Mint, etc) call those packages qtbase5-dev and libqt5webkit5-dev.
If you are missing the package and need help finding it for your distribution, you can try asking over on SuperUser.
I am new to C++ so this is probably a simple fix, but I have not been able to run my program even after reading Stack Overflow's many posts regarding openCV and Qt creator. This is now my 4th day trying to get openCV working in Qt creator, so any help would be greatly appreciated!
I know openCV is installed and working on my computer because I am able to build and run programs using it by running g++ pkg-config --libs --cflags opencv -o name name.cpp in terminal, just as long as I don't try to use openCV in Qt creator. I installed openCV through Homebrew and downloaded Qt creator from its website. I also have qt installed by running "brew install qt" in terminal.
I tried linking openCV to my Qt project by editing the project file which now reads:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = opencvTestQT2
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
QT_CONFIG -= no-pkg-config
CONFIG += link_pkgconfig
PKGCONFIG += opencv
But upon trying to run it I get the error:
opencv development package not found
I have also tried adding to my project file lines such as:
INCLUDEPATH += /usr/local/Cellar/opencv/2.4.11_1/include/
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.10
LIBS += -L/usr/local/Cellar/opencv/2.4.11_1/lib -lopencv_imgcodecs -lopencv_highgui
but none of them allow my program to be built.
I am using a Mac running version 10.10.4, openCV 2.4, and Qt Creator 3.4.2 in case that helps.
Thanks in advance
Click on projects on the left pane -> Build & Run -> on Build Environment, add Path to /usr/local/bin in order for qt creator to find the pkg-config.
as Dae Choi said, the pkg-config is not found. Doing that procedure will work. Just remember to update the run as well.
This error will show:
Starting /Users/sgb/build-imagenes-Desktop_Qt_5_9_1_clang_64bit-
Debug/NBasic.app/Contents/MacOS/NBasic...
dyld: Symbol not found: __cg_jpeg_resync_to_restart
Referenced from:
/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /usr/local/lib/libJPEG.dylib
in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
The program has unexpectedly finished.
Just update in Projects -> Build & Run -> Run -> DYLD_LIBRARY_PATH to unset. Save and compile again. There are other thread where you can check as well.
Qt application throws “dyld: Symbol not found: __cg_jpeg_resync_to_restart”
Qt requires open ssl libraries to be installed on system. In debian / ubuntu when I install open ssl using apt everything works. But when I compile my application in windows, SSL features are not available I can verify this by executing
QSslSocket::supportsSsl()
How do I make it work in windows? I downloaded and installed open ssl from http://www.slproweb.com/products/Win32OpenSSL.html but it still returns false.
So after long time I figured what the problem is:
These 2 libraries need to be in same folder as your executable OR in windows system folder (system32 I think):
libeay32.dll
ssleay32.dll
You will find them in \bin of your OpenSSL folder, since I copied these 2 libs there it works
IMPORTANT: When deploying to client computers, it's also necessary to install vcredist package that was used to compile these .dll which may differ from vcredist package needed to run the application itself. vcredist version depends on version of the libraries.
You have to add OpenSSL lib in your project. In windows Qt doesn't come with OpenSSL lib. (I think it's a legal issue). You can find OpenSSL developer libs in URI you posted. If you are compiling against 32bit framework, what you need to download is Win32 OpenSSL v1.0.1e
This is what I have in my project.
QT += core gui network
win32{
LIBS += -LC:/OpenSSL-Win32/lib -lubsec
INCLUDEPATH += C:/OpenSSL-Win32/include
}
As you figured out already, you were missing dlls. Here is more information
Check what version of ssl you need with
QSslSocket::sslLibraryBuildVersionString();
For ssl 1.0.x (qt<5.12.4) you are likely missing libeay32.dll and ssleay32.dll.
For ssl 1.1.x (qt>=5.12.4) binary compatibility broke (qt 5.12.4 released), so you might need libssl-1_1.dll and libcrypto-1_1.dll, and its dependencies capi.dll and dasync.dll.