Building Qt 5.8 from Source with MSYS2 / MinGW 64 - 'libs.icu' failed



  • Running configure failed with following error message:

    ERROR: Feature 'icu' was enabled, but the pre-condition 'libs.icu' failed.

    I checked config.log for details, the relevant part is:

    looking for library 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 C:\msys64\home\asp\qt-build\qtbase\config.tests\unix\icu && C:\msys64\home\asp\qt-build\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared console" "LIBS += -licuin -licuuc -licudt" C:/msys64/home/asp/qt5/qtbase/config.tests/unix/icu
    + cd C:\msys64\home\asp\qt-build\qtbase\config.tests\unix\icu && set MAKEFLAGS=& C:/msys64/usr/bin/make
    > g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -IC:/msys64/home/asp/qt5/qtbase/config.tests/unix/icu -I. -IC:/msys64/home/asp/qt5/qtbase/mkspecs/win32-g++  -o icu.o C:/msys64/home/asp/qt5/qtbase/config.tests/unix/icu/icu.cpp
    > C:/msys64/home/asp/qt5/qtbase/config.tests/unix/icu/icu.cpp:40:28: fatal error: unicode/utypes.h: No such file or directory
    >  #include <unicode/utypes.h>
    >                             ^
    > compilation terminated.
    > make: *** [Makefile:155: icu.o] Fehler 1
     => source failed verification.
    Trying source 2 (type inline) of library icu ...
      => source failed condition '!config.win32'.
    test config.corelib.libraries.icu FAILED
    

    I build ICU 57.1 (58.1 & 58.2 don't compile) from source and installed it in /usr/local/icu:

    wget http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.zip
    unzip icu4c-57_1-src.zip
    cd icu/source
    mkdir build
    cd build
    ../runConfigureICU MinGW prefix=/usr/local/icu
    make && make install
    

    I downloaded the Qt 5.8 source code:

    git clone https://code.qt.io/qt/qt5.git
    cd qt5
    perl init-repository
    git checkout 5.8
    

    The ICU libraries are copied into Qt source tree:

    cp /usr/local/icu/lib/icu*57.dll ~/qt5/qtbase/bin
    

    I set some environment variables in the MSYS2 64 Bit shell:

    cd ~/qt5
    export INCLUDE=/usr/local/icu/include:/usr/local/openssl/include
    export LIB=/usr/local/icu/lib:/usr/local/openssl/lib
    export QMAKESPEC=
    export QTDIR=
    export MAKE_COMMAND=
    windows2unix() { local pathPcs=() split pathTmp IFS=\;; read -ra split <<< "$*"; for pathTmp in "${split[@],}"; do pathPcs+=( "/${pathTmp//+([:\])//}" ); done; echo "${pathPcs[*]}"; }; systemrootP=$(windows2unix "$SYSTEMROOT"); export PATH="$PWD/qtbase/bin:$PWD/gnuwin32/bin:/c/msys64/mingw64/bin:/c/msys64/usr/bin:/c/msys64/usr/local/icu/lib"
    

    I checked the Option-A Prerequisites:

    perl -v
    This is perl 5, version 22, subversion 1 (v5.22.1) built for x86_64-msys-thread-multi
    
    python --version
    Python 2.7.13
    
    ruby -v
    ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-msys]
    
    Microsoft DirectX SDK - not needed
    
    MinGW-builds GCC 4.8.2 64-bit (threads-posix/seh) - I used MinGW64 toolchain
    pacman -S mingw-w64-x86_64-toolchain
    pacman -S mingw-w64-i686-toolchain
    
    gcc -v
    Using built-in specs.
    COLLECT_GCC=C:\msys64\mingw64\bin\gcc.exe
    COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/lto-wrapper.exe
    Target: x86_64-w64-mingw32
    Configured with: ../gcc-6.3.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev1, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
    Thread model: posix
    gcc version 6.3.0 (Rev1, Built by MSYS2 project)
    
    uname -a
    MINGW64_NT-6.1 WS011685 2.6.1(0.305/5/3) 2017-01-25 00:01 x86_64 Msys
    
    git --version
    git version 2.11.0
    

    Now everything needed should be available (I compiled and installed OpenSSL), so I created a build directory:

    mkdir qt-build
    cd qt-build
    

    I dropped the option '-c++11', because of

    ERROR: Unknown command line option '-c++11'.
    

    Then I started to configure Qt and got another error:

    ERROR: Feature 'icu' was enabled, but the pre-condition 'libs.icu' failed.
    

    In config.log I found

    > dlopen.cpp:34:19: fatal error: dlfcn.h: No such file or directory
    >  #include <dlfcn.h>
    >                    ^
    > compilation terminated.
    > make: *** [Makefile:155: dlopen.o] Fehler 1
    test config.corelib.tests.dlopen FAILED
    

    So I installed dlfcn:

    pacman -S mingw-w64-x86_64-dlfcn
    pacman -S mingw-w64-i686-dlfcn
    

    And now I've got the error described at top, when I started configure:

    ../qt5/configure -prefix /opt/qt -debug-and-release -opensource -confirm-license -platform win32-g++ -developer-build -icu -I /C/msys64/usr/local/icu/include -opengl desktop -openssl -plugin-sql-odbc -nomake examples -nomake tests
    

    Why is the header file missing?

    C:/msys64/home/asp/qt5/qtbase/config.tests/unix/icu/icu.cpp:40:28: fatal error: unicode/utypes.h: No such file or directory
    

    I checked, if it's there:

    ls /usr/local/icu/include/unicode/utypes.h
    /usr/local/icu/include/unicode/utypes.h
    

    Does anybody know how to set the INCLUDE path correct?



  • Finally I solved this problem!

    I removed the complete qt5 folder and started from the beginning. Then I got the following error:

    looking for library 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 C:\msys64\home\asp\qt-build\qtbase\config.tests\unix\icu && C:\msys64\home\asp\qt-build\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared console" "INCLUDEPATH += C:/msys64/usr/local/icu/include" "LIBS += -licuin -licuuc -licudt" C:/msys64/home/asp/qt5/qtbase/config.tests/unix/icu
    + cd C:\msys64\home\asp\qt-build\qtbase\config.tests\unix\icu && set MAKEFLAGS=& C:/msys64/usr/bin/make clean && set MAKEFLAGS=& C:/msys64/usr/bin/make
    > rm -f icu.o
    > g++ -c -pipe -fno-keep-inline-dllexport -g -Wall -Wextra -fexceptions -mthreads -DUNICODE -IC:/msys64/home/asp/qt5/qtbase/config.tests/unix/icu -I. -IC:/msys64/usr/local/icu/include -IC:/msys64/home/asp/qt5/qtbase/mkspecs/win32-g++  -o icu.o C:/msys64/home/asp/qt5/qtbase/config.tests/unix/icu/icu.cpp
    > g++ -Wl,-subsystem,console -mthreads -o icu.exe icu.o  -licuin -licuuc -licudt 
    > C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -licuin
    > C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -licuuc
    > C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -licudt
    > collect2.exe: error: ld returned 1 exit status
    > make: *** [Makefile:62: icu.exe] Fehler 1
     => source failed verification.
    Trying source 2 (type inline) of library icu ...
      => source failed condition '!config.win32'.
    test config.corelib.libraries.icu FAILED
    

    So the headers could be found this time! But now the ICU lib couldn't be linked. So I added '-L /C/msys64/usr/local/icu/lib' and tried again:

    ../qt5/configure -prefix /opt/qt -debug-and-release -opensource -confirm-license -platform win32-g++ -developer-build -icu -I /C/msys64/usr/local/icu/include -L /C/msys64/usr/local/icu/lib -opengl desktop -openssl -plugin-sql-odbc -nomake examples -nomake tests
    
    Qt is now configured for building. Just run 'make'.
    Once everything is built, you must run 'make install'.
    Qt will be installed into 'C:\msys64\opt\qt'
    

    That's it, this issue is done!


Log in to reply
 

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