运行时错误检查(/RTC)编译选项及实现原理 .

本文详细介绍了Visual Studio 2005中四种运行时错误检查编译选项(/GS, /RTCu, /RTCs, /RTCc),包括它们的作用、适用场景以及实现原理。这些选项能够帮助开发者在调试阶段及时发现并修复诸如缓冲区溢出、未初始化变量使用等问题。

运行时错误检查(/RTC)编译选项及实现原理

 

作者:童磊(magictong)

 

环境:VS2005

前因后果:debug居然编不过!!!这里准备说4个例子,都是为了说明debug版本对于调试是很重要的,很多问题在调试版本下都会提前暴露出来。

 

注意:随意调整优化,可调试选项可能会遇到下面的编译错误:

Command line error D8016 : '/O2' and '/RTC1' command-line options are incompatible

 

(http://msdn.microsoft.com/zh-cn/library/8wtf2dfz(v=vs.80).aspx)

1、/GS

名称:缓冲区安全检查(http://msdn.microsoft.com/zh-cn/library/8dbf701c(v=vs.80).aspx)。

编译选项位置:C/C++ à Code Generation à Buffer Security Check

说明:缓冲区溢出安全检测,要强调的是,该编译选项并不是对每一个函数都设置安全cookies。编译器首先会判断一个函数是否是属于“潜在危险”的函数,例如是否在函数的堆栈上分配了字符串数组等等,就可以作为一个特征(编译器怎么判断的偶没研究过o(_)o )。只有被编译器判断是存在“潜在危险”的函数之后,编译器才会在这个函数里面使用安全cookie检测。但是要注意,它不能预防所有的安全漏洞。

原理:

#include "stdafx.h"

#include <string.h>

void Function(const char*);

 

int _tmain(int argc, _TCHAR* argv[])

{

         char pBuf[] = "aaaaaaaaaaaa";

         Function(pBuf);

         return 0;

}

 

void Function(const char* pBuf)

{

         char szBuf[10];

         strcpy(szBuf, pBuf);

}

void Function(const char* pBuf)

{

004017E0  push        ebp 

004017E1  mov         ebp,esp

004017E3  sub         esp,10h

004017E6  mov         eax,dword ptr [___security_cookie (403000h)]

004017EB  xor         eax,ebp

004017ED  mov         dword ptr [ebp-4],eax

      char szBuf[10];

      strcpy(szBuf, pBuf);

004017F0  mov         eax,dword ptr [ebp+8]

004017F3  push        eax 

004017F4  lea         ecx,[ebp-10h]

004017F7  push        ecx 

004017F8  call        strcpy (401010h)

004017FD  add         esp,8

}

00401800  mov         ecx,dword ptr [ebp-4]

00401803  xor         ecx,ebp

00401805  call        __security_check_cookie (401000h)

0040180A  mov         esp,ebp

0040180C  pop         ebp 

0040180D  ret

 

__security_check_cookie声明:

void __declspec(naked) __fastcall __security_check_cookie(UINT_PTR cookie)

 

00401000  cmp        ecx,dword ptr [___security_cookie (403000h)]

00401006  jne         failure (40100Ah)

00401008  rep ret         

0040100A  jmp        __report_gsfailure(4012BFh)

备注:

在以下情况中,编译器不会对易受攻击的参数提供安全保护:

a.函数不包含缓冲区。

b.如果未启用优化 ( /O 选项(优化代码))。

c.函数具有可变参数列表 (...)。

d.函数标记为 naked (C++)

e.函数的第一行语句包含内联程序集代码。

f.如果仅通过在缓冲区溢出事件中不太可能利用的方式使用参数。

 

2、/ RTCu

名称:未初始化变量使用检查

编译选项位置:C/C++ à Code Generation à Basic Runtime Checks

说明:这是一个动态的警告,编译的时候也会有警告,不过这个是动态的警告,更直观。

原理:

void Function(const char* pBuf)

{

         int a;

         int b;

         b = a;

}

         通过额外使用一个变量来跟踪某个变量是否初始化,下面的代码里面那个额外的跟踪变量放在[ebp-49h]里面。

0042D759  mov         byte ptr [ebp-49h],0

0042D75D  cmp         byte ptr [ebp-49h],0

0042D761  jne         Function+20h (42D770h)

0042D763  push        offset  (42D77Dh)

0042D768  call        @ILT+1935(__RTC_UninitUse) (42B794h)

0042D76D  add         esp,4

 

 

把代码稍微改一改:

void Function(const char* pBuf)

{

         int a;

         int b;

 

         if (pBuf)

         {

                   a = 100;

         }

 

         b = a;

}

很明显那个分支里面,给a赋值之前更改了那个跟踪变量的值(修改为1),这样那个警告框就不会再弹出来了。

0042D72D  cmp         dword ptr [pBuf],0

0042D731  je          Function+1Eh (42D73Eh)

0042D733  mov         byte ptr [ebp-49h],1

0042D737  mov         dword ptr [a],64h

0042D73E  cmp         byte ptr [ebp-49h],0

0042D742  jne         Function+31h (42D751h)

0042D744  push        offset  (42D75Eh)

0042D749  call        @ILT+1935(__RTC_UninitUse) (42B794h)

0042D74E  add         esp,4

 

3、/ RTCs

名称:堆栈检查

编译选项位置:C/C++ à Code Generation à Basic Runtime Checks

说明:该选项主要做三件事情:

(1)、Debug模式下把stack上的变量全部初始化为0xcc(使用这个值是因为0xcc对应汇编代码int 3,而且这个值很大容易引起程序员的注意),检查未初始化的问题;

(2)、检查数组越界;

(3)、检查ESP是否被破坏。

原理:

0x0D4 = 0x35 * 4

void Function(const char* pBuf)

{

         char szBuf[10];

         strcpy(szBuf, pBuf);

}

00411470  push        ebp 

00411471  mov         ebp,esp

00411473  sub         esp,0D4h

00411479  push        ebx 

0041147A  push        esi 

0041147B  push        edi 

0041147C  lea         edi,[ebp-0D4h]

00411482  mov         ecx,35h

00411487  mov         eax,0CCCCCCCCh

0041148C  rep stos    dword ptr es:[edi]

 

同样是上面的那一小段代码,在strcpy执行完之后,插入了如下一段代码:

0042D6B8  push        edx 

0042D6B9  mov         ecx,ebp

0042D6BB  push        eax 

0042D6BC  lea         edx,[ (42D6E8h)]

0042D6C2  call        @ILT+1480(@_RTC_CheckStackVars@8) (42B5CDh)

 

_RTC_CheckStackVars函数里面对数组的前后两端进行了对比看是否和0CCCCCCCCh相等,如果不相等会报错,用这种方法判断数组是否越界。

0042E140  push        ebp 

0042E141  mov         ebp,esp

0042E143  push        ecx 

0042E144  push        ebx 

0042E145  push        esi 

0042E146  push        edi 

0042E147  xor         edi,edi

0042E149  mov         esi,edx

0042E14B  cmp         dword ptr [esi],edi

0042E14D  mov         ebx,ecx

0042E14F  mov         dword ptr [i],edi

0042E152  jle         _RTC_CheckStackVars+58h (42E198h)

0042E154  mov         eax,dword ptr [esi+4]

0042E157  mov         ecx,dword ptr [eax+edi]

0042E15A  add         eax,edi

0042E15C  cmp         dword ptr [ecx+ebx-4],0CCCCCCCCh

0042E164  jne         _RTC_CheckStackVars+34h (42E174h)

0042E166  mov         edx,dword ptr [eax+4]

0042E169  add         edx,ecx

0042E16B  cmp         dword ptr [edx+ebx],0CCCCCCCCh

0042E172  je          _RTC_CheckStackVars+48h (42E188h)

0042E174  mov         eax,dword ptr [esi+4]

0042E177  mov         ecx,dword ptr [eax+edi+8]

0042E17B  mov         edx,dword ptr [ebp+4]

0042E17E  push        ecx 

0042E17F  push        edx 

0042E180  call        _RTC_StackFailure (42B82Ah)

0042E185  add         esp,8

0042E188  mov         eax,dword ptr [i]

0042E18B  add         eax,1

0042E18E  add         edi,0Ch

0042E191  cmp         eax,dword ptr [esi]

0042E193  mov         dword ptr [i],eax

0042E196  jl          _RTC_CheckStackVars+14h (42E154h)

0042E198  pop         edi 

0042E199  pop         esi 

0042E19A  pop         ebx 

0042E19B  mov         esp,ebp

0042E19D  pop         ebp 

0042E19E  ret             

 

         再看最后一小段代码,通过检测esp的值来判断堆栈是否平衡,首先把esp加上初始化时减出的值,然后和ebp对比,正常情况下应该是相等的(看看初始化的代码这很好理解):

0042D6D6  add         esp,0D8h

0042D6DC  cmp         ebp,esp

0042D6DE  call        @ILT+3445(__RTC_CheckEsp) (42BD7Ah)

0042D6E3  mov         esp,ebp

0042D6E5  pop         ebp 

0042D6E6  ret

 

_RTC_CheckEsp极其简单就下面两句:

0042D9E0  jne         esperror (42D9E3h)

0042D9E2  ret

 

构造这样一个函数测试一下:

void Function(const char* pBuf)

{

         char szBuf[10];

         strcpy(szBuf, pBuf);

         __asm push ebx

}

 

 

4、/RTCc

名称:数据转换检查

编译选项位置:C/C++ à Code Generation à Smaller Type Check

说明:在数据赋值时,如果把一个较长的数据类型赋值给一个较小的数据类型,很有可能发生数据截断的问题,这个选项就是用来在发生数据截断时提示程序员的。(注意的是这里是动态检测的,只有确实会丢失数据时才报错)

原理:

void Func2()

{

         int nSrc = 100;

         char chDes = 'a';

         chDes = nSrc;

}

0042D679  mov         dword ptr [nSrc],64h

0042D680  mov         byte ptr [chDes],61h

0042D684  mov         ecx,dword ptr [nSrc]

0042D687  call        @ILT+4935(@_RTC_Check_4_to_1@4) (42C34Ch)

0042D68C  mov         byte ptr [chDes],al

 

         一堆这种函数,哈哈。

0042C338  jmp         _RTC_Check_2_to_1 (42D760h)

0042C33D  jmp         _RTC_Check_8_to_1 (42E520h)

0042C342  jmp         _RTC_Check_8_to_2 (42E560h)

0042C347  jmp         _RTC_Check_8_to_4 (42E790h)

0042C34C  jmp         _RTC_Check_4_to_1 (42DE60h)

0042C351  jmp         _RTC_Check_4_to_2 (42DF50h)

 

         我们还是来看看_RTC_Check_4_to_1:

0042DE60  push        ebp 

0042DE61  mov         ebp,esp

0042DE63  push        ebx 

0042DE64  mov         ebx,ecx

0042DE66  mov         eax,ebx

0042DE68  and         eax,0FFFFFF00h

0042DE6D  je          _RTC_Check_4_to_1+24h (42DE84h)

0042DE6F  cmp         eax,0FFFFFF00h

0042DE74  je          _RTC_Check_4_to_1+24h (42DE84h)

0042DE76  mov         eax,dword ptr [ebp+4]

0042DE79  push        1   

0042DE7B  push        eax 

0042DE7C  call        _RTC_Failure (42C1EEh)

0042DE81  add         esp,8

0042DE84  mov         al,bl

0042DE86  pop         ebx 

0042DE87  pop         ebp 

0042DE88  ret 

         逻辑还是很简单的,先判断int的高三个字节是不是都是0,如果都是0说明没超出范围,直接跳到末尾;再检查高三个字节是不是全是1,如果是说明是个一个负数也没超出范围,直接跳转到末尾,其他情况直接报错。

 

备注:

         如果你确信要这么做,确实要进行数据截断(譬如取数据的高位低位的),请按上面错误MSGBOX里面说明的做,写这个玩意的哥么想得很周到啊o(∩_∩)o 哈哈。

# 从当前用户主目录查找目录的函数 # 参数1: 要查找的目录名 define find_in_home $(shell \ found_dir=$$(find "$$HOME" -type d -name "$(1)" -print -quit 2>/dev/null); \ if [ -n "$$found_dir" ]; then \ echo "$$found_dir"; \ else \ echo "DIRECTORY_NOT_FOUND"; \ fi \ ) endef # 使用示例(查找用户主目录下的 Documents 目录) TARGET_DIR := lite-user-runtime-env ENV_DIR := $(call find_in_home,$(TARGET_DIR)) ifeq ($(ENV_DIR),DIRECTORY_NOT_FOUND) $(error Directory "$(TARGET_DIR)" not found!!) else $(info ENV_DIR = $(ENV_DIR)) endif # Kconfig 配置系统相关 KCONFIG_CONFIG ?= $(CURDIR)/.config KCONFIG_AUTOHEADER ?= $(CURDIR)/autoconf.h KCONFIG_AUTOCONF ?= $(CURDIR)/autoconf.h # 检查 Kconfig 工具是否存在 ifeq ($(shell command -v kconfig-mconf 2>/dev/null),) $(error "kconfig-frontends not found, please install it first (sudo apt install kconfig-frontends)") endif CROSS = $(ENV_DIR)/toolschain/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/arm-none-eabi- CREAT_TOOL = $(ENV_DIR)/bin/create-sp-img CC = gcc INC = -I . -I ./include -I ../posix/include INC += -I $(ENV_DIR)/toolschain/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/lib/gcc/arm-none-eabi/13.2.1/include #cflag = -g ${cflags} -Wall -fPIC -fno-asynchronous-unwind-tables -fno-builtin-function -mcpu=cortex-m3 -mthumb -nostdinc #inc += -I $(SPBASEDIR)/vsoc/$(os_type)/include/ -I . #inc += -I $(SPBASEDIR)/toolschain/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/lib/gcc/arm-none-eabi/13.2.1/include # CFLAG = -g -Wall -fPIC -fno-asynchronous-unwind-tables -mcpu=cortex-a5 -mtune=generic-armv7-a -mthumb -mfloat-abi=soft -Os # CFLAG = -g -Os -Wall -fPIC -fno-asynchronous-unwind-tables -mcpu=cortex-a5 -mtune=generic-armv7-a -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard #-ffreestanding 独立环境 CFLAG += -include $(KCONFIG_AUTOHEADER) CFLAG += -Os -fno-asynchronous-unwind-tables -mcpu=cortex-m3 -mthumb -nostdinc -nostdlib -ffreestanding -ffunction-sections -fdata-sections CFLAG += -fPIE -Wall -fno-builtin-function -Werror=implicit -flto #lflag = -g -pie -T n58.ld.lds -Os --no-warn-rwx-segments --start-group $(ENV_DIR)/toolschain/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/lib/gcc/arm-none-eabi/13.2.1/thumb/v7-m/nofp/libgcc.a ../posix/lib/libposix.a --end-group #lflag = ../src/raw.o ../src/dns_server.o ../src/exit.o ../src/memset.o ../src/network.o ../src/strncasecmp.o ../src/timerfd.o ../src/vfs_device.o ../src/vfs.o lflag += -g -pie -T n58.ld.lds -Os -Wl,--no-warn-rwx-segments -flto -mcpu=cortex-m3 -mthumb -nostartfiles -nostdlib lflag += -Wl,--start-group,../posix/lib/libposix.a,$(ENV_DIR)/toolschain/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/lib/gcc/arm-none-eabi/13.2.1/thumb/v7-m/nofp/libgcc.a,--end-group lflag += -Wl,-Bsymbolic,-gc-sections LD = gcc objs = main.o websocket_client.o websocket_client_posix.o uart_audio.o crc32_new.o hdlc_byte.o var_buffer_fifo.o tiny_json.o gpio.o led.o pwrkey.o adc.o rtc.o target = test image = $(target).spimg # Kconfig 配置目标:打开图形化配置界面 menuconfig: Kconfig kconfig-mconf $< --output $(KCONFIG_CONFIG) # 生成配置头文件(从 .config 生成 config.h) $(KCONFIG_AUTOHEADER): $(KCONFIG_CONFIG) @if [ ! -f "$(KCONFIG_CONFIG)" ]; then \ $(MAKE) menuconfig; \ fi kconfig-conf --silentoldconfig $(CURDIR)/Kconfig $(KCONFIG_CONFIG) @echo "Generated $(KCONFIG_AUTOHEADER)" .c.o: $(CROSS)$(CC) -c $< $(INC) $(CFLAG) all:$(KCONFIG_AUTOHEADER) $(target) $(image) $(target):$(objs) $(CROSS)$(LD) -o $@ $^ $(lflag) $(image):$(target) $(CREAT_TOOL) $(target) host armm3 > /dev/null clean: -rm -fv $(target) -rm -fv *.o -rm -fv *.spimg 以上是我test的makefile,我顶层的makefile是all: make install -C src make -C test clean: make clean -C src make clean -C test -rm posix -rf menuconfig: make -C test menuconfig 我现在需要,没有.h文件时,打开menuconfig进行配置,有时则不打开menuconfig,延用之前的配置,但是现在不能生成.h文件,但是能生成.config文件,怎么办
08-07
(gaussian_splatting) C:\Users\35845\3Dgaussian-splatting\SIBR_viewers>cmake -Bbuild . -- Selecting Windows SDK version 10.0.26100.0 to target Windows 10.0.15063.0. CMake Warning at CMakeLists.txt:21 (message): Untested version of cmake. If you checked everything is working properly, please update 3.27.0 in the main CmakeLists.txt with the version you tested. -- Git found: E:/Git/cmd/git.exe -- SIBR version : BRANCH HEAD COMMIT_HASH 4ae964a267cd7a844d9766563cf9d0b500131a22 TAG VERSION 0.9.6-142-g4ae964a -- Install path for RelWithDebInfo set to C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/install. -- Install path for Release set to C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/install. -- Install path for Debug set to C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/install. Note you can provide default program options for Visual Studio target properties by either setting a value for the cmake cached variable 'SIBR_PROGRAMARGS' or by setting a new environment variable 'SIBR_PROGRAMARGS' -- ****************** Handling core dependencies ****************** -- Checking glew [from C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs]... -- Found a 3rdParty GLEW dir : C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/glew. -- FindGLEW: did not find GLEW CMake config file. Searching for libraries. -- FindGLEW: GLEW_USE_STATIC_LIBS is undefined. Treated as FALSE. -- FindGLEW: GLEW_INCLUDE_DIR: C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/glew/glew-2.0.0/include -- FindGLEW: GLEW_INCLUDE_DIRS: C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/glew/glew-2.0.0/include -- FindGLEW: CMAKE_FIND_LIBRARY_SUFFIXES for SHARED: .dll.lib;.lib;.a -- FindGLEW: CMAKE_FIND_LIBRARY_SUFFIXES for STATIC: .lib -- FindGLEW: GLEW_SHARED_LIBRARY_RELEASE: C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/glew/glew-2.0.0/lib64/glew32.lib -- FindGLEW: GLEW_STATIC_LIBRARY_RELEASE: C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/glew/glew-2.0.0/lib64/glew32s.lib -- FindGLEW: GLEW_SHARED_LIBRARY_DEBUG: C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/glew/glew-2.0.0/lib64/glew32d.lib -- FindGLEW: GLEW_STATIC_LIBRARY_DEBUG: C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/glew/glew-2.0.0/lib64/glew32sd.lib -- FindGLEW: GLEW_SHARED_LIBRARY: optimized;C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/glew/glew-2.0.0/lib64/glew32.lib;debug;C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/glew/glew-2.0.0/lib64/glew32d.lib -- FindGLEW: GLEW_STATIC_LIBRARY: optimized;C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/glew/glew-2.0.0/lib64/glew32s.lib;debug;C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/glew/glew-2.0.0/lib64/glew32sd.lib -- FindGLEW: GLEW_LIBRARIES: optimized;C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/glew/glew-2.0.0/lib64/glew32.lib;debug;C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/glew/glew-2.0.0/lib64/glew32d.lib -- FindGLEW: GLEW_VERSION_MAJOR: 2 -- FindGLEW: GLEW_VERSION_MINOR: 0 -- FindGLEW: GLEW_VERSION_MICRO: 0 -- FindGLEW: GLEW_VERSION: 2.0.0 -- FindGLEW: Creating GLEW::glew imported target. -- FindGLEW: Creating GLEW::GLEW imported target. -- Checking assimp [from C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs]... -- Found a 3rdParty ASSIMP dir : C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/assimp. -- Checking ffmpeg [from C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs]... -- Found a 3rdParty FFMPEG dir : C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/ffmpeg. -- Checking embree3 [from C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs]... -- Found a 3rdParty EMBREE3 dir : C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/embree3. -- Checking eigen3 [from C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs]... -- Found a 3rdParty EIGEN3 dir : C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/eigen3. -- Checking boost [from C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs]... -- Found a 3rdParty BOOST dir : C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/boost. CMake Warning (dev) at cmake/windows/dependencies.cmake:173 (find_package): Policy CMP0144 is not set: find_package uses upper-case <PACKAGENAME>_ROOT variables. Run "cmake --help-policy CMP0144" for policy details. Use the cmake_policy command to set the policy and suppress this warning. CMake variable BOOST_ROOT is set to: C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/boost/boost-1.71 For compatibility, find_package is ignoring the variable, but code in a .cmake module might still use it. Call Stack (most recent call first): cmake/windows/include_once.cmake:20 (include) src/CMakeLists.txt:46 (include_once) This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning (dev) at cmake/windows/dependencies.cmake:173 (find_package): Policy CMP0167 is not set: The FindBoost module is removed. Run "cmake --help-policy CMP0167" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Call Stack (most recent call first): cmake/windows/include_once.cmake:20 (include) src/CMakeLists.txt:46 (include_once) This warning is for project developers. Use -Wno-dev to suppress it. -- Checking nativefiledialog [from C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs]... -- Found a 3rdParty NATIVEFILEDIALOG dir : C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/nativefiledialog. SPECIAL OPENCV HANDLING -- Checking opencv [from C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs]... -- Found a 3rdParty OPENCV dir : C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/opencv. -- OpenCV ARCH: x64 -- OpenCV RUNTIME: vc17 -- OpenCV STATIC: OFF -- Found OpenCV 4.8.0 in C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/opencv/install/x64/vc17/lib -- You might need to add C:\Users\35845\3Dgaussian-splatting\SIBR_viewers\extlibs\opencv\install\x64\vc17\bin to your PATH to be able to run your applications. -- Checking glfw [from C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs]... -- Found a 3rdParty GLFW dir : C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/extlibs/glfw. -- Library imgui already available, skipping. -- Library mrf already available, skipping. -- Library nanoflann already available, skipping. -- Library picojson already available, skipping. -- Library rapidxml already available, skipping. -- Library xatlas already available, skipping. CMake Deprecation Warning at extlibs/xatlas/xatlas/CMakeLists.txt:4 (cmake_minimum_required): Compatibility with CMake < 3.10 will be removed from a future version of CMake. Update the VERSION argument <min> value. Or, use the <min>...<max> syntax to tell CMake that the project requires at least <min> but has been updated to work with policies introduced by <max> or earlier. -- **************************************************************** -- Adding dataset_tools project -- BUILD_IBR_DATASET_TOOLS is OFF -- Adding ulr project -- BUILD_IBR_ULR is OFF -- Adding basic project -- BUILD_IBR_BASIC is ON -- Adding gaussianviewer project -- BUILD_IBR_GAUSSIANVIEWER is ON -- Populating library CudaRasterizer... CMake Error at C:/Program Files/CMake/share/cmake-4.1/Modules/CMakeDetermineCompilerId.cmake:928 (message): Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" failed. Compiler: Build flags: Id flags: --keep;--keep-dir;tmp -v The output was: 1 閫傜敤浜?.NET Framework MSBuild 鐗堟湰 17.14.23+b0019275e 鐢熸垚鍚姩鏃堕棿涓?2025/9/15 17:11:18銆? 鑺傜偣 1 涓婄殑椤圭洰鈥淐:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CompilerIdCUDA.vcxproj鈥?榛樿鐩爣)銆? PrepareForBuild: 姝e湪鍒涘缓鐩綍鈥淒ebug\鈥濄€? 宸插惎鐢ㄧ粨鏋勫寲杈撳嚭銆傜紪璇戝櫒璇婃柇鐨勬牸寮忚缃皢鍙嶆槧閿欒灞傛缁撴瀯銆傛湁鍏宠缁嗕俊鎭紝璇峰弬闃?https://aka.ms/cpp/structured-output銆? 姝e湪鍒涘缓鐩綍鈥淒ebug\CompilerIdCUDA.tlog\鈥濄€? InitializeBuildStatus: 姝e湪鍒涘缓鈥淒ebug\CompilerIdCUDA.tlog\unsuccessfulbuild鈥濓紝鍥犱负宸叉寚瀹氣€淎lwaysCreate鈥濄€? 姝e湪瀵光€淒ebug\CompilerIdCUDA.tlog\unsuccessfulbuild鈥濇墽琛?Touch 浠诲姟銆? AddCudaCompileDeps: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\HostX64\x64\cl.exe /E /nologo /showIncludes /TP /D__CUDACC__ /D__CUDACC_VER_MAJOR__=11 /D__CUDACC_VER_MINOR__=8 /D_MBCS /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" /I. /FIcuda_runtime.h /c C:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CMakeCUDACompilerId.cu 椤圭洰鈥淐:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CompilerIdCUDA.vcxproj鈥?1)姝e湪鑺傜偣 1 涓婄敓鎴愨€淐:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CompilerIdCUDA.vcxproj鈥?1:2) (CudaBuildCore 涓洰鏍?銆? CudaBuildCore: Compiling CUDA source file CMakeCUDACompilerId.cu... 姝e湪鍒涘缓鐩綍鈥淐:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CompilerIdCUDA\x64\Debug鈥濄€? cmd.exe /C "C:\Users\35845\AppData\Local\Temp\tmp84a56914311d4a54a27fb861465acf76.cmd" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" -G --keep-dir CompilerIdCUDA\x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -v -allow-unsupported-compiler -g -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc143.pdb /FS /Zi /RTC1 /MDd " -o C:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CompilerIdCUDA\x64\Debug\CMakeCUDACompilerId.cu.obj "C:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CMakeCUDACompilerId.cu" (gaussian_splatting) C:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" -G --keep-dir CompilerIdCUDA\x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -v -allow-unsupported-compiler -g -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc143.pdb /FS /Zi /RTC1 /MDd " -o C:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CompilerIdCUDA\x64\Debug\CMakeCUDACompilerId.cu.obj "C:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CMakeCUDACompilerId.cu" #$ _NVVM_BRANCH_=nvvm #$ _SPACE_= #$ _CUDART_=cudart #$ _HERE_=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin #$ _THERE_=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin #$ _TARGET_SIZE_= #$ _TARGET_DIR_= #$ _TARGET_SIZE_=64 #$ _WIN_PLATFORM_=x64 #$ TOP=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin/.. #$ NVVMIR_LIBRARY_DIR=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin/../nvvm/libdevice #$ PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin/../nvvm/bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin/../lib;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\HostX64\x64;C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64;;C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86;;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\tools;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\ide;C:\Program Files (x86)\HTML Help Workshop;;C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64;C:\windows\Microsoft.NET\Framework64\v4.0.30319\;C:\windows\Microsoft.NET\Framework\v4.0.30319\;C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin;C:\windows\Microsoft.NET\Framework\v4.0.30319\;;E:\anaconda\envs\gaussian_splatting;E:\anaconda\envs\gaussian_splatting\Library\mingw-w64\bin;E:\anaconda\envs\gaussian_splatting\Library\usr\bin;E:\anaconda\envs\gaussian_splatting\Library\bin;E:\anaconda\envs\gaussian_splatting\Scripts;E:\anaconda\envs\gaussian_splatting\bin;E:\anaconda\condabin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\libnvvp;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0;C:\windows\System32\OpenSSH;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA App\NvDLISR;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Program Files\HP\OMEN-Broadcast\Common;E:\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files\NVIDIA Corporation\Nsight Compute 2022.3.0;C:\ProgramData\anaconda3;C:\ProgramData\anaconda3\Scripts;C:\ProgramData\anaconda3\Library\bin;C:\Program Files\CMake\bin;C:\Users\35845\AppData\Local\Microsoft\WindowsApps;.; #$ INCLUDES="-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin/../include" #$ LIBRARIES= "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin/../lib/x64" #$ CUDAFE_FLAGS=--sdk_dir "C:\Program Files (x86)\Windows Kits\10" #$ PTXAS_FLAGS= CMakeCUDACompilerId.cu #$ cl.exe -D__NV_NO_HOST_COMPILER_CHECK=1 @"C:\Users\35845\AppData\Local\Temp/tmpxft_00003a2c_00000000-9.res" > "C:/Users/35845/AppData/Local/Temp/tmpxft_00003a2c_00000000-8_CMakeCUDACompilerId.cpp1.ii" CMakeCUDACompilerId.cu #$ erase C:\Users\35845\AppData\Local\Temp/tmpxft_00003a2c_00000000-9.res #$ cicc --microsoft_version=1944 --msvc_target_version=1944 --compiler_bindir "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/HostX64/x64/../../../../../../.." --display_error_number --orig_src_file_name "C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/build/CMakeFiles/4.1.1/CompilerIdCUDA/CMakeCUDACompilerId.cu" --orig_src_path_name "C:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CMakeCUDACompilerId.cu" --allow_managed --debug_mode --sdk_dir "C:\Program Files (x86)\Windows Kits\10" -arch compute_52 -m64 --no-version-ident -ftz=0 -prec_div=1 -prec_sqrt=1 -fmad=1 --include_file_name "tmpxft_00003a2c_00000000-4_CMakeCUDACompilerId.fatbin.c" -g -O0 -tused --gen_module_id_file --module_id_file_name "C:/Users/35845/AppData/Local/Temp/tmpxft_00003a2c_00000000-5_CMakeCUDACompilerId.module_id" --gen_c_file_name "C:/Users/35845/AppData/Local/Temp/tmpxft_00003a2c_00000000-7_CMakeCUDACompilerId.cudafe1.c" --stub_file_name "C:/Users/35845/AppData/Local/Temp/tmpxft_00003a2c_00000000-7_CMakeCUDACompilerId.cudafe1.stub.c" --gen_device_file_name "C:/Users/35845/AppData/Local/Temp/tmpxft_00003a2c_00000000-7_CMakeCUDACompilerId.cudafe1.gpu" "C:/Users/35845/AppData/Local/Temp/tmpxft_00003a2c_00000000-8_CMakeCUDACompilerId.cpp1.ii" -o "C:/Users/35845/AppData/Local/Temp/tmpxft_00003a2c_00000000-7_CMakeCUDACompilerId.ptx" C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\yvals_core.h(902): error : static assertion failed with "error STL1002: Unexpected compiler version, expected CUDA 12.4 or newer." [C:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CompilerIdCUDA.vcxproj] 1 error detected in the compilation of "C:/Users/35845/3Dgaussian-splatting/SIBR_viewers/build/CMakeFiles/4.1.1/CompilerIdCUDA/CMakeCUDACompilerId.cu". # --error 0x1 -- C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 11.8.targets(785,9): error MSB3721: 鍛戒护鈥?C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" -G --keep-dir CompilerIdCUDA\x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -v -allow-unsupported-compiler -g -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc143.pdb /FS /Zi /RTC1 /MDd " -o C:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CompilerIdCUDA\x64\Debug\CMakeCUDACompilerId.cu.obj "C:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CMakeCUDACompilerId.cu"鈥濆凡閫€鍑猴紝杩斿洖浠g爜涓?1銆?[C:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CompilerIdCUDA.vcxproj] 宸插畬鎴愮敓鎴愰」鐩€淐:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CompilerIdCUDA.vcxproj鈥?CudaBuildCore 涓洰鏍?鐨勬搷浣?- 澶辫触銆? 宸插畬鎴愮敓鎴愰」鐩€淐:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CompilerIdCUDA.vcxproj鈥?榛樿鐩爣)鐨勬搷浣?- 澶辫触銆? 鐢熸垚澶辫触銆? 鈥淐:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CompilerIdCUDA.vcxproj鈥?榛樿鐩爣) (1) -> 鈥淐:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CompilerIdCUDA.vcxproj鈥?CudaBuildCore 鐩爣) (1:2) -> (CudaBuildCore 鐩爣) -> C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\yvals_core.h(902): error : static assertion failed with "error STL1002: Unexpected compiler version, expected CUDA 12.4 or newer." [C:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CompilerIdCUDA.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 11.8.targets(785,9): error MSB3721: 鍛戒护鈥?C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" -G --keep-dir CompilerIdCUDA\x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -v -allow-unsupported-compiler -g -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc143.pdb /FS /Zi /RTC1 /MDd " -o C:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CompilerIdCUDA\x64\Debug\CMakeCUDACompilerId.cu.obj "C:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CMakeCUDACompilerId.cu"鈥濆凡閫€鍑猴紝杩斿洖浠g爜涓?1銆?[C:\Users\35845\3Dgaussian-splatting\SIBR_viewers\build\CMakeFiles\4.1.1\CompilerIdCUDA\CompilerIdCUDA.vcxproj] 0 涓鍛? 2 涓敊璇? 宸茬敤鏃堕棿 00:00:01.51 Call Stack (most recent call first): C:/Program Files/CMake/share/cmake-4.1/Modules/CMakeDetermineCompilerId.cmake:8 (CMAKE_DETERMINE_COMPILER_ID_BUILD) C:/Program Files/CMake/share/cmake-4.1/Modules/CMakeDetermineCompilerId.cmake:53 (__determine_compiler_id_test) C:/Program Files/CMake/share/cmake-4.1/Modules/CMakeDetermineCUDACompiler.cmake:162 (CMAKE_DETERMINE_COMPILER_ID) extlibs/CudaRasterizer/CudaRasterizer/CMakeLists.txt:14 (project) -- Configuring incomplete, errors occurred!
最新发布
09-16
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值