How to build qtwebengine from Qt 5.5 git source - qt

I have followed the instructions on this page Building Qt 5 from Git to build Qt 5.5 from source. The source is in "~/qt5_source_built/qt5" and the Qt 5.5 built system is in "~/qt5_source_built/qt5.5-build". I have used the following config options :
~/qt5_source_built/qt5/configure -developer-build -opensource -no-gtkstyle -nomake examples -nomake tests
and then used "make -j4" to build the qt-5.5 system. The system builds OK.
I use CMake to develop applications for the Qt 5.5 built system. It works for the usual cases (e.g. could use qtwebkit). However, when I want to test the qtwebengine module on a new application, I find that there seems NO qtwebengine include files and library files under the "~/qt5_source_built/qt5.5-build/qtbase" directory.
I have tried to re-make the system using different targets :
make all -j4
make module-qtwebengine -j4
make module-qtwebengine-all -j4
but the console keeps outputing
... Nothing to be done for ...
and the qtwebengine include and library files still could NOT be found under the "~/qt5_source_built/qt5.5-build/qtbase" directory after the re-make.
I notice that the qtwebengine source files seems could be found in "~/qt5_source_built/qt5/qtwebengine/src" but I just could not build it using the "make" command.
Have I just missed the qtwebengine include and library files under the built directory ? If not, does anyone know how could I build qtwebengine using this Qt 5.5 git source ?
Thanks for any suggestion.

The following ended up working. I installed all of these prereqs. If they were missing, QtWebEngine wouldn't build. make module-qtwebengine usually printed out the reason it didn't build it:
sudo apt-get install bison build-essential flex gperf gyp \
libasound2-dev libbz2-dev libcap-dev libcups2-dev libdrm-dev \
libegl1-mesa-dev libfontconfig1-dev libgcrypt11-dev \
libglu1-mesa-dev libicu-dev libnss3-dev libpci-dev libpulse-dev \
libssl-dev libudev-dev libxcomposite-dev libxcursor-dev \
libxdamage-dev libxrandr-dev libxtst-dev ninja python ruby
Then I used the following configuration. Not sure if this is minimal but it worked:
./configure -release -opensource -confirm-license -shared \
-no-sql-sqlite -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype\
-icu -openssl -qt-xcb -opengl -gui -widgets -skip webkit \
-nomake examples
Note that I skipped webkit, and also I use -shared instead of -static since static linking of QtWebEngine is apparently not yet supported.

Related

QML module not found (QtQuick.Studio.Components 1.0 )

