如何使用 MSVC 2008 在 Windows 上使用 qtwebkit 构建 Qt5 - leveldb 找不到 stdint.h
how to build Qt5 with qtwebkit on Windows with MSVC 2008 - leveldb can't find stdint.h
在 Windows 7 x64 盒子上:
- 我安装了Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1
- 我从 http://www.qt.io/download-open-source/#
的 "Source packages and Other releases" 部分下载并解压了 Qt5.4.0 源代码
- 我根据 http://qt-project.org/wiki/Compiling-ICU-with-MSVC.
从源构建并安装了 ICU 54.1
- 我根据 http://doc.qt.io/qt-5/windows-building.html 创建了一个命令提示符快捷方式。
- 我根据 http://qt-project.org/wiki/Building_Qt_5_from_Git 和 http://qt-project.org/wiki/Compiling-ICU-with-MSVC 的用法部分向命令提示符添加了内容。
所以我的 qt5vars.cmd 是:
CALL "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat"
SET _ROOT=C:\qt\qt540
SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;C:\Python27;C:\Python27\Scripts;%PATH%
REM Uncomment the below line when using a git checkout of the source repository
REM SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
SET QMAKESPEC=win32-msvc2008
SET PATH=%PATH%;C:\icu\dist\lib;C:\Ruby193\bin
SET INCLUDE=%INCLUDE%;C:\icu\dist\include
SET LIB=%LIB%;C:\icu\dist\lib
SET _ROOT=
- 我根据 Compiling Qt 5.3.2 + VS2008 + SDK7.1 error SHARDAPPIDINFOLINK.
更新了 qtwinextras\src\winextras\winshobjidl_p.h
- 根据 https://groups.google.com/forum/#!topic/theano-users/JReP5_Ligu4 and C99 stdint.h header and MS Visual Studio,我从另一台机器上的
C:\Program Files\Microsoft Visual Studio 10.0\VC\include
复制了 stdint.h
,并将其粘贴到 C:\Qt\qt540\qtwebkit\Source\WTF\wtf
。我注释掉了WCHAR_MIN
的声明,并将修改后的stdint.h复制到c:\qt\qt540\qtwebkit\source\javascriptcore\runtime
。
使用该设置,根据上面的 qt5vars.cmd 提示,我将 Qt 配置为:
configure -prefix %CD%\qtbase -developer-build -opensource -opengl
desktop -nomake tests -no-compile-examples -skip qtwebkit-examples
-icu -plugin-sql-sqlite -platform win32-msvc2008 -confirm-license
然后运行nmake
。我收到一堆 leveldb 找不到的错误 stdint.h:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/filename.h(10) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
c.cc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/c.h(50) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
dbformat.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
db_impl.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
db_iter.cc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/db_iter.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
filename.cc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/filename.h(10) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
log_reader.cc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/log_reader.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
log_writer.cc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/log_writer.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
memtable.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
repair.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
table_cache.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/table_cache.h(11) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
version_edit.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
version_set.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
write_batch.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '(' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\port\win
中有一个 stdint.h,但是将该文件或我修改的 stdint.h 复制到 leveldb\db
和 leveldb\include\leveldb
没有任何区别 - 我明白了构建 Qt 时出现同样的错误。
我需要做什么才能用 Qt 构建 qtwebkit,或者至少解决这个 leveldb sdtint.h 问题?
好吧,我是个傻瓜。只需要将 stdint.h
复制到 C:\Program Files\Microsoft Visual Studio 9.0\VC\include
而不是复制到每个抱怨的文件的路径。此外,我在 stdint.h 中注释掉了 WCHAR_MIN
的声明以避免大量关于重新声明它的警告。
然后使用原题中的configure
语句,Qt5.4.0构建成功,包括qtwebkit!花了 11 个小时来构建,但它成功了!
在 Windows 7 x64 盒子上:
- 我安装了Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1
- 我从 http://www.qt.io/download-open-source/# 的 "Source packages and Other releases" 部分下载并解压了 Qt5.4.0 源代码
- 我根据 http://qt-project.org/wiki/Compiling-ICU-with-MSVC. 从源构建并安装了
- 我根据 http://doc.qt.io/qt-5/windows-building.html 创建了一个命令提示符快捷方式。
- 我根据 http://qt-project.org/wiki/Building_Qt_5_from_Git 和 http://qt-project.org/wiki/Compiling-ICU-with-MSVC 的用法部分向命令提示符添加了内容。
ICU 54.1
所以我的 qt5vars.cmd 是:
CALL "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat"
SET _ROOT=C:\qt\qt540
SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;C:\Python27;C:\Python27\Scripts;%PATH%
REM Uncomment the below line when using a git checkout of the source repository
REM SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
SET QMAKESPEC=win32-msvc2008
SET PATH=%PATH%;C:\icu\dist\lib;C:\Ruby193\bin
SET INCLUDE=%INCLUDE%;C:\icu\dist\include
SET LIB=%LIB%;C:\icu\dist\lib
SET _ROOT=
- 我根据 Compiling Qt 5.3.2 + VS2008 + SDK7.1 error SHARDAPPIDINFOLINK. 更新了
- 根据 https://groups.google.com/forum/#!topic/theano-users/JReP5_Ligu4 and C99 stdint.h header and MS Visual Studio,我从另一台机器上的
C:\Program Files\Microsoft Visual Studio 10.0\VC\include
复制了stdint.h
,并将其粘贴到C:\Qt\qt540\qtwebkit\Source\WTF\wtf
。我注释掉了WCHAR_MIN
的声明,并将修改后的stdint.h复制到c:\qt\qt540\qtwebkit\source\javascriptcore\runtime
。
qtwinextras\src\winextras\winshobjidl_p.h
使用该设置,根据上面的 qt5vars.cmd 提示,我将 Qt 配置为:
configure -prefix %CD%\qtbase -developer-build -opensource -opengl desktop -nomake tests -no-compile-examples -skip qtwebkit-examples -icu -plugin-sql-sqlite -platform win32-msvc2008 -confirm-license
然后运行nmake
。我收到一堆 leveldb 找不到的错误 stdint.h:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/filename.h(10) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
c.cc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/c.h(50) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
dbformat.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
db_impl.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
db_iter.cc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/db_iter.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
filename.cc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/filename.h(10) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
log_reader.cc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/log_reader.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
log_writer.cc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/log_writer.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
memtable.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
repair.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
table_cache.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/table_cache.h(11) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
version_edit.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
version_set.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
write_batch.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '(' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\port\win
中有一个 stdint.h,但是将该文件或我修改的 stdint.h 复制到 leveldb\db
和 leveldb\include\leveldb
没有任何区别 - 我明白了构建 Qt 时出现同样的错误。
我需要做什么才能用 Qt 构建 qtwebkit,或者至少解决这个 leveldb sdtint.h 问题?
好吧,我是个傻瓜。只需要将 stdint.h
复制到 C:\Program Files\Microsoft Visual Studio 9.0\VC\include
而不是复制到每个抱怨的文件的路径。此外,我在 stdint.h 中注释掉了 WCHAR_MIN
的声明以避免大量关于重新声明它的警告。
然后使用原题中的configure
语句,Qt5.4.0构建成功,包括qtwebkit!花了 11 个小时来构建,但它成功了!