Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

I cannot enable ICU library support with Qt-5.0.2



  • I've been trying to build Qt-5.0.2 with qtwebkit enabled. Webkit needs ICU library support, so I've installed the latest version of ICU in /usr/local.
    However, the qtbase/configure script won't recognize it. It says "The ICU library support cannot be enabled." when the -icu swith is turned on. By the default, the configure script doesn't turn on the support.

    I set the PKG_CONFIG_PATH and the LD_LIBRARY_PATH correctly at the configuration.

    How can I build the Qt-5.0.2 with the ICU support enabled and build atwebkit?

    Regards,



  • Sorry, I forgot to mention my environment.

    I'm using Vine Linux 6.1 (a RedHat Linux based Japanese distribution).
    The kernel is 3.0.71.
    I've installed glib-2.34.2, gtk+-3.6.4 and other required package in /usr/local.

    In addition to that, I've succeed to build Qt-5.1.0 from the git repository with qtwebkit. However, the WebKit doesn't seem to work correctly because Sigil-0.7.2 built with the Qt-5 won't boot.


  • Moderators

    The configure test for icu is in qtbase/config.tests/unix/icu , and tries to link against icuuc, icui18n. Try to compile it to see why it fails. Also, you can see the output of all configure tests by running configure with '-v'.



  • g++ icu.cpp returns the following:
    /tmp/ccnrkiVm.o: In function main': icu.cpp:(.text+0x34): undefined reference toucol_open_51'
    icu.cpp:(.text+0x5e): undefined reference to `ucol_close_51'
    collect2: ld returned 1 exit status

    ./configure -v also returns the similar message:
    ICU auto-detection... ()
    g++ -c -m64 -pipe -O2 -Wall -W -fPIE -I../../../mkspecs/linux-g++-64 -I. -o icu.o icu.cpp
    g++ -m64 -Wl,-O1 -o icu icu.o -licuuc -licui18n
    icu.o: In function main': icu.cpp:(.text+0x19): undefined reference toucol_open_51'
    icu.cpp:(.text+0x34): undefined reference to `ucol_close_51'
    collect2: ld returned 1 exit status
    gmake: *** [icu] Error 1
    ICU disabled.
    The ICU library support cannot be enabled.


  • Moderators

    so ... it looks like either your icu installation is broken, or it picks up the system ICU . Try to pass the location of the header/libraries via -L, -I, e.g.

    configure -L /usr/local/icu/lib -I /usr/local/icu/include



  • I checke the locations of ICU library and headers then tried:

    PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib:/usr/lib64:/usr/lib ./configure -v -L /usr/local/lib64/icu -I /usr/local/include/unicode -prefix /usr/local/Qt-5.0.2 -developer-build -opensource -icu

    However, configure gave back the same message as the following:

    ICU auto-detection... ()
    g++ -c -m64 -pipe -O2 -Wall -W -fPIE -I../../../mkspecs/linux-g++-64 -I. -I/usr/local/include/unicode -o icu.o icu.cpp
    g++ -m64 -Wl,-O1 -o icu icu.o -L/usr/local/lib64/icu -licuuc -licui18n
    icu.o: In function main': icu.cpp:(.text+0x19): undefined reference toucol_open_51'
    icu.cpp:(.text+0x34): undefined reference to `ucol_close_51'
    collect2: ld returned 1 exit status
    gmake: *** [icu] Error 1
    ICU disabled.
    The ICU library support cannot be enabled.

    Then I tried to find the header files including ucol_open_51 and ucol_close_51 by:
    grep -E "ucol_open_51|ucol_close_51" /usr/local/include/unicode/*

    No header files were found.

    On the other hand,
    grep -E "ucol_open|ucol_close" /usr/local/include/unicode/*
    found many headere files including ucol_open or ucol_close.

    I wonder if icu.cpp tries to find wrong functions, ucol_open_51 and ucol_close_51.

    Regards,


  • Moderators

    Just have a look at config.tests/unix/icu/icu.cpp . It #include's <unicode/utypes.h> . That is, it tries to resolve ucol_open_51 is because it actually picks up the system header from /usr/unicode/utypes.h, which do a #define ucol_open ucol_open_51 . So, you're linking against the right libraries, but not compiling with the right headers.

    What you should do is adding '/usr/local/include' to the search path, instead of '/usr/local/include/unicode'.



  • PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib:/usr/lib64:/usr/lib ./configure -v -I /usr/local/include -prefix /usr/local/Qt-5.0.2 -developer-build -opensource -icu

    gave back a same message:

    ICU auto-detection... ()
    g++ -c -m64 -pipe -O2 -Wall -W -fPIE -I../../../mkspecs/linux-g++-64 -I. -I/usr/local/include -o icu.o icu.cpp
    g++ -m64 -Wl,-O1 -o icu icu.o -licuuc -licui18n
    icu.o: In function main': icu.cpp:(.text+0x19): undefined reference toucol_open_51'
    icu.cpp:(.text+0x34): undefined reference to `ucol_close_51'
    collect2: ld returned 1 exit status
    gmake: *** [icu] Error 1
    ICU disabled.
    The ICU library support cannot be enabled.


  • Moderators

    Please specify '-L /usr/local/lib64' to configure.



  • Thank you.
    The configuration has successfully ended.



  • I ran into a similar problem while compiling qt-5.0.2 for linux-x86; however, reconfigure with "-L <path to icu lib>" did not help much. qt-5.0.2 was still wanting to use the icu includes from the source code folders; ie wtf/icu, javascriptcore/icu. I renamed those include folders to icu.bak and used the -L configure option and everything worked.

    I also found some other bugs in the build system, for example if you have xlib or libxrender installed on non-standard path; the build system would have problems linking with such libraries. Below is a patch I made to fix the issue by reverting to pkg-config, instead of assuming xlib and xrender are installed in standard paths.

    I also have about 5 more patches; not sure where/who to summit the patches to. thanks

    @
    --- qtbase/configure.vanilla 2013-06-14 11:01:56.000000000 -0400
    +++ qtbase/configure 2013-06-14 14:15:18.000000000 -0400
    -4775,14 +4775,18
    QMakeVar add DEFINES QT_NO_EVDEV
    fi

    +QMAKE_LIBS_XLIB=$PKG_CONFIG --libs --cflags x11 2>/dev/null
    +

    Check we actually have X11 :-)

    -if compileTest x11/xlib "XLib"; then
    +if compileTest x11/xlib "XLib" $QMAKE_LIBS_XLIB ; then
    QT_CONFIG="$QT_CONFIG xlib"
    fi

    +QMAKE_LIBS_XRENDER=$PKG_CONFIG --libs --cflags x11 2>/dev/null
    +

    auto-detect Xrender support

    if [ "$CFG_XRENDER" != "no" ]; then

    • if compileTest x11/xrender "Xrender"; then
    • if compileTest x11/xrender "Xrender" $QMAKE_LIBS_XRENDER; then
      CFG_XRENDER=yes
      QT_CONFIG="$QT_CONFIG xrender"
      else
      -4839,7 +4843,7

      # auto-detect XInput2 support. Needed by xcb too.
      if [ "$CFG_XINPUT2" != "no" ]; then
      
    •        if compileTest x11/xinput2 "XInput2"; then
      
    •        if compileTest x11/xinput2 "XInput2" $QMAKE_LIBS_XLIB; then
                 CFG_XINPUT2=yes
                 CFG_XINPUT=no
             else
      

    @


  • Moderators

    Hi tpham3783, great that you've created patches! However, for legal reasons they cannot be imported into 'official' Qt unless you submit them to codereview.qt-project.org, and accept the license there:

    http://qt-project.org/wiki/Qt-Contribution-Guidelines

    The process might look a bit intimidating, but in reality it should really be a 10 minute affair (I think someone even created a video on youtube, but I can't find it right now ...)

    Looks like your patches should go into qtbase, stable branch.


Log in to reply