I cross compiled Qt 5.14.1 for my Raspberry pi 4 on a Ubuntu 18.04,
for my application I need arcs when I searched I found out that arc belongs to QtQuick.Studio.Components 1.0 https://doc.qt.io/qtdesignstudio/qml-qtquick-studio-components-arc.html
but when I added the import QtQuick.Studio.Components 1.0 in my main.qml I had an error QML module not found (QtQuick.Studio.Components 1.0 ) import paths : /opt/RaspberryQt/sysroot/usr/local/RaspberryQt/qml
so in my .pro file I added
QML_IMPORT_PATH = /opt/RaspberryQt/sysroot/usr/local/RaspberryQt/qml
but I still have this error
these are the libraries that I installed on my Raspberry pi 4 before cross compiling. Can you please tell me which one is missing ?
sudo apt-get build-dep qt5-qmake
sudo apt-get build-dep libqt5gui5
sudo apt-get build-dep libqt5webengine-data
sudo apt-get build-dep libqt5webkit5
sudo apt-get install libudev-dev libinput-dev libts-dev libxcb-xinerama0-dev libxcb-xinerama0 gdbserver
and this is my configuration
cd /opt/RaspberryQt/build
../qt-everywhere-src-5.14.1/configure -release -opengl es2 -eglfs -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=/opt/RaspberryQt/tools/rpi-gcc-8.3.0/bin/arm-linux-gnueabihf- -sysroot /opt/RaspberryQt/sysroot -prefix /usr/local/RaspberryQt -opensource -confirm-license -skip qtscript -skip qtwayland -skip qtwebengine -nomake tests -nomake examples -make libs -pkg-config -no-use-gold-linker -v -recheck
Thank you in advance
I was able to fix this problem. First install Qt Design Studio (you can add components to the Qt installation by going to the Qt install directory, such as C:\Qt and running MaintenanceTool.exe.
Once installed, navigate to following path in the Qt install directory:
[Wherever Installed]\Qt\Tools\QtDesignStudio\bin\qml\QtQuick
Then in there, copy the entire Studio folder, and paste it into:
[Wherever Installed]\Qt\Tools\QtCreator\bin\Qml\QtQuick
Then relaunch Qt Creator and it should see it.
Note: There might be a more elegant way to import the modules from Qt Design Studio by adding the [path]\Qt\Tools\QtCreator\bin\Qml\ directory to the import paths, but that wasn't working for me, so I just did it with the method above.
you are getting the import from an extra qt module. So compile and install https://codereview.qt-project.org/gitweb?p=qt-labs/qtquickdesigner-components.git;a=tree into the qt installation on your raoberry aswell.
Follow-up to ThioJoe's answer:
If you've already tried ThioJoe's approach but facing the same issue, try this:
 1. Copy the Studio folder located in:   [Wherever Installed]\Qt\Tools\QtDesignStudio\bin\qml\QtQuick.
 2. Paste the copied Studio folder into:   [Wherever Installed]\Qt\6.2.3\mingw_64\qml\QtQuick   (note, the 6.2.3 might
be different depending on your version).
 3. Relaunch QtCreator.

Error while creating qmake for a Qt static build

I got stuck trying to build Qt libraries statically with this command:
/strg/Qt/qt-everywhere-src-5.10.0 $ ./configure -static -prefix /strg/Qt
and getting this response:
+ cd qtbase
+ /strg/Qt/qt-everywhere-src-5.10.0/qtbase/configure -top-level -static -prefix /strg/Qt
./configure: 49: exec: /strg/Qt/qt-everywhere-src-5.10.0/qtbase/configure: not found
I attempted to resolve this using vim command set userformat=unix on the file qtbase/configure.
After running the same line /strg/Qt/qt-everywhere-src-5.10.0 $ ./configure -static -prefix /strg/Qt things are no better:
Creating qmake...
’
make: *** [main.o] Error 1
.
I am following the instructions on http://doc.qt.io/qt-5/linux-deployment.html and I guess, I could make a mistake during the previous steps. Could you help me?
Ok, your sources are in /strg/Qt/qt-everywhere-src-5.10.0. I prefer having separate build and install dirs:
Create build dir, e.g. /strg/Qt/build and create install dir, e.g. /strg/Qt/install
Go to build dir:
cd /strg/Qt/build
Run configure from your build dir and give install dir using -prefix:
../qt-everywhere-src-5.10.0/configure -static -prefix /strg/Qt/install
Other useful configure parameters you might use (don't skip qtwebengine if you need it, if you don't need it you save lots of time by skipping it)
../qt-everywhere-src-5.10.0/configure -opensource -confirm-license -static -release -prefix /strg/Qt/install -make libs -nomake tools -nomake examples -nomake tests -skip qtwebengine

Building Qt with OpenSSL on Ubuntu 16.04.1 fails

I have almost spent a week trying to build Qt5.8.0 with OpenSSL on Ubuntu 16.04.1 x64.
First of all I downloaded sources of OpenSSL v1.0.2k. Then I configured it with command
./Configure --prefix=$PWD/dist -shared linux-x86_64
Then I run theese commands one by one:
make depend
make
make install
So I got Openssl installed in /home/user/openssl-OpenSSL_1.0.2k/dist
Then I downloaded Qt from official website, and installed it with sources, so the sources are situated in /home/user/Qt5.8.0/5.8/Src
Then I tried to configure it with command
OPENSSL_LIBS='-L/home/user/openssl-OpenSSL_1_0_2k/dist/lib -lssl -lcrypto' ./configure -prefix /home/user/qt5_static -opensource -confirm-license -release -nomake examples -nomake tests -static -openssl-linked -I /home/user/openssl-OpenSSL_1_0_2k/dist/include/openssl -L /home/user/openssl-OpenSSL_1_0_2k/dist/lib
But got theese errors:
ERROR: Feature 'openssl' was enabled, but the pre-condition '!features.securetransport && tests.openssl' failed.
ERROR: Feature 'openssl-linked' was enabled, but the pre-condition
'features.openssl && libs.openssl' failed.
What am I doing wrong, and how to fix this issue?
Thank you in advance, and sorry for my bad english.
I had same problem when trying to link openSSL statically and found following solution:
1) Install openSSL
sudo apt-get update && sudo apt-get install libssl-dev
2) Configure and build qt from sources, including -openssl-linked option, my example configuration:
/home/someuser/Qt/5.8/Src/configure -c++std c++11 -static -release -platform linux-g++-64 -prefix /home/someuser/Qt/StaticRelease58 -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -qt-xcb -make libs -openssl-linked -nomake tools -nomake examples -nomake tests -opensource -confirm-license -skip qtwayland -skip qtwebview -skip qtwebengine -skip qtwebchannel -no-qml-debug
Note that to build QT statically, you also must have installed other packages described here:
http://doc.qt.io/qt-5/linux-requirements.html
http://doc.qt.io/qt-5/linux-deployment.html
P.S. Linking dynamically to openSSL from QT5.8 works fine for me with default setup.

QT 5.5.1 removed -universal option: no way of creating universal binaries on MAC

