Open jinke18 opened 1 month ago
具体引发envs.WindowsSDKVersion为一个空table的原因我定位不到,所以我简单判断了一下变量类型以保证xmake运行不报错。这是我的第三个更改。
这个还是要定位下,不然没解决根本原因。。可以用 debug.traceback 看下栈,按理应该是 string 才对
Bot detected the issue body's language is not English, translate it automatically.
I can't find the specific reason why envs.WindowsSDKVersion is an empty table, so I simply judged the variable type to ensure that xmake does not report an error when running. This is my third change.
This still needs to be positioned, otherwise the root cause will not be solved. . You can use debug.traceback to look at the stack. It should be a string.
vcvarsall.bat
,得到的环境变量WindowsSDKVersion
不存在或者为空 这会影响生成的vs工程的配置,例如所以需要修复
WindowsSDKVersion
的检测函数我们可以从
WindowsSdkDir
变量中提取WindowsSDKVersion
,这是我的第一个更改。在更改1的基础上,这种情况会导致在提取
WindowsSDKVersion
后,后续的fix UCRTVersion代码执行不正确。它会将windows sdk10的lib环境更改为windows sdk8中的路径,这会导致c++在链接时找不到ucrt.lib。所以我将fix UCRTVersion代码移到了fix WindowsSDKVersion前面。这是我的第二个更改。
WindowsSDKVersion
为空时,会引起find_rc内部的envs.WindowsSDKVersion为一个空table 这导致xmake运行报错具体引发envs.WindowsSDKVersion为一个空table的原因我定位不到,所以我简单判断了一下变量类型以保证xmake运行不报错。这是我的第三个更改。
Sometimes when calling 'vcvarsall. bat', the environment variable 'Windows SDK Version' obtained does not exist or is empty This will affect the configuration of the generated VS project, for example
So it is necessary to fix the detection function of 'Windows SDK Version'
We can extract 'Windows SDK Version' from the 'Windows SDK' variable, which is my first change.
After installing VS2015, there will be an impact of coexistence between Windows SDK 8.1 and Windows SDK 10. Could it be that VS2015 requires the UCRT environment in Windows SDK 10? I'm not sure about the specific reason, but my personal computer and work computer are both like this, with Win11 and Win10 respectively.
On the basis of changing 1, this situation will result in incorrect execution of the subsequent fix UCRTVersion code after extracting 'Windows SDK Version'. It will change the lib environment of Windows SDK 10 to the path in Windows SDK 8, which will cause C++to not find ucrt.lib when linking.
So I moved the fix UCRTVersion code before fix Windows SDK Version. This is my second change.
When 'Windows SDK Version' is empty, it will cause envs inside find_rc Windows SDK Version is an empty table This causes xmake to run with errors
I cannot locate the reason why Windows SDK Version is an empty table, so I simply checked the variable type to ensure that xmake runs without errors. This is my third change.