Linux: build Qt WebKit against a specific version of ICU?



  • Hi,

    I currently use Qt 5.6.1 LTS for my project and because it requires Qt WebKit, I build Qt WebKit myself. This is all working fine on Windows and OS X, but I am having a small problem on Linux.

    Basically, I am building Qt WebKit on Ubuntu 14.04 LTS and if I check against which version of ICU it is built, I get the following:

    $ ldd libQt5WebKit.so.5.6.1 | grep libicu
    	libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007fc3e8ba3000)
    	libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007fc3e882a000)
    	libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007fc3e3842000)
    

    So, also it's not building against Qt's version of ICU, it means that if I deploy my application on Ubuntu 14.04 LTS, then it's still working fine, but not if I deploy it on Ubuntu 16.04 LTS since it cannot find libicui18n.so.52 & Co.

    So, my idea is obviously to build Qt WebKit against Qt's version of ICU, not least because it's also the version used by the other Qt libraries that are shipped along with m y application, but... how can I do that? (Sorry, I normally use CMake, so I am not at all familiar with .pro/.pri/etc. files.)

    Cheers, Alan.



  • Someone just told me that I could try to deploy both Ubuntu 14.04 LTS's version of ICU, as well as Qt's version of ICU. Well, I have just given it a try and indeed it's working fine. I am therefore going to go with this 'solution', although I would still like to do what I described above.



  • It should be quite painful to distribute 2 copies of ICU because you need to distribute 2 copies of data bundles as well. Unfortunately Qt SDK does not provide any way to build against its copy of ICU, but still there is a workaround

    1. Install (from sources or some binary packages, does not matter) the same ICU version as used in SDK. For example, if in SDK you see libicuuc.so.56.1, you should get ICU 56.1

    2. Build QtWebKit against this ICU installation. By default QtWebKit uses pkg-config to find ICU, so you can override system ICU with your newly installed ICU by pointing PKG_CONFIG_PATH variable to location of icu-i18n.pc from your ICU installation (e.g. $prefix/lib/pkg-config)



  • Thanks Konstantin, I will give your suggestion a try when I get a chance. (I agree, it's not 'neat' to ship two different copies of ICU, but at least it works for now.)



  • @Konstantin-Tokarev, I have just given your suggestion a try, but I am clearly missing something. Indeed, here is what I did (keeping in mind that I am using Qt 5.6.1 LTS):

    At this stage, I thought my copy of Qt WebKit would refer to ICU 56.1, but if I check Qt WebKit's dependencies, I can see that it's still referring my system's ICU (!!):

    • $ ldd [QtWebKit]/lib/libQt5WebKit.so.5.6.1 | grep libicu
              libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007fba553e7000)
              libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007fba5506e000)
              libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007fba50077000)
      

    Clearly, I am missing something, but what is it?...



  • Ok, I have got it to work (yeah!). Basically, rather than building Qt WebKit using:

    $ cd [QtWebKit]
    $ PKG_CONFIG_PATH=[ICU]/install/lib/pkgconfig qmake
    $ make
    

    I had to build it using:

    $ cd [QtWebKit]
    $ export PATH=[ICU]/install/bin:$PATH
    $ export LD_LIBRARY_PATH=[ICU]/install/lib:$LD_LIBRARY_PATH
    $ export PKG_CONFIG_PATH=[ICU]/install/lib/pkgconfig:$PKG_CONFIG_PATH
    $ qmake
    $ make
    

    I would have thought that setting PKG_CONFIG_PATH would have been enough, but clearly not!



  • Looks like it's deficiency of ICU *.pc files, which don't provide appropriate -L flags with library path when non-default prefix is used



  • Actually, my bad, we don't need to export a new PATH and LD_LIBRARY_PATH in addition to exporting a new PKG_CONFIG_PATH. In the end, we only need to export a new PKG_CONFIG_PATH.

    However, it would seem that not only qmake needs to know about PKG_CONFIG_PATH, but also make (??), hence exporting PKG_CONFIG_PATH rather than setting it as I originally did using:

    $ PKG_CONFIG_PATH=[ICU]/install/lib/pkgconfig qmake
    

    In conclusion, I am now able to build QtWebKit by simply using:

    $ cd [QtWebKit]
    $ export PKG_CONFIG_PATH=[ICU]/install/lib/pkgconfig:$PKG_CONFIG_PATH
    $ qmake
    $ make
    


  • @agarny No, I don't see any calls to pkg-config in generated Makefiles, so PKG_CONFIG_PATH should not have an effect on make



  • @Konstantin-Tokarev, I appreciate what you are saying, hence my "??" in relation to make above.

    Still, and just to be 100% sure, I have just rebuilt Qt WebKit using:

    $ cd [QtWebKit]
    $ PKG_CONFIG_PATH=[ICU]/install/lib/pkgconfig qmake
    $ make
    

    and sure enough, the resulting libraries don't work (they refer to the system version of ICU, i.e. version 52.1) while everything works fine (i.e. the libraries refer to version 56.1 of ICU) when building Qt WebKit using:

    $ cd [QtWebKit]
    $ export PKG_CONFIG_PATH=[ICU]/install/lib/pkgconfig:$PKG_CONFIG_PATH
    $ qmake
    $ make
    

    Anyway, the latter works fine and, at this stage, this is what matters to me, evenb though I don't understand why I need to export a new PKG_CONFIG_PATH rather than modify it 'inline'...



  • @agarny Ah, unless you run qmake with "-r" option it is recursively called in subdirs in make time



  • Well, I have just given it a try, i.e.

    $ cd [QtWebKit]
    $ PKG_CONFIG_PATH=[ICU]/install/lib/pkgconfig qmake -r
    $ make
    

    First, I got the following at the end of the call to qmake:

    Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/WTF/WTF.pro
    Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/JavaScriptCore/JavaScriptCore.pro
    Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/ThirdParty/ANGLE/ANGLE.pro
    Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/ThirdParty/leveldb/leveldb.pro
     Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/ThirdParty/leveldb/Target.pri
    Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/WebCore/WebCore.pro
    Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/WebKit/WebKit1.pro
    Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/WebKit2/WebKit2.pro
    Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/QtWebKit.pro
     Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/api.pri
     Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/widgetsapi.pri
     Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/WebKit2/WebProcess.pro
     Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/WebKit2/PluginProcess.pro
     Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/WebKit/qt/declarative/declarative.pro
      Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/WebKit/qt/declarative/public.pri
      Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/WebKit/qt/declarative/experimental/experimental.pri
     Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/WebKit/qt/examples/examples.pro
      Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/WebKit/qt/examples/platformplugin/platformplugin.pro
    WARNING: DESTDIR: Cannot access directory '/opt/Qt/5.6/gcc_64/plugins/webkit'
    Reading /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Tools/Tools.pro
    

    Then, when building Qt WebKit, I eventually got:

    /usr/bin/ld: warning: libicui18n.so.56, needed by /opt/Qt/5.6/gcc_64/lib/libQt5Core.so, may conflict with libicui18n.so.52
    /usr/bin/ld: /home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/WTF//.obj/wtf/unicode/icu/CollatorICU.o: undefined reference to symbol 'ucol_setAttribute_56'
    /opt/Qt/5.6/gcc_64/lib/libicui18n.so.56: error adding symbols: DSO missing from command line
    collect2: error: ld returned 1 exit status
    make[2]: *** [../../bin/jsc] Error 1
    make[2]: Leaving directory `/home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/JavaScriptCore'
    make[1]: *** [sub-jsc-pro-make_first-ordered] Error 2
    make[1]: Leaving directory `/home/alan/Desktop/qtwebkit-opensource-src-5.6.1/Source/JavaScriptCore'
    make: *** [sub-Source-JavaScriptCore-JavaScriptCore-pro-make_first-ordered] Error 2
    

    Well, needless to say that I am calling it a day. :) In the end, I have got a working solution, so I am 'happy' to accept that I don't and might never understand why I need to export a new PKG_CONFIG_PATH rather than modify it 'inline'...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.