Why is -universal option removed from ./configure script?
How do i create universal binary from source?
I am able to create 32-bit and 64-bit frameworks separately as follows:
1) 64-bit QT framework
#Choose platform from qtbase/mkspecs/
./configure -release -opensource -confirm-license -prefix /tmp/ -nomake tests -nomake examples -platform macx-clang
#Only needed QTcore, QTNetwork, QTGui module, so i choose "module-qtbase"
make -j4 module-qtbase
Copy qtbase/lib/ somewhere before creating 32-bit
2) 32-bit QT framework
./configure -release -opensource -confirm-license -prefix /tmp/ -nomake tests -nomake examples -platform macx-clang-32
make -j4 module-qtbase
Now its cumbersome to use lipo on 32bit qtbase\lib and 64bit qtbase\lib. Is there any new way of creating universal binaries on MAC?
I still need to support 32bit.
I had to write this manually as following.
If anyone else comes up with better answer i'll accept theirs.
#This is in qt-everywhere/src/ directory
#Build for 32-bit
./configure -release -opensource -confirm-license -prefix ~/tmp/ -nomake tests -nomake examples -openssl-linked -I $(OPENSSL_INC) -L $(OPENSSL_LIB) -platform macx-clang-32
make
#Backup required 32-bit binaries. I only needed qtbase and plugins
#-R because frameworks contain symlinks
cp -Rf qtbase/lib ../out_32/lib
cp -Rf qtbase/plugins ../out_32/plugins
make clean
./configure -release -opensource -confirm-license -prefix ~/tmp/ -nomake tests -nomake examples -openssl-linked -I $(OPENSSL_INC) -L $(OPENSSL_LIB) -platform macx-clang
make
#Backup required 64-bit binaries.
cp -Rf qtbase/lib ../out_64/lib
cp -Rf qtbase/plugins ../out_64/plugins
cd ..
#creating universal frameworks
FR="QtGui QtCore QtNetwork QtWidgets"
for fr in ${FR}; do
rm -rf out/$fr.framework
cp -Rf out_64/lib/$fr.framework out/
rm -rf out/$fr.framework/Versions/Current/$fr
lipo -create -output out/$fr.framework/Versions/Current/$fr \
out_32/lib/$fr.framework/Versions/Current/$fr \
out_64/lib/$fr.framework/Versions/Current/$fr
done
out directory contains universal frameworks.

Error compiling Qt5 with openssl linked

My head will explode soon... I want to compile qt with -openssl-linked so the openssl libraries get linked into the qt libraries. I already tried many options and my output when compiling is always:
ssl/qsslcertificate_openssl.cpp: In function ‘uint qHash(const QSslCertificate&, uint)’:
ssl/qsslcertificate_openssl.cpp:63:30: error: invalid use of incomplete type ‘X509 {aka struct x509_st}’
return qHashBits(x509->sha1_hash, SHA_DIGEST_LENGTH, seed);
^
In file included from /usr/local/include/openssl/crypto.h:131:0,
from /usr/local/include/openssl/comp.h:59,
from /usr/local/include/openssl/ssl.h:148,
from ../../include/QtNetwork/5.5.1/QtNetwork/private/../../../../../src/network/ssl/qsslcontext_openssl_p.h:53,
from ../../include/QtNetwork/5.5.1/QtNetwork/private/qsslcontext_openssl_p.h:1,
from ssl/qsslsocket_p.h:55,
from ssl/qsslsocket_openssl_p.h:63,
from ssl/qsslsocket_openssl_symbols_p.h:64,
from ssl/qsslcertificate_openssl.cpp:35:
/usr/local/include/openssl/ossl_typ.h:160:16: note: forward declaration of ‘X509 {aka struct x509_st}’
typedef struct x509_st X509;
I compiled openssl and tried compiling qt passing my compiled libraries:
OPENSSL_LIBS='-L/opt/openssl_build/lib -lssl -lcrypto' ./configure -prefix /opt/qt5.5.1_linux_staticssl -opensource -confirm-license -release -nomake examples -nomake tests -static -openssl -no-opengl -no-libpng -no-pulseaudio -no-linuxfb -no-gif -no-gstreamer -no-gtkstyle -no-directfb -no-gui -no-eglfs -no-glib -I /opt/openssl_build/include/openssl -L /opt/openssl_build/lib -no-xcb
I know the error seems to be loading the old openssl libraries but I already tried changing that path so it can't find them and force it to load the new ones.
I don't know what else to do. The Qt version is 5.5.1 openssl 1.0.1 and g++ 5.2.
I had to build Qt with the openssl version 1.0.1, don't know if it work with the 1.0.2. I had to change the path of the system's openssl libraries so that Qt was forced to use the ones I made.
Lines to compile openssl running at the source's directory:
./config --prefix=/opt/openssl_build_stable -shared
make
make test
sudo make install
My conf line for Qt:
OPENSSL_LIBS='-L/opt/openssl_build_stable/lib -lssl -lcrypto' ./configure -prefix /opt/qt5.5.1_linux_staticssl -opensource -confirm-license -release -nomake examples -nomake tests -static -openssl-linked -I /opt/openssl_build_stable/include/openssl -L /opt/openssl_build_stable/lib
Thanks to simon-warta
Try ./configure -no-openssl
to bypass openssl altogether, in case you don't need your paraView to talk to another machine.

Resources