我正在使用VS2017构建工具从源代码构建Qt 5.11.1。 我设置的环境如下:
set QTDIR=%CD%
set PATH=%PATH%;%QTDIR%\qtbase\bin;C:\Oracle11\client11.2.0\bin;C:\Python27\;C:\ruby_2.0.0\bin;C:\Python27\Scripts\;C:\Perl64\site\bin;C:\Perl64\bin;C:\GnuWin32\bin;C:\icu\bin64
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat"
set INCLUDE=%INCLUDE%;C:\app\client\x\product\12.2.0\client_1\oci\include;C:\Python27\include;C:\ruby_2.0.0\include;"C:\mysql-5.5\include;C:\icu\include";"C:\Program Files (x86)\Windows Kits\10\Include"
set LIB=%LIB%;C:\app\client\x\product\12.2.0\client_1\oci\lib\msvc;C:\Python27\Lib;C:\ruby_2.0.0\lib;"C:\mysql-5.5\lib";C:\icu\lib64;"C:\Program Files (x86)\Windows Kits\10\Lib"
然后调用configure
脚本:
configure -prefix %QTDIR%\_STAGE -platform win32-msvc -commercial -confirm-license -release -shared -qt-libjpeg -qt-libpng -no-cups -no-mtdev -nomake examples -icu -plugin-sql-mysql -plugin-sql-odbc -plugin-sql-sqlite -opengl dynamic -skip qtconnectivity -skip webengine -D _IGNORE_FINAL
该脚本可以完成一些工作,并且在检查配置时会失败-找不到icu
:
ERROR: Feature 'icu' was enabled, but the pre-condition 'libs.icu' failed.
Check config.log for details.
这是config.log
中的相关部分:
loaded result for library config.qtbase_corelib.libraries.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:\Users\x\Documents\qt\config.tests\icu && C:\Users\x\Documents\qt\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "DEFINES += _IGNORE_FINAL" "LIBS += -licuin -licuuc -licudt" C:/Users/x/Documents/qt/config.tests/icu
+ cd /d C:\Users\x\Documents\qt\config.tests\icu && set MAKEFLAGS=& nmake
> Microsoft (R) Program Maintenance Utility Version 14.15.26726.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 -O2 -MD -W0 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_IGNORE_FINAL -DNDEBUG -I. -IC:\Users\x\Documents\qt\qtbase\mkspecs\win32-msvc -Fo @C:\Users\x\AppData\Local\Temp\8\nm8F4F.tmp
> main.cpp
> link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /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\x\AppData\Local\Temp\8\nm91F0.tmp
> main.obj : error LNK2019: unresolved external symbol ucol_open_57 referenced in function main
> main.obj : error LNK2019: unresolved external symbol ucol_close_57 referenced in function main
> icu.exe : fatal error LNK1120: 2 unresolved externals
> NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\bin\HostX64\x64\link.EXE"' : return code '0x460'
> Stop.
我尝试使用
从main.cpp
构建独立的config.tests\icu
cl main.cpp /EHsc
,并得到相同的链接器错误。然后,我添加了libs路径,并且libs和构建成功:
cl main.cpp /EHsc /link /LIBPATH:C:\icu\lib64 icudt.lib icuin.lib icuio.lib icule.lib iculx.lib icutu.lib icuuc.lib
但是当我添加库来配置脚本时,出现了相同的链接器错误。
知道我做错了什么吗?
答案 0 :(得分:0)
尝试将icu lib路径移至第一个路径,然后重新配置似乎可以解决问题
set lib=D:\Qt\Qt5.11.1\third-party\icu-lib\lib;%lib%
在VS2017 5.8.4 32位中测试Qt5.11.1
D:\Qt\Qt5.11.1>cd D:\Qt\Qt5.11.1\5.11\msvc2017build\config.tests\icu
D:\Qt\Qt5.11.1\5.11\msvc2017build\config.tests\icu>set lib
LIB=D:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\ATLMFC\lib\x86;D:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\lib\x86;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x86;C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x86;;D:\Qt\Qt5.11.1\third-party\icu-lib\lib;D:\Qt\Qt5.11.1\third-party\openssl-lib\lib
LIBPATH=D:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\ATLMFC\lib\x86;D:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\lib\x86;D:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\lib\x86\store\references;C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17134.0;C:\Program Files (x86)\Windows Kits\10\References\10.0.17134.0;C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319;
D:\Qt\Qt5.11.1\5.11\msvc2017build\config.tests\icu>nmake
Microsoft (R) Program Maintenance Utility Version 14.15.26729.0
Copyright (C) Microsoft Corporation. All rights reserved.
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\harry\AppData\Local\Temp\nm8ACC.tmp
LINK : icu.exe not found or not built by the last incremental link; performing full link
main.obj : error LNK2019: unresolved external symbol _ucol_open_62 referenced in function _main
main.obj : error LNK2019: unresolved external symbol _ucol_close_62 referenced in function _main
icu.exe : fatal error LNK1120: 2 unresolved externals
NMAKE : fatal error U1077: '"D:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\bin\HostX86\x86\link.EXE"' : return code '0x460'
Stop.
D:\Qt\Qt5.11.1\5.11\msvc2017build\config.tests\icu>set lib=D:\Qt\Qt5.11.1\third-party\icu-lib\lib;%lib%
D:\Qt\Qt5.11.1\5.11\msvc2017build\config.tests\icu>nmake
Microsoft (R) Program Maintenance Utility Version 14.15.26729.0
Copyright (C) Microsoft Corporation. All rights reserved.
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\harry\AppData\Local\Temp\nmA818.tmp