Code Monkey home page Code Monkey logo

vc-ltl5's People

Contributors

icls1337 avatar mingkuang-chuyu avatar mourinaruto avatar wangwenx190 avatar xspeed1989 avatar yzytom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vc-ltl5's Issues

ARM32找不到setjmp 和 __intrinsic_setjmp符号

复现环境

           ###################################################################################################
           #                                                                                                 #
           #                 *         *      * *             *        * * * * *  *                          #
           #                  *       *     *                 *            *      *                          #
           #                   *     *     *       * * * * *  *            *      *                          #
           #                    *   *       *                 *            *      *                          #
           #                      *           * *             * * * *      *      * * * *                    #
           #                                                                                                 #
           ###################################################################################################
           
           VC-LTL Path      : C:\Users\mouri\.nuget\packages\vc-ltl\5.0.4-beta1\build\native\
           VC Tools Version : 14.30.30705
           WindowsTargetPlatformMinVersion : 6.2.9200.0
           Platform         : ARM

受影响范围

至少包含 VC-LTL 的 msvcrt 模式的 ARM32 目标的 Debug 和 Release 配置(虽然只测试了静态链接运行库版本,但是动态链接运行库版本也建议进行检查)

毛利

基于ucrtbase的VC-LTL模式

  • 确认所有vcruntime中的函数的最低引入版本。
  • 确认所有ucrtbase中的函数的最低引入版本。
  • 初步完成 x86,x64,arm,arm64(不包括ec)的支持。
  • WindowsTargetPlatformMinVersion特性执行,目前可以使用10.0.10240.0以及10.0.19041.0,充分优化体积。

不支持FH4异常处理的环境导致链接失败

