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

How to compile with system-icu on qt 5.9?



  • Why do the icu detection had to changed?, now it always failed to link with system-icu,

    Checking for ICU... 
    Trying source 0 (type inline) of library icu ...
    => source failed condition 'config.win32 && !features.shared'.
    Trying source 1 (type inline) of library icu ...
    + cd /d C:\QT-Build\msvc2017_64\qtbase\config.tests\unix\icu && C:\QT-Build\msvc2017_64\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared console single_arch" "QMAKE_LIBDIR += C:\\Dev\\dependencies\\sqlite3\\lib C:\\Dev\\postgresql\\x64\\lib C:\\Dev\\mysql\\x64\\lib C:\\Dev\\dependencies\\zlib\\lib C:\\Users\\nameless\\Documents\\Works\\Compiling\\jpeg-9b C:\\Users\\nameless\\Documents\\Works\\Deps\\x64\\VS2017\\libpng\\Static\\Release\\lib" "INCLUDEPATH += C:\\Dev\\dependencies\\sqlite3\\include C:\\Dev\\postgresql\\x64\\include C:\\Dev\\mysql\\x64\\include C:\\Dev\\dependencies\\zlib\\include C:\\Users\\nameless\\Documents\\Works\\Compiling\\jpeg-9b C:\\Users\\nameless\\Documents\\Works\\Deps\\x64\\VS2017\\libpng\\Static\\Release\\include" "LIBS += -licuin -licuuc -licudt" C:/QT-Build/qt-everywhere-opensource-src-5.9/qtbase/config.tests/unix/icu
    + cd /d C:\QT-Build\msvc2017_64\qtbase\config.tests\unix\icu && set MAKEFLAGS=& nmake
    > Microsoft (R) Program Maintenance Utility Version 14.10.25019.0
    > Copyright (C) Microsoft Corporation. All rights reserved.
    > cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fdicu.vc.pdb -DUNICODE -DWIN32 -DWIN64 -IC:\QT-Build\qt-everywhere-opensource-src-5.9\qtbase\config.tests\unix\icu -I. -IC:\Dev\dependencies\sqlite3\include -IC:\Dev\postgresql\x64\include -IC:\Dev\mysql\x64\include -IC:\Dev\dependencies\zlib\include -IC:\Users\nameless\Documents\Works\Compiling\jpeg-9b -IC:\Users\nameless\Documents\Works\Deps\x64\VS2017\libpng\Static\Release\include -IC:\QT-Build\qt-everywhere-opensource-src-5.9\qtbase\mkspecs\win32-msvc -Fo @C:\Users\nameless\AppData\Local\Temp\nm611F.tmp
    > icu.cpp
    > link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:icu.exe @C:\Users\nameless\AppData\Local\Temp\nm6353.tmp
    > icu.obj : error LNK2019: unresolved external symbol ucol_open_58 referenced in function main
    > icu.obj : error LNK2019: unresolved external symbol ucol_close_58 referenced in function main
    > icu.exe : fatal error LNK1120: 2 unresolved externals
    > NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64\link.EXE"' : return code '0x460'
    > Stop.
    => source failed verification.
    Trying source 2 (type inline) of library icu ...
    => source failed condition '!config.win32'.
    test config.corelib.libraries.icu FAILED
    
    Checking for icu >= 53... 
    Trying source 0 (type pkgConfig) of library icu ...
    pkg-config use disabled globally.
    => source produced no result.
    test config.qtwebengine.libraries.icu FAILED
    

    From the qtbase/config.tests/unix/icu/icu.pro

    SOURCES = icu.cpp
    CONFIG += console
    CONFIG -= qt dylib
    
    CONFIG += build_all
    CONFIG(debug, debug|release): \
        LIBS += $$LIBS_DEBUG
    else: \
        LIBS += $$LIBS_RELEASE
    

    Where do $$LIBS_RELEASE and $$LIB_DEBUG getting the variables?
    Old one looks more proper :

    win32 {
        CONFIG(static, static|shared) {
            CONFIG(debug, debug|release) {
                LIBS_PRIVATE += -lsicuind -lsicuucd -lsicudtd
            } else {
                LIBS_PRIVATE += -lsicuin -lsicuuc -lsicudt
            }
        } else {
            LIBS_PRIVATE += -licuin -licuuc -licudt
        }
    } else {
        LIBS_PRIVATE += -licui18n -licuuc -licudata
    }
    

    I am compiling with Visual Studio 2017 15.2, shared, x64, release & debug

    Some of my batch scripts:

    SET _CD=%CD%
    SET _PATH=%PATH%
    
    SET GYP_MSVS_VERSION=2017
    SET DEPOT_TOOLS_WIN_TOOLCHAIN=0
    SET GYP_DEFINES="proprietary_codecs=1 ffmpeg_branding=Chrome"
    SET ICU_SOURCE=%_CD%\icu\source
    SET ICU_DIST=%_CD%\icu\dist-64
    SET QT_SOURCE=%_CD%\qt-everywhere-opensource-src-5.9
    SET QT_BUILD=%_CD%\msvc2017_64
    SET QT_DIST=C:\Dev\Qt\Qt5.9\msvc2017_64
    SET PSQL_DEP=C:\Dev\postgresql\x64
    SET MYSQL_DEP=C:\Dev\mysql\x64
    SET LLVM_INSTALL_DIR=C:\Dev\clang\4.0.0\x640
    SET OPENSSL_STATIC=C:\Users\nameless\Documents\Works\Deps\x64\VS2017\OpenSSL\Static\Debug
    SET OPENSSL_SHARED=C:\Users\nameless\Documents\Works\Deps\x64\VS2017\OpenSSL\Shared\Debug
    SET LIBJPEG=C:\Users\nameless\Documents\Works\Compiling\jpeg-9b
    SET LIBPNG=C:\Users\nameless\Documents\Works\Deps\x64\VS2017\libpng\Static\Debug
    SET OPENAL=C:\Dev\dependencies\OpenAL
    SET ZLIB=C:\Dev\dependencies\zlib
    SET DOXYGEN=C:\Users\nameless\Documents\Tools\Doxygen
    SET SQLITE3=C:\Dev\dependencies\sqlite3
    SET LIBXML2=C:\Users\nameless\Documents\Works\Deps\x64\VS2017\libxml2\Static\Release
    SET PATH=%PATH%;%OPENSSL_STATIC%;%OPENAL%;%OPENAL%\bin;%LIBJPEG%;%LIBPNG%\bin;%ZLIB%\lib;%SQLITE3%\lib;%DOXYGEN%;%LIBXML2%\bin;%MYSQL_DEP%\bin;%PSQL_DEP%\bin;%ICU_DIST%\bin
    SET LIB=%LIB%;%OPENSSL_STATIC%\lib;%OPENAL%\lib;%LIBJPEG%;%LIBPNG%\lib;%ZLIB%\lib;%SQLITE3%\lib;%LIBXML2%\lib;%MYSQL_DEP%\lib;%PSQL_DEP%\lib;%ICU_DIST%\lib
    SET INCLUDE=%INCLUDE%;%OPENSSL_STATIC%\include;%OPENAL%\include;%LIBJPEG%;%LIBPNG%\include;%ZLIB%\include;%SQLITE3%\include;%LIBXML2%\include\libxml2;%MYSQL_DEP%\include;%PSQL_DEP%\include;%ICU_DIST%\include
    
    CALL %QT_SOURCE%\configure -confirm-license -prefix %QT_DIST% -mp -debug-and-release -icu -system-sqlite -I C:\Dev\dependencies\sqlite3\include -L C:\Dev\dependencies\sqlite3\lib -sql-odbc -sql-psql -I C:\Dev\postgresql\x64\include -L C:\Dev\postgresql\x64\lib -sql-mysql -I C:\Dev\mysql\x64\include -L C:\Dev\mysql\x64\lib -system-zlib -I C:\Dev\dependencies\zlib\include -L C:\Dev\dependencies\zlib\lib -system-libjpeg -I C:\Users\nameless\Documents\Works\Compiling\jpeg-9b -L C:\Users\nameless\Documents\Works\Compiling\jpeg-9b -system-libpng -I C:\Users\nameless\Documents\Works\Deps\x64\VS2017\libpng\Static\Release\include -L C:\Users\nameless\Documents\Works\Deps\x64\VS2017\libpng\Static\Release\lib -gif -ico -v -icu -qt-pcre -qt-freetype -nomake tests -opensource -openssl-linked OPENSSL_LIBS_DEBUG="C:\Users\nameless\Documents\Works\Deps\x64\VS2017\OpenSSL\Static\Debug\lib\ssleay32.lib C:\Users\nameless\Documents\Works\Deps\x64\VS2017\OpenSSL\Static\Debug\lib\libeay32.lib" OPENSSL_LIBS_RELEASE="C:\Users\nameless\Documents\Works\Deps\x64\VS2017\OpenSSL\Static\Release\lib\ssleay32.lib C:\Users\nameless\Documents\Works\Deps\x64\VS2017\OpenSSL\Static\Release\lib\libeay32.lib" -platform win32-msvc2017
    


  • Found out that i need to explicitly define the ICU include dir with -I ICU_INCLUDE_DIR and for library -L ICU_LIBRARY_DIR after the -icu option. Even tough i have defined the icu include dir on the %INCLUDE% variable and icu library on %LIBRARY% variable.



  • Hi echelon,

    thanks for posting your solution back here.

    Could you please mark this topic as solved (via Topic Tools button on the right).


Log in to reply