Hello,

There is a strange situation involving official Qt SDK (>=5.8.0) binaries for 
Linux, ICU, cmake, and WebKit project files, I'm not sure which side really 
needs to be fixed.

(Qt)WebKit uses custom module to find ICU, you can see its code at [1]. Module 
uses quite popular practise of invoking pkg-config first, and then performing 
search of libs and headers by passing them as HINTS to find_path() and 
find_library(). Doing so allows to have a meaningful fallback if pkg-config is 
missing, misconfigured, or e.g. returns host libs when cross-compilation is 
needed.

Before Qt 5.8.0, Qt SDK didn't include unversioned symlinks for ICU libraries, 
e.g. 5.7 had only libicuuc.so.56 and libicuuc.so.56.1, but not libicuuc.so. 
Starting from 5.8.0, unversioned symlinks are also provided.

Now, if someone sets CMAKE_PREFIX_PATH to the Qt root in SDK, cmake starts to 
find ICU libraries in SDK, because  priority logic of find_library makes 
CMAKE_PREFIX_PATH preferred to the HINTS provided by pkg-config.

At the same time, there are no ICU headers in Qt SDK, so include paths are 
taken from pkg-config, that detects system-wide installation of ICU. Note that 
ICU uses versioned suffixes in symbol names, so different versions are binary 
incompatible, resulting in the broken build when headers don't match libraries.

There are a few possible solutions:

* Provide ICU headers as a part of Qt SDK too. This has a benefit that ICU 
libraries, required for QtCore, can be reused in other projects that use Qt and 
ICU, e.g. for building of experimental QtWebKit versions against binary SDK.
* Remove unversioned symlinks like libicuuc.so from SDK, so that they are not 
found by FindICU.cmake, and also by linker if it's given -licuuc
* Avoid using CMAKE_PREFIX_PATH with Qt SDK, using Qt5_DIR and similar 
variables instead
* Change FindICU to ignore libraries Qt-related paths - ugly hack, also 
FindICU.cmake is technically 3rd party code for QtWebKit
* Change priorities in CMake's find_library - probably off-topic for this list, 
and may be impossible because of backward compatibility reasons.

Thoughts?

[1] 
https://github.com/annulen/webkit/blob/qtwebkit-stable/Source/cmake/FindICU.cmake

-- 
Regards,
Konstantin
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to