Compile the source code of Qt 5 version under Linux

Since it is necessary to call Qt's webkit based on Centos to carry out web-related development work, it is necessary to compile the source code of Qt, and then compile the corresponding webkit-related libraries.

In the process of compiling, I encountered some pits, hereby record it.

Qt source code compilation process:

  1. Download Qt source code
  2. Check the configuration first:

./configure

2.1 Check the configuration error:

Creating qmake...
gmake: Nothing to be done for `first'.
Running configuration tests...
The test for linking against libxcb and support libraries failed!
 You might need to install dependency packages, or pass -qt-xcb.
 See src/plugins/platforms/xcb/README.

After seeing this error, Baidu checked it the first time. After a long time, Baidu searched it all over but couldn't find it.
Looking back, I found that the error message was actually very clear, indicating that you should check it when you encounter a problem See src/plugins/platforms/xcb/README. Read this Readme carefully, the dependencies that need to be installed have been specified. Alas, always guilty of this low-level old problem. Then install the relevant dependencies:

Requires libxcb >= 1.5.

PACKAGE DEPENDENCIES

Required packages:
libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm1 libxcb-icccm1-dev libxcb-sync0 libxcb-sync0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev

On Ubuntu 11.10 icccm1 is replaced by icccm4 and xcb-render-util is not available:
libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync0 libxcb-sync0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev
The packages for xcb-render-util can be installed manually from http://packages.ubuntu.com/natty/libxcb-render-util0 and http://packages.ubuntu.com/natty/libxcb-render-util0-dev

On Ubuntu 12.04 icccm1 is replaced by icccm4 and xcb-render-util can be installed automatically:
libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync0 libxcb-sync0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-glx0-dev

On Fedora, the following packages are required:
libxcb libxcb-devel libXrender libXrender-devel xcb-util-wm xcb-util-wm-devel xcb-util xcb-util-devel xcb-util-image xcb-util-image-devel xcb-util-keysyms xcb-util-keysyms-devel

REDUCING RUNTIME DEPENDENCIES

The '-qt-xcb' configure option can be used to get rid of most xcb- dependencies. Only libxcb will
still be linked dynamically, since it will be most likely be pulled in via other dependencies anyway.
This should allow for binaries that are portable across most modern Linux distributions.

2.2 Install ICU

yum install icu.x86_64
yum install libicu-devel.x86_64

2.3 Install OpenSSL

yum install openssl-devel.x86_64 
  1. Start compiling:

make -j8

  1. start installation:

make install

QtWebkit compilation process:

  1. Installation dependency
    1.1 Install perl related package
    yum install perl-*
    1.2 Install gperf related package
    yum install gperf.x86_64
    1.3 Install ruby ​​related package
    yum install ruby.x86_64
  2. Compile webkit
    ./qtwebkit/Tools/Scripts/build-webkit --qt --debug

Guess you like

Origin blog.51cto.com/xdataplus/2678579