How to compile qtwebkit in qt-5.8 - c++

I have compiled QT-5.8 from github successfully, each submodule is cloned by init-repository provided by QT. However, in Qt5.8, it has removed qtwebkit.
But my app needs qtwebkit, so I clone qtwebkit submodule and qmake it.
However, it shows the compilation errors
( test -e Makefile.api || /usr/local/Qt-5.8.0/bin/qmake -o Makefile.api /home/tumh/qt5/qtwebkit/Source/api.pri ) && make -f Makefile.api
make[1]: Entering directory '/home/tumh/qt5/qtwebkit/Source'
make[1]: *** No rule to make target '/home/tumh/qt5/qtwebkit/Source/WebCore//libWebCore.a', needed by '../lib/libQt5WebKit.so.5.8.0'. Stop.
make[1]: Leaving directory '/home/tumh/qt5/qtwebkit/Source'
Makefile:40: recipe for target 'sub-api-pri-make_first-ordered' failed
make: *** [sub-api-pri-make_first-ordered] Error 2
I have no idea that how to compile a single submodule in QT.
Any suggestion is appreciated.
thanks!

You should take tarball of webkit from official releases. It should build fine with Qt-5.8.

The following describes how to compile qtwebkit module so it is usable with Qt 5.9.9. I assume the process is similar if not identical for Qt 5.8.
An overview of the process
All of the required components should be compiled using one tool chain. I suggest using the one installed with Qt.
You gonna need ICU compiled, the source code can be obtained from the official site.
The source code of qtwebkit module that we want to compile is available here (thx #J. Doe for the link!)
Regardless of the operating system you are working on, in order to compile qtwebkit module you gonna need the following additional tools:
ruby
gperf
flex
bison
python 2
Qtwebkit module depends on declarative module. It becomes available when qtquick1 is installed.
It is assumed that Qt 5.9.9 is installed. I was using these installers.
The process takes some time so if you need the module ready ASAP go to the last section (What if you cannot perform some of the above steps).
Compiling on Windows (tested on Win10)
On Windows I recommend using chocolatey to install additional tools.
Compiling ICU
Install msys2 package via chocolatey. It allows to use the scrips provided with ICU source code with very few modifications.
Installation script requires make program available. It doesn't matter if mingw32-make is virtually (of even literally) the same tool. Copy mingw32-make.exe and rename it to make.exe.
Using cmd with integrated mingw tools (installed along with Qt) open msys2 shell forwarding the PATH variable.
msys2_shell -use-full-path
Go to the ICU source code directory (mine was C:\icu\source) and run
./runConfigureICU MinGW -prefix=$PWD/../dist
(It is expected to encounter "unknown platform" issue, no worries)
Now run:
gcc -dumpmachine
Save the output, in my case it was i686-w64-mingw32.
Using this result execute:
./configure -build=i686-w64-mingw32 -prefix=$PWD/../dist
(modify build parameter according to the result of the previous step)
Now, you should be able to compile ICU with:
make & make install
(If you want to speed things up you can engage multiple CPU cores in the above process. For example in order to engage 777 cores execute make -j777 & make install)
Assuming your ICU source code was in C:\icu\source directory, the result of the compilation should be in C:\icu\dist.
Compiling qtwebkit module
As said in the first section, compiling qtwebkit module requires additional tools.
They can be installed via chocolatey using the following command:
choco install ruby gperf winflexbison python2
This, among others, installs win_flex.exe and win_bison.exe. As of this writing these executables are located (at least in my case) in C:\ProgramData\chocolatey\lib\winflexbison\tools .
The qmake checks for programs named bison.exe and flex.exe. So I have copied both win_flex.exe and win_bison.exe and renamed them flex.exe and bison.exe accordingly.
The last step is to add both of these programs to PATH variable.
To do so execute (in cmd with integrated mingw tools) the following command:
set PATH=C:\ProgramData\chocolatey\lib\winflexbison\tools;%PATH%
Additionally you need to point to the directory where includes and libs of compiled ICU are located. I have done it like this:
set PATH=C:\icu\dist\bin;%PATH%
set INCLUDE=C:\icu\dist\include;
set LIB=C:\icu\dist\lib;
Above assumes that prior to executing this commands there was no variables named INCLUDE and LIB set in the currently used cmd.
Finally, qmake process checks for a variable named SQLITE3SRCDIR.
As suggested by this answer you can set it to sqlite sources provided with Qt. In my case it was done like this:
set SQLITE3SRCDIR=C:\Qt\Qt5.9.9\5.9.9\Src\qtbase\src\3rdparty\sqlite
Now (using the same cmd) go to the directory where Qt sources are located and execute configure.bat. I have done both of these steps with:
cd C:\Qt\Qt5.9.9\5.9.9\Src
configure.bat
Finally, extract the downloaded source code of the qtwebkitmodule to the sources directory of Qt (C:\Qt\Qt5.9.9\5.9.9\Src in my case) and make a module. I have done it like this:
cd qtwebkit-opensource-src-5.9.0
mkdir build
cd build
qmake -r ..
make
make install
It is strongly recommended to utilize multiple cores in the make process, otherwise prepare yourself for a very long compilation.
Now you should be able to use webkit and webkitwidgets in your Qt projects.
Compiling on Linux (tested on LUbuntu 18.04)
I suggest using compilation tools provided with Qt instead of default make and g++ compiler. To do so I have exported path to the tools provided with Qt like this:
export PATH=/home/$USER/Qt5.9.9/5.9.9/gcc_64/bin/:$PATH
You gonna need ICU compiled. I suggest using version 56.1 as it is the same shipped with Qt 5.9.9. The compilation process is almost identical as it was described for Windows. the only difference is that you run:
./runConfigureICU Linux/gcc --prefix=$PWD/../dist
and later configure script can be omitted on Linux.
On lUbuntu 18.04 I needed the following packages installed:
apt-get install ruby bison gperf python flex perl libx11-dev xserver-xorg-dev xorg-dev libpulse-dev libsqlite3-dev
As with compiling qtwebkit on Windows, you gonna need qtquick1 module installed.
I have encountered an error saying that some headers related to OpenGL were missing. If you have the same problem then in my case installing libgl1-mesa-dev package solved it.
Now extract source code of qtwebkit module sources directory of your Qt installation. In my case it was "/home/$USER/Qt5.9.9/5.9.9/Src".
Modify WTF.pri file and add the path to ICU includes and libs after the first INCLUDEPATH. In my case it was done like this:
...
INCLUDEPATH += /home/$USER/icu/dist/include/
LIBS += -L/home/$USER/icu/dist/lib/
...
Note '-L' is placed before path pointing to libs.
Now you should be able to compile qtwebkit module in usual manner:
mkdir build
cd build
qmake -r ..
make & make install
What if you cannot perform some of the above steps
You can always try to use prebuild binaries:
https://download.qt.io/snapshots/ci/qtwebkit/5.9/latest/qtwebkit/
or unofficial fork of the qtwebkit module:
https://github.com/qtwebkit/qtwebkit/releases

Related

Install eigen3.3.7 on MacOS

I am trying to build a program on MacOS and that program requires Eigen version <= 3.3.7 but mine has 3.3.8 with brew install eigen
I went to Eigen website but 3.3.7 source is no longer available anymore.
Any workaround?
Thanks a lot!
Updates: thanks a lot but I am still very confused with how to proceed. Below is the information of the installation details and directory info.
The directory of the program source code that I want to build look like:
program
cmake
Cmakelist.txt
build
the program has the following instructions:
Create the build directory in the source tree root
mkdir build
Configure cmake, from the build directory, passing the Shogun source root as an argument. It is recommended to use any of CMake GUIs (e.g. replace cmake .. with ccmake ..), in particular, if you feel unsure about possible parameters and configurations. Note that all cmake options read as -DOPTION=VALUE.
cd build
cmake [options] ..
Compile
make
Install (prepend sudo if installing system-wide), and you are done.
make install
Sometimes you might need to clean up your build (e.g. in case of some major changes). First, try
make clean
Then I have downloaded eigen3.3.7, where the INSTALL file is as following. How should I proceed?
Method 1. Installing without using CMake
****************************************
You can use right away the headers in the Eigen/ subdirectory. In order
to install, just copy this Eigen/ subdirectory to your favorite location.
If you also want the unsupported features, copy the unsupported/
subdirectory too.
Method 2. Installing using CMake
********************************
Let's call this directory 'source_dir' (where this INSTALL file is).
Before starting, create another directory which we will call 'build_dir'.
Do:
cd build_dir
cmake source_dir
make install
You can install Eigen 3.3.7 by compiling the source code(available here).

Where do I get the qm executable from?

I am working on an Ubuntu 16.04 system and tried to compile an application with the qm command as per the readme file in the source directory. When I try to run the command I get the repose:
$ qm
qm: command not found
This suggests that my Ubuntu PC does not have a repository with a package that supplies a qm executable setup. I guess the source code for the tool may be available somewhere and be usable for multiple GNU Linux operating systems.
How do I source and install the qm executable?
The readme file for the code I am trying to compile states that qm stands for quick-make or QMake but I cannot find any reference to these in a google search. I only find references to Qt's qmake which is not the tool I am looking for based on the errors I get back.
This qm tool uses a defs.mk file as its instruction set.
The program I am trying to install uses the RAVL Library. The README file for that library also mentions qm command.
I found a source for the qm or QMake or Quick Make tool. In the Recognition And Vision Library (RAVL) Installation Instructions the installation of QMake is mentioned.
Building the RAVL library requires the use of an ANSI C++ compiler
along with the GNU make utility (or another compatible version of
make). The RAVL build process is actually managed by the QMake
utility. QMake is a flexible compilation aid, designed to provide a
simpler interface to the GNU make program. As part of the RAVL
installation process, a copy of QMake will be configured and
installed.
The instructions go on to explain that by; obtaining a copy of the RAVL source code, configuring, making and installing it you get both the RAVL libary and the quick-make tool set. This includes the qm command.
After preforming the following steps:
git clone -b tested_nightly git://git.code.sf.net/p/ravl/ravl ravl
cd ravl
./configure
make
sudo make install
I am able to use the qm command.

Loris package installing issue

I'm trying to install Loris package link which is a library also for Python (my language). I have installed the package through bash commands in my OSX 10.12 system following these steps:
cd to the directory containing the package's source code and type
./configure to configure the package for your system. If you're
using csh on an old version of System V, you might need to type
sh ./configure instead to prevent csh from trying to execute
configure itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
Type `make' to compile the package.
Optionally, type `make check' to run any self-tests that come with
the package.
Type `make install' to install the programs and any data files and
documentation.
You can remove the program binaries and object files from the
source code directory by typing make clean. To also remove the
files that configure created (so you can compile the package for
a different kind of computer), type make distclean. There is
also a make maintainer-clean target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
The problem is that when I run both python 2.7 IDLE and the Atom editor it says that the module named Loris was not found. By default, make install will install the package's files in
/usr/local/bin,/usr/local/man.
Is this the problem? How can I install properly this library?

Including and excluding qt modules and addons while configuring Qt5.5.1

Can someone explain what is a correct way to include some modules and addons while doing ./configure in Qt5.5.1?
I should have a x11 addon installed and tried that with:
./configure -qt-x11
./configure -qt-x11extrass
but it doesn't work.
I am reading this for configure options, but I figured out that many things you have to guess how they need to be done. I am building qt5.5.1 on Ubuntu 14.04.3 to cross-compile for BBB.
If you want to build some module (all module dependency packages must be installed first), you need to go to module directory (for example qtmultimedia in qt directory) and run qmake (built for your specific architecture), after that make and sudo make install. Now you will be able to include required module into your .pro file.

Compilator (GCC) cross-compilation (to windows) on linux - how can I build it in non-source directory?

I'm trying to install cross-compiler using that tutorial .
I got stuck cross-compiling GCC version 4.9.1 using my native linux-GCC compiler. I occured an error during the installation and the solution is to build it in non-source directory. However, I have no idea how can I do it. I've read the documentation. However, it hasn't helped me.
I just want to install C++ and C version.
I haven't done this for ages but I think it means create a new empty directory and run configure from there, i.e. rather than
cd /usr/src/crosscompiler
./configure ...
do
mkdir /usr/src/crosscompiler-build
cd /usr/src/crosscompiler-build
/usr/src/crosscompiler/configure ...
which will then set up the build environment and make files in that new directory to use the source tree from the old directory. (If that doesn't work, you could try putting the empty directory inside the source tree, e.g. /usr/src/crosscompiler/build)
That all said, I thought a separate build directory has been the only way to build GCC for 10+ years, so I'm surprised the tutorial says anything different. You can build binutils into a separate path too, and there are ways of combining the GCC and binutils sources so that they can be built in one go too.