taichi-dev / taichi

Productive, portable, and performant GPU programming in Python.
https://taichi-lang.org
Apache License 2.0
25.56k stars 2.29k forks source link

Windows developer Installation failed:LLVMSupport.lib(UnicodeCaseFold.cpp.obj) : error LNK2038: Mismatch of "_ITERATOR_DEBUG_LEVEL" is detected #8600

Closed xuanranxiaoshi closed 2 weeks ago

xuanranxiaoshi commented 2 weeks ago

Describe the bug I plan to install Taichi's development debugging environment on windows, and I encounter an error when compiling and building: LLVMSupport.lib(UnicodeCaseFold.cpp.obj) : error LNK2038: Mismatch of "_ITERATOR_DEBUG_LEVEL" is detected: The value "0" does not match the value "2" (exception.obj) [E:\Code\Cplusplus\taichi\_skbuild\win-amd64-3.9\cmake-build\taichi_python.vcxproj]...

To Reproduce I executed the following build instructions:

git clone --recursive https://github.com/taichi-dev/taichi

cd taichi

env:TAICHI_CMAKE_ARGS += " -DTI_WITH_VULKAN:BOOL=ON -DTI_WITH_CUDA:BOOL=ON"

$env:DEBUG = 1

$env:TAICHI_USE_MSBUILD = 1

./build.py --shell

python setup.py develop

Log/Screenshots image

Additional comments I guess because I specified the environment variable $env:DEBUG = 1? And the python script automatically installs LLVM 15.0 as a Release? Is this the problem? If not, what is the specific cause, and if so, how to solve it?

xuanranxiaoshi commented 2 weeks ago

Finally, I tried to fix the problem by recompiling LLVM in Debug mode and resetting the environment variable LLVM_DIR. The compile command is as follows:

cmake ..\llvm\ -G "Visual Studio 17 2022" -A x64 -DLLVM_ENABLE_RTTI:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" -DLLVM_ENABLE_ASSERTIONS=ON -Thost=x64 -DLLVM_BUILD_TESTS:BOOL=OFF -DCMAKE_INSTALL_PREFIX=installed -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL -DCMAKE_CXX_STANDARD=17