环境: VS2017 x64
编译: openssl 1.0.2u
命令:
perl Configure VC-WIN64A --prefix=C:\QtSDK\openssl-1.0.2u-x64
call ms\do_win64a
nmake -f ms\ntdll.mak
报错:
libucrt.lib(wcrtomb.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
out32dll\constant_time_test.exe : fatal error LNK1120: 1 unresolved externals

备注:VS2017 x86 ,VS 2019 x64/x86 均能正常编译通过。

msvcrt模式_beginthread创建的线程无法获取ptd

1. 背景

  • 反馈者:大熊(奇虎360)
  • 影响范围:中等
  • 临时解决方案:不要使用_beginthread,改用_beginthreadex
  • 最小复现代码
// x64编译,并且维持默认FH4开启状态
int main()
{
    _beginthread([](void*)
        {
            try
            {
                throw "123";
            }
            catch(...)
            {
            }

        }, 0, nullptr);
        for (;;)
            Sleep(10);
    return 0;
}

2. 原因分析:

因为_beginthread中它正确的初始化了 ptd->handle字段。它不在是 -1,或者0,导致判断出错,具体请参考源代码

__forceinline __acrt_ptd* __cdecl __acrt_getptd_noexit(void)
{
    __acrt_ptd* ptd = (__acrt_ptd*)(((unsigned char*)_errno()) - FIELD_OFFSET(__acrt_ptd, _terrno));

    /*
    当 _thandle = -1,这表明此线程的ptd通过msvcrt.dll begin_thread 或者 __getptd_noexit 创建。
    当 _thandle = 0,这表明此线程的ptd通过msvcrt.dll的DllMain创建。
    当 _thandle = 其他,这表明msvcrt.dll内部内存已经申请失败。
    */
    return (ptd->_thandle == (uintptr_t)-1/*Current Thread Handle*/ || ptd->_thandle == 0) ? ptd : (__acrt_ptd*)NULL;
}

3. 方案

3.1. 修复方案

这里的判断主要其实是为了判断内存是否申请失败。因为ptd申请失败时,_errno 会返回msvcrt模块中全局变量的地址。
因此特意判断。因此我们可以通过判断返回的地址是否属于模块 msvcrt,也可以判断内存是否申请失败。伪代码如下:

// _errno 的变量地址其实在ptd上,它内部通过调用 `__getptd_noexit`,获取ptd,然后返回 `&ptd->_terrno` 。
// 注意:如果ptd 为空指针(内存申请失败),那么_errno 会返回一个全局变量的地址。
// 
auto _p_errno_value = (uintptr_t )_errno();

if(_uMsvcrtModuleBaseAddress <= _p_errno_value && _p_errno_value <  _uMsvcrtModuleEndAddress )
{
    // _errno 内部 ptd 的内存申请失败,现在返回了全局变量的地址。
    return nullptr;
}

// 成功,开始根据偏移找到 ptd
return (__acrt_ptd*)(((unsigned char*)_p_errno_value) - FIELD_OFFSET(__acrt_ptd, _terrno));

3.2. 单元测试 —— 品质保证

此外,同时附带单元测试,验证ptd能否顺利获取,目前能想到需要做这几种场景:

  • 主线程
  • _beginthread的线程
  • _beginthreadex的线程
  • CreateThread的线程

Debug模式下, try catch会出现崩溃问题

#include <exception>
#include <string>

class c_exception : public std::exception
{
public:
	c_exception(const char* err) {
		m_str = err;

	}
	const char* what() const override {
		return m_str.c_str();
	}
private:
	std::string m_str;
};

void throw_e() {
	throw c_exception("error");
}

int main(int argc, char* argv[]) {
	try {
		throw_e();
	}
	catch (std::exception& e) {
		printf("%s", e.what());
	}
}

示例代码如上,编译环境:

1>  VC Tools Version : 14.30.30705
1>  WindowsTargetPlatformMinVersion : 5.1.2600.0
1>  Platform         : Win32

multi-config CMake build编译失败

早期VC-LTL需要根据CMAKE_BUILD_TYPE识别当前是Debug还是Release,multi-config中这个似乎出现了问题。

我们正在寻找一种解决方案

tlsGuards导致无法与老版本CRT链接

开发环境: VS2017 15.9.11
VC-LTL5版本: 5.0.4beta1
编译过程:1.下载vc-ltl binary,解压缩后执行instal.cmd

              2.下载qt 5.12.12 代码,修改qtbase/mkspecs/common/msvc-desktop.conf

-QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_OPTIMIZE -MD
-QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -Zi -MD
-QMAKE_CFLAGS_DEBUG = -Zi -MDd
+QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_OPTIMIZE -MT
+QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -Zi -MT
+QMAKE_CFLAGS_DEBUG = -Zi -MTd

             3. 打开vc2017 x64命令行

** Visual Studio 2017 Developer Command Prompt v15.9.11
** Copyright (c) 2017 Microsoft Corporation


[vcvarsall.bat] Environment initialized for: 'x64'

             4. 执行VC-LTL helper for nmake.cmd

#######################################################################

* * * * * * * * * * *

* * * * * *

* * * * * * * * * * *

* * * * * *

* * * * * * * * * * * *

#######################################################################
VC-LTL Path : c:\Users\SunAC\Downloads\vc-ltl
VC Tools Version : 14.16.27023
WindowsTargetPlatformMinVersion : 6.0.6000.0
Platform : x64

             5.   进入qt代码目录,配置编译

configure -confirm-license -opensource -prefix C:\QtSDK\qt-5.12.12-x64-vc2017 -release -force-debug-info -separate-debug-info -qml-debug -platform win32-msvc -mp -opengl dynamic -qt-zlib -qt-libpng -qt-libjpeg -plugin-sql-odbc -plugin-sql-mysql -plugin-sql-oci -plugin-sql-psql -no-compile-examples -nomake tests -no-icu -webengine-proprietary-codecs

报错:
link /OUT:..\bin\qmake.exe project.obj main.obj ioutils.obj proitems.obj qmakevfs.obj ........
libvcruntime.lib(frame.obj) : error LNK2019: 无法解析的外部符号 __dyn_tls_on_demand_init,该符号在函数 "public: static void * __cdecl __FrameHandler4::CxxCallCatchBlock(struct _EXCEPTION_RECORD *)" (?CxxCallCatchBlock@__FrameHandler4@@SAPEAXPEAU_EXCEPTION_RECORD@@@z) 中被引用
libvcruntime.lib(frame.obj) : error LNK2001: 无法解析的外部符号 __tls_guard
..\bin\qmake.exe : fatal error LNK1120: 2 个无法解析的外部命令
NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\link.EXE"”: 返回代码“0x460”
Stop.

添加vccorlib支持

微软有一份wincorlib(WIndows 8.1或者更高版本提供)

为了减轻VC-LTL的分发负担,vccorlib将在链接时,直接在客户机器中生成。

VC-LTL 5.0本身只提供 动态lib部分

基于msvcrt的VC-LTL模式

  • 完成基于Windows Vista的模式兼容(vcruntime x86 + x64)

  • 完成基于Windows Vista的模式兼容(ucrtbase x86 + x64)

  • 完成基于Windows RT arm的模式兼容(vcruntime)

  • 完成基于Windows RT arm的模式兼容(ucrtbase)

  • 完成基于Windows 8的模式兼容(vcruntime x86 + x64)

  • 完成基于Windows 8的模式兼容(ucrtbase x86 + x64)

  • 完成基于Windows XP的模式兼容(vcruntime x86 + x64)

  • 完成基于Windows XP的模式兼容(ucrtbase x86 + x64)

RC文件中引用VC-LTL编译失败

https://ci.appveyor.com/project/myfreeer/7z-build-nsis/builds/42916311/job/rxnk9orv02fsqujr
https://github.com/myfreeer/7z-build-nsis/tree/vc-ltl-5

VC-LTL: 5.0.4

C:\projects\7z-build-nsis\VC-LTL\TargetPlatform\header\corecrt.h(67) : warning RC4011: identifier truncated to '_LTL_ucrt_module_type_from_msvcrte_", "", "2")_impl_(1,2))Pre_valid_impl_ _Deref_pre1_impl_(__readaccess_impl_notref))ref)).h'
C:\projects\7z-build-nsis\VC-LTL\TargetPlatform\header\corecrt.h(67) : warning RC4011: identifier truncated to '_LTL_ucrt_module_type_from_msvcrte_", "", "2")_impl_(1,2))Pre_valid_impl_ _Deref_pre1_impl_(__readaccess_impl_notref))ime.h'
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um\winnt.h(253) : error RC2188: C:\projects\7z-build-nsis\VC-LTL\TargetPlatform\header\corecrt.h(67) : warning RC4011: identifier truncated to '_LTL_ucrt_module_type_from_msvcrte_", "", "2")_impl_(1,2))Pre_valid_impl_ _Deref_pre1_impl_(__readaccess_impl_notref))clude\..\include\vcruntime.h'
C:\projects\7z-build-nsis\VC-LTL\TargetPlatform\header\corecrt.h(67) : warning RC4011: identifier truncated to '_LTL_ucrt_module_type_from_msvcrte_", "", "2")_impl_(1,2))Pre_valid_impl_ _Deref_pre1_impl_(__readaccess_impl_notref))ime.h'
C:\projects\7z-build-nsis\VC-LTL\TargetPlatform\header\corecrt.h(67) : warning RC4011: identifier truncated to '_LTL_ucrt_module_type_from_msvcrte_", "", "2")_impl_(1,2))Pre_valid_impl_ _Deref_pre1_impl_(__readaccess_impl_notref))ime.h'
C:\projects\7z-build-nsis\VC-LTL\TargetPlatform\header\corecrt.h(67) : warning RC4011: identifier truncated to '_LTL_ucrt_module_type_from_msvcrte_", "", "2")_impl_(1,2))Pre_valid_impl_ _Deref_pre1_impl_(__readaccess_impl_notref))ime.h'
C:\projects\7z-build-nsis\VC-LTL\TargetPlatform\header\corecrt.h(67) : warning RC4011: identifier truncated to '_LTL_ucrt_module_type_from_msvcrte_", "", "2")_impl_(1,2))Pre_valid_impl_ _Deref_pre1_impl_(__readaccess_impl_notref))ime.h'
C:\projects\7z-build-nsis\C\Util\7zipInstall\x64\RCa03368(48) : fatal error RC1116: RC terminating after preprocessor errors
fatal error U1077: '"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64\rc.EXE"' : return code '0x2'
Stop.
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.11.10
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
#######################################################################
#                                                                     #
#     *         *      * *             *        * * * * *  *          #
#      *       *     *                 *            *      *          #
#       *     *     *       * * * * *  *            *      *          #
#        *   *       *                 *            *      *          #
#          *           * *             * * * *      *      * * * *    #
#                                                                     #
#######################################################################
VC-LTL Path : C:\projects\7z-build-nsis\VC-LTL\
VC Tools Version : 14.29.30133
WindowsTargetPlatformMinVersion : 6.0.6000.0
Platform : x64
----------------

VC-LTL FH4 x64 嵌套 try catch 下无法正确抓取异常

和鸭子探讨解决 #7 的时候,虽然 Debug 版 NanaZip 在对应场景下不再崩溃,但 Release 版依旧在对应场景存在崩溃问题,经调查,在嵌套 try catch 的场景下 x64 版本的 VC-LTL 无法正确抓取异常。

毛利

分享一下实际使用的体验以及对适用场景的分析(非bug)

实际使用下来,我发现链接到msvcrt的好处在编写短小的命令行程序的时候很有效,这时候因为软件的体积本身就比较小,静态链接msvc运行库增加的体积就特别明显。

但是一旦使用到比较庞大的软件上,而且不带一堆第三方动态库,而是全部静态链接到一起,体积也只能减少200到300KB,软件自身的体量就占大头了。

所以我认为VC-LTL适用的场景应该是:

  • 携带大量dll形式的第三方库的软件,如果每一个dll都静态链接msvc运行库上去,那么体积增长会十分可观,这时候全部使用VC-LTL,可以获得最大的收益
  • 短小的命令行应用程序,静态链接msvc运行库带来的体积膨胀显著

14.35.32215 Self built binaries don't work

I tried to use my self built vc-ltl5 binaries to compile and link this simple code:

#include <stdio.h>

void main() {
    printf("Hello World\n");
}

But I get a lot of link errors:

...

 libucrt.lib(_file.obj) : error LNK2019: unresolved external symbol __imp__lock referenced in function _lock_file [d:\projects\test3\_projects\test\test.vcxproj]
  libucrt.lib(setlocal_thunks.obj) : error LNK2001: unresolved external symbol __imp__lock [d:\projects\test3\_projects\test\test.vcxproj]
  libucrt.lib(_file.obj) : error LNK2019: unresolved external symbol __imp__unlock referenced in function _unlock_file [d:\projects\test3\_projects\test\test.vcxproj]
  libucrt.lib(setlocal_thunks.obj) : error LNK2001: unresolved external symbol __imp__unlock [d:\projects\test3\_projects\test\test.vcxproj]
  libucrt.lib(_file.obj) : error LNK2019: unresolved external symbol __imp__iob referenced in function __acrt_iob_func [d:\projects\test3\_projects\test\test.vcxproj]
  libucrt.lib(fputwc_thunks.obj) : error LNK2001: unresolved external symbol __imp__iob [d:\projects\test3\_projects\test\test.vcxproj]
  libucrt.lib(sftbuf_thunks.obj) : error LNK2001: unresolved external symbol __imp__iob [d:\projects\test3\_projects\test\test.vcxproj]

...

I built vc-ltl5 like this:

  • Installed Visual Studio Community 2022 - 17.5.0 with following options:
    Windows 10 SDK 10.0.19041.0
    MSVC x64/x86 build tools
    MSVC ARM build tools
    MSVC ARM64/ARM64EC build tools
  • extracted sources from VC-LTL5-5.0.5.zip
  • changed to extracted folder and run: MSBuild.exe -t:Build -m Build.proj

The build succeeded with no errors and all binaries including "*.lib" files can be found in the "TargetPlatform" folder. But when I use these libraries to compile I get the above errors.

When I use the binaries from the Github page from the file "VC-LTL-5.0.5-Binary.7z". I can compile and link my simple test code without any issue.

What could be the problem with my self built binaries?

Win10 + VS2022 + CMake, Error

CMake Error:
VC-LTL not load, because CMAKE_SYSTEM_NAME is not defined!!!
Call Stack (most recent call first):
VC-LTL helper for cmake.cmake:87 (include)
CMakeLists.txt:19 (include)

VS2015/2017报告__filter_x86_sse2_floating_point_exception找不到问题

MLKYK9RKY1@LI_%@%~Z7QU1

WinXP x86可以复现

__filter_x86_sse2_floating_point_exception

反馈者:星期四

1>qtvars_plugin_import.cpp
1>libvcruntimed.lib(CxxFrameHandler_WinXP.obj) : warning LNK4075: 忽略“/EDITANDCONTINUE”(由于“/SAFESEH”规范)
1>libvcruntimed.lib(chandler4.obj) : error LNK2019: 无法解析的外部符号 __filter_x86_sse2_floating_point_exception,该符号在函数 __except_handler4 中被引用
1>D:\Project\DriverSchoolV2\DriverSchoolClient\Debug\DriverSchoolClient.exe : fatal error LNK1120: 1 个无法解析的外部命令

Windows XP模式编译时_wputenv_s发生缓冲区越界访问

1. 基本信息

  • 反馈者:小学生菲利克斯
  • 操作系统:Windows 10
  • 目标产物:Windows XP模式 + x86
  • 受影响的VC-LTL版本:<= 5.0.6 均受到影响
  • 复现概率:尚不明确,其概率与函数持有的栈大小有关,崩溃也不是必然。
  • 影响范围:Windows XP模式且使用到 _wputenv_s的代码将受到影响,其他模式不受到影响。
  • dmp信息:win32.7z(QQ发送)

1.1. 临时规避方案

临时改用_wputenv,同时新版本5.0.7将修复此问题。

// 在老版本VC-LTL中 不要使用_wputenv_s,下面是等效的替换。
// _wputenv_s(L"Name", L"");
_wputenv(L"Name=");

1.2. 最小复现代码

int main()
{
   // 可观察到 返回值为 22,而非预期的 0。
   // 崩溃它不一定发生,除非开启ASAN。
    _wputenv_s(L"123", L"");
    return 0;
}

2. 问题原因

_wputenv内部为字符串分配缓冲区时,没有正确的 * sizeof(wchar_t),导致实际分配的缓冲区长度小于预期。从而发生越界访问。
具体代码点:https://github.com/Chuyu-Team/VC-LTL5/blob/v5.0.6/ucrtbase.msvcrt/putenv.cpp#L43

3. 问题修复

修正缓冲区长度,重新确认所有 * sizeof 位点有无异常。静态代码分析???

VC-LTL FH4+x64+Debug访问非法地址导致的异常

为了更舒服的升级到 Windows 11 于是我前段日子开发了 NanaZip 并上架到了商店。

当然 NanaZip 1.0 Preview 1 和 Preview 2 都有在根目录下右键时 100% 导致程序崩溃的问题
(也有用户提到了 https://github.com/M2Team/NanaZip/issues/12)

经过排查,发现是 VC-LTL FH4 处理方面的 Bug 导致的(当然 19041 模式的 VC-LTL 因为直接使用 ucrtbase 的 FH4 实现于是没有问题)

毛利

VC-LTL5不能与VC2019配合使用编译Qt 5.12.12

开发环境: VS2019 16.11.5 (cl 14.29.30133)
VC-LTL5版本: 5.0.4beta1
编译过程:1.下载vc-ltl binary,解压缩后执行instal.cmd
2.下载Qt 5.12.12,打补丁,使用/MT编译
3.打开vc2019 x64命令行
vcvarsall.bat x64 10.0.19041.0 -vcvars_ver=14.29
4.设置Gnu工具路径
set PATH=%PATH%;C:\QtSDK\GnuTools\Perl\bin;C:\QtSDK\GnuTools\Python27;C:\QtSDK\GnuTools\Ruby21\bin
5.执行VC-LTL helper for nmake.cmd
#######################################################################

* * * * * * * * * * *

* * * * * *

* * * * * * * * * * *

* * * * * *

* * * * * * * * * * * *

#######################################################################
VC-LTL Path : C:\QtSDK\vc-ltl
VC Tools Version : 14.29.30133
WindowsTargetPlatformMinVersion : 6.0.6000.0
Platform : x64
6.配置Qt编译选项
configure -confirm-license -opensource -prefix C:\QtSDK\qt-5.12.12-x64-vc2019 -release -force-debug-info -separate-debug-info -qml-debug -platform win32-msvc -mp -opengl dynamic -qt-zlib -qt-libpng -qt-libjpeg -no-compile-examples -nomake tests -no-icu
7.jom执行编译
报错
[1681/22547] cmd /c C:\QtSDK\GnuTools\Python27\python.exe ../../3rdparty/chromium/build/toolchain/win/tool_wrapper.py delete-file ./brotli.exe.pdb && C:\QtSDK\GnuTools\Python27\python.exe ../../3rdparty/chromium/build/toolchain/win/tool_wrapper.py link-wrapper environment.x64 False link.exe /nologo /OUT:./brotli.exe /PDB:./brotli.exe.pdb @./brotli.exe.rsp
FAILED: brotli.exe brotli.exe.pdb
cmd /c C:\QtSDK\GnuTools\Python27\python.exe ../../3rdparty/chromium/build/toolchain/win/tool_wrapper.py delete-file ./brotli.exe.pdb && C:\QtSDK\GnuTools\Python27\python.exe ../../3rdparty/chromium/build/toolchain/win/tool_wrapper.py link-wrapper environment.x64 False link.exe /nologo /OUT:./brotli.exe /PDB:./brotli.exe.pdb @./brotli.exe.rsp
libucrt.lib(setlocal_thunks.obj) : error LNK2001: 无法解析的外部符号 __imp__amsg_exit
.\brotli.exe : fatal error LNK1120: 1 个无法解析的外部命令

奇怪
libucrt.lib会链接到cdecl调用的函数么?

附补丁:

diff -ur a/qtbase/mkspecs/common/msvc-desktop.conf b/qtbase/mkspecs/common/msvc-desktop.conf
--- a/qtbase/mkspecs/common/msvc-desktop.conf 2017-06-19 13:36:58 +0800
+++ b/qtbase/mkspecs/common/msvc-desktop.conf 2017-06-20 09:58:33 +0800
@@ -30,8 +30,8 @@
QMAKE_CFLAGS = -nologo -Zc:wchar_t
QMAKE_CFLAGS_WARN_ON = -W3
QMAKE_CFLAGS_WARN_OFF = -W0
-QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_OPTIMIZE -MD
-QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -Zi -MD
-QMAKE_CFLAGS_DEBUG = -Zi -MDd
+QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_OPTIMIZE -MT
+QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -Zi -MT
+QMAKE_CFLAGS_DEBUG = -Zi -MTd
QMAKE_CFLAGS_YACC =
QMAKE_CFLAGS_LTCG = -GL
diff -ur a/qtwebengine/src/3rdparty/chromium/third_party/angle/src/common/mathutil.cpp b/qtwebengine/src/3rdparty/chromium/third_party/angle/src/common/mathutil.cpp
--- a/qtwebengine/src/3rdparty/chromium/third_party/angle/src/common/mathutil.cpp 2019-03-07 17:23:57 +0800
+++ b/qtwebengine/src/3rdparty/chromium/third_party/angle/src/common/mathutil.cpp 2019-03-07 17:23:57 +0800
@@ -72,9 +72,9 @@
{
const RGB9E5Data inputData = reinterpret_cast<const RGB9E5Data>(&input);

  • *red = inputData->R * pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits);
  • *green = inputData->G * pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits);
  • *blue = inputData->B * pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits);
  • *red = inputData->R * (float)pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits);
  • *green = inputData->G * (float)pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits);
  • *blue = inputData->B * (float)pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits);
    }

} // namespace gl
diff -ur a/qtwebengine/src/3rdparty/chromium/build/config/BUILDCONFIG.gn b/qtwebengine/src/3rdparty/chromium/build/config/BUILDCONFIG.gn
--- a/qtwebengine/src/3rdparty/chromium/build/config/BUILDCONFIG.gn 2019-03-07 17:23:57 +0800
+++ b/qtwebengine/src/3rdparty/chromium/build/config/BUILDCONFIG.gn 2019-03-27 14:05:29 +0800
@@ -545,7 +545,7 @@

if (is_win) {
default_compiler_configs += [

  • "//build/config/win:default_crt",
  • "//build/config/win:static_crt",
    "//build/config/win:lean_and_mean",
    "//build/config/win:nominmax",
    "//build/config/win:unicode",
    diff -ur a/qtwebengine/src/3rdparty/chromium/build/config/win/BUILD.gn b/qtwebengine/src/3rdparty/chromium/build/config/win/BUILD.gn
    --- a/qtwebengine/src/3rdparty/chromium/build/config/win/BUILD.gn 2019-03-07 17:23:57 +0800
    +++ b/qtwebengine/src/3rdparty/chromium/build/config/win/BUILD.gn 2019-03-27 16:47:54 +0800
    @@ -218,7 +219,7 @@
    if (!use_vs_code_analysis) {

    This is required for ATL to use XP-safe versions of its functions.

    However it is prohibited when using /analyze

  • defines += [ "USING_V110_SDK71" ]
  • defines += [ "USING_V110_SDK71" ]

}

if (use_custom_libcxx) {
diff -ur a/qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/build/common.gypi b/qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/build/common.gypi
--- a/qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/build/common.gypi 2019-03-07 17:23:57 +0800
+++ b/qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/build/common.gypi 2019-03-27 16:27:47 +0800
@@ -323,7 +323,7 @@
'_CRT_NONSTDC_NO_WARNINGS',
'_CRT_NONSTDC_NO_DEPRECATE',
# This is required for ATL to use XP-safe versions of its functions.

  •      '_USING_V110_SDK71_',
    
  •      # '_USING_V110_SDK71_',
       ],
       'msvs_disabled_warnings': [4800],
       'msvs_settings': {
    

diff -ur a/qtwebengine/src/3rdparty/chromium/third_party/brotli/BUILD.gn b/qtwebengine/src/3rdparty/chromium/third_party/brotli/BUILD.gn
--- a/qtwebengine/src/3rdparty/chromium/third_party/brotli/BUILD.gn 2019-03-07 17:23:57 +0800
+++ b/qtwebengine/src/3rdparty/chromium/third_party/brotli/BUILD.gn 2019-03-27 14:07:15 +0800
@@ -170,7 +170,9 @@
if (is_win && visual_studio_version == "2015") {
# Disabling "result of 32-bit shift implicitly converted to 64 bits",
# caused by code like: foo |= (1 << i); // warning 4334

  •  cflags = [ "/wd4334" ]
    
  •  cflags = [ "/wd4334", "/MT" ]
    
  • } else {

  •  cflags = [ "/MT" ]
    

    }

    Always build release since this is a build tool.

diff -ur a/qtwebengine/src/3rdparty/chromium/third_party/yasm/BUILD.gn b/qtwebengine/src/3rdparty/chromium/third_party/yasm/BUILD.gn
--- a/qtwebengine/src/3rdparty/chromium/third_party/yasm/BUILD.gn 2019-03-07 17:23:57 +0800
+++ b/qtwebengine/src/3rdparty/chromium/third_party/yasm/BUILD.gn 2019-03-27 16:20:45 +0800
@@ -49,8 +49,8 @@
if (is_win) {
# This switches to using the release CRT. On debug component builds of
# highbd_sad4d_sse2.asm on Windows this saves about 15 s.

  • configs_to_delete += [ "//build/config/win:default_crt" ]
  • configs_to_add += [ "//build/config/win:release_crt" ]
  • configs_to_delete += [ "//build/config/win:default_crt" ]

  • configs_to_add += [ "//build/config/win:release_crt" ]

}
}

diff -ur a/qtwebengine/src/3rdparty/ninja/configure.py b/qtwebengine/src/3rdparty/ninja/configure.py
--- a/qtwebengine/src/3rdparty/ninja/configure.py 2019-03-07 17:23:57 +0800
+++ b/qtwebengine/src/3rdparty/ninja/configure.py 2019-03-27 14:04:40 +0800
@@ -305,7 +305,7 @@
'/nologo', # Don't print startup banner.
'/Zi', # Create pdb with debug info.
'/W4', # Highest warning level.

  •          '/WX',  # Warnings as errors.
    

+# '/WX', # Warnings as errors.
'/wd4530', '/wd4100', '/wd4706', '/wd4244',
'/wd4512', '/wd4800', '/wd4702', '/wd4819',
# Disable warnings about constant conditional expressions.
@@ -320,6 +320,8 @@
'/wd4267',
'/DNOMINMAX', '/D_CRT_SECURE_NO_WARNINGS',
'/D_HAS_EXCEPTIONS=0',

  •     '/MT',
    
  •     '/D_DISABLE_DEPRECATE_LTL_MESSAGE',
             '/DNINJA_PYTHON="%s"' % options.with_python]
    
    if platform.msvc_needs_fs():
    cflags.append('/FS')

LIBCMT.lib(exe_winmain.obj) : error LNK2001: unresolved external symbol _WinMain@16

https://ci.appveyor.com/project/myfreeer/7z-build-nsis/build/job/mwp0gf6gnbmopsp4#L6790
https://github.com/myfreeer/7z-build-nsis/tree/vc-ltl-5
VC-LTL: v5.0.5-Beta1

Ppmd7.c
Ppmd7Dec.c
LIBCMT.lib(exe_winmain.obj) : error LNK2001: unresolved external symbol _WinMain@16
x86\7zDec.exe : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\link.EXE"' : return code '0x460'
Stop.
Microsoft (R) Program Maintenance Utility Version 14.29.30140.0
Copyright (C) Microsoft Corporation.  All rights reserved.
7zipInstall.c
7zAlloc.c
7zArcIn.c
7zBuf.c
7zBuf2.c
7zCrc.c
7zCrcOpt.c
7zFile.c
7zDec.c
7zStream.c
Bcj2.c
CpuArch.c
DllSecur.c
LzmaDec.c
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation.  All rights reserved.
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um\winnt.h(253) : error RC2188: C:\projects\7z-build-nsis\C\Util\7zipInstall\x86\RCa06616(48) : fatal error RC1116: RC terminating after preprocessor errors
 : fatal error U1077: '"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x86\rc.EXE"' : return code '0x2'
Stop.
Microsoft (R) Program Maintenance Utility Version 14.29.30140.0

**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.11.10
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'
#######################################################################
#                                                                     #
#     *         *      * *             *        * * * * *  *          #
#      *       *     *                 *            *      *          #
#       *     *     *       * * * * *  *            *      *          #
#        *   *       *                 *            *      *          #
#          *           * *             * * * *      *      * * * *    #
#                                                                     #
#######################################################################
VC-LTL Path : C:\projects\7z-build-nsis\VC-LTL\
VC Tools Version : 14.29.30133
WindowsTargetPlatformMinVersion : 5.1.2600.0
Platform : Win32

System-Dlls strings

When I build a project using vc-LTL5 with target version 5 or 6 there are still some leftover strings in the rdata-section of the binary pointing to some system dlls:

api-ms-win-core-datetime-l1-1-1
api-ms-win-core-fibers-l1-1-1
api-ms-win-core-file-l1-2-2
api-ms-win-core-localization-l1-2-1
api-ms-win-core-localization-obsolete-l1-2-0
api-ms-win-core-processthreads-l1-1-2
api-ms-win-core-string-l1-1-0
api-ms-win-core-synch-l1-2-0
api-ms-win-core-sysinfo-l1-2-1
api-ms-win-core-winrt-l1-1-0
api-ms-win-core-xstate-l2-1-0
api-ms-win-rtcore-ntuser-window-l1-1-0
api-ms-win-security-systemfunctions-l1-1-0
ext-ms-win-ntuser-dialogbox-l1-1-0
ext-ms-win-ntuser-windowstation-l1-1-0
api-ms-win-appmodel-runtime-l1-1-2

These are no direct dependencies, they are only utf16 strings in the data section occupying more than 1KB.
Using target version 10 with a dependency to ucrt, there are no such strings.

Is there a possibility to build a binary with target version 5 or 6 without these leftover strings?

请问MD编译方式能使用VC-LTL吗?

感谢开发这套非常优秀的框架!在使用说明中编译项目是采用了MT和MTd的方式。
请问对于使用MFC框架的和不使用MFC框架的项目,能不能支持使用了MD或是MDd方式编译和发布呢?
我看到VC-LTL发布版本中虽然没有MFC的库文件,但是Redist包中包含了MFC的140版本的DLL。
这是不是意味着是可以动态引入MFC呢?

VC-LTL 在 Debug 模式下 ASAN 无法使用

ASAN 即 Address Sanitizer,详细介绍可参阅 https://docs.microsoft.com/en-us/cpp/sanitizers/asan

这个功能对于一些用户来说还是很有用的,该问题由友人 @FASTSHIFT 发现在使用了 VC-LTL 的 LVGL Windows 仿真器项目无法使用 ASAN 后,我进行粗略分析后做出的反馈

注:由于 Release 模式下可以正常使用 ASAN,于是猜测和 VC-LTL 的 Debug Heap 实现有关

附报错截图一份

image

复现参考环境

  • MSVC 2022 (14.30.30705)
  • VC-LTL v5.0.4-Beta1

毛利

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.