NVlabs / instant-ngp

Instant neural graphics primitives: lightning fast NeRF and more
https://nvlabs.github.io/instant-ngp
Other
15.57k stars 1.89k forks source link

error C2039: 'tolower': is not a member of 'std' #1520

Open xinxcode opened 4 months ago

xinxcode commented 4 months ago

Hello, Im having trouble from building pytorch from source. Gpu: GT 730M Gpu cc: 3.5 Cuda: v11.0 Cudnn: v8.5.0.96 Python: 3.8 Git: 2.43.0

Im following tutorial from DataGraphi website, I found that their system is same as me, so I followed the instruction exactly like the autors do, it run smooth until come to "Building CXX FAILED: third_party/onnx/CMakeFiles/onnx.dir/onnx/defs/parser.cc.obj" it says "error C2039: 'tolower': is not a member of 'std'" and then the build was stopped.

-- Building version 2.3.0a0+gita17979f cmake --build . --target install --config Release -- -j 1 [1/2557] Building CXX object third_party\onnx\CMakeFiles\onnx.dir\onnx\defs\parser.cc.obj FAILED: third_party/onnx/CMakeFiles/onnx.dir/onnx/defs/parser.cc.obj C:\PROGRA~2\MICROS~2\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\Hostx64\x64\cl.exe /nologo /TP -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DSTDC_FORMAT_MACROS -IC:\Users\user\Documents\StableDiffusion\PyTorch\pytorch\cmake..\third_party\benchmark\include -IC:\Users\user\Documents\StableDiffusion\PyTorch\pytorch\third_party\onnx -IC:\Users\user\Documents\StableDiffusion\PyTorch\pytorch\build\third_party\onnx -IC:\Users\user\Documents\StableDiffusion\PyTorch\pytorch\cmake..\third_party\googletest\googlemock\include -IC:\Users\user\Documents\StableDiffusion\PyTorch\pytorch\cmake..\third_party\googletest\googletest\include -IC:\Users\user\Documents\StableDiffusion\PyTorch\pytorch\third_party\protobuf\src -IC:\Users\user\Documents\StableDiffusion\PyTorch\mkl\include -IC:\Users\user\Documents\StableDiffusion\PyTorch\pytorch\third_party\XNNPACK\include -IC:\Users\user\Documents\StableDiffusion\PyTorch\pytorch\third_party\ittapi\include -IC:\Users\user\Documents\StableDiffusion\PyTorch\pytorch\cmake..\third_party\eigen -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" /DWIN32 /D_WINDOWS /GR /EHsc /Zc:cplusplus /bigobj /FS /utf-8 -DUSE_PTHREADPOOL /EHsc /wd26812 /O2 /Ob2 /DNDEBUG /bigobj -std:c++17 -MD -DMKL_HAS_SBGEMM /MP /wd4244 /wd4267 /wd4996 /MD /showIncludes /Fothird_party\onnx\CMakeFiles\onnx.dir\onnx\defs\parser.cc.obj /Fdthird_party\onnx\CMakeFiles\onnx.dir\onnx.pdb /FS -c C:\Users\user\Documents\StableDiffusion\PyTorch\pytorch\third_party\onnx\onnx\defs\parser.cc C:\Users\user\Documents\StableDiffusion\PyTorch\pytorch\third_party\onnx\onnx\defs\parser.cc(142): error C2039: 'tolower': is not a member of 'std' C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include\string_view(20): note: see declaration of 'std' ninja: build stopped: subcommand failed.

I dont know what I must to do from here.

xinxcode commented 4 months ago

Ok, I've got the solution from GPT that I need to include manually inside the parser.cc:

#include <cctype>

But now I encounter this error:

C:\Users\user\Documents\StableDiffusion\PyTorch\pytorch>python setup.py install --cmake Building wheel torch-2.3.0a0+gita17979f -- Building version 2.3.0a0+gita17979f cmake -GNinja -DBUILD_PYTHON=True -DBUILD_TEST=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR=Ninja -DCMAKE_INCLUDE_PATH=C:\Users\user\Documents\StableDiffusion\PyTorch\mkl\include -DCMAKE_INSTALL_PREFIX=C:\Users\user\Documents\StableDiffusion\PyTorch\pytorch\torch -DCMAKE_PREFIX_PATH=C:\Users\user\AppData\Local\Programs\Python\Python38\Lib\site-packages -DNUMPY_INCLUDE_DIR=C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\numpy\core\include -DPYTHON_EXECUTABLE=C:\Users\user\AppData\Local\Programs\Python\Python38\python.exe -DPYTHON_INCLUDE_DIR=C:\Users\user\AppData\Local\Programs\Python\Python38\Include -DPYTHON_LIBRARY=C:\Users\user\AppData\Local\Programs\Python\Python38/libs/python38.lib -DTORCH_BUILD_VERSION=2.3.0a0+gita17979f -DUSE_NUMPY=True C:\Users\user\Documents\StableDiffusion\PyTorch\pytorch -- The CXX compiler identification is MSVC 19.16.27051.0 -- The C compiler identification is MSVC 19.16.27051.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - failed -- Check for working CXX compiler: C:/Users/user/AppData/Local/Programs/Python/Python38/Scripts/sccache.exe -- Check for working CXX compiler: C:/Users/user/AppData/Local/Programs/Python/Python38/Scripts/sccache.exe - broken CMake Error at C:/Program Files/CMake/share/cmake-3.29/Modules/CMakeTestCXXCompiler.cmake:60 (message): The C++ compiler

"C:/Users/user/AppData/Local/Programs/Python/Python38/Scripts/sccache.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: 'C:/Users/user/Documents/StableDiffusion/PyTorch/pytorch/build/CMakeFiles/CMakeScratch/TryCompile-468alj'

Run Build Command(s): C:/Users/user/AppData/Local/Programs/Python/Python38/Scripts/ninja.exe -v cmTC_310c8
[1/2] C:\Users\user\AppData\Local\Programs\Python\Python38\Scripts\sccache.exe  cl  /nologo /TP   /DWIN32 /D_WINDOWS /GR /EHsc  /Zi /Ob0 /Od /RTC1 -MDd /showIncludes /FoCMakeFiles\cmTC_310c8.dir\testCXXCompiler.cxx.obj /FdCMakeFiles\cmTC_310c8.dir\ /FS -c C:\Users\user\Documents\StableDiffusion\PyTorch\pytorch\build\CMakeFiles\CMakeScratch\TryCompile-468alj\testCXXCompiler.cxx
[2/2] C:\Windows\system32\cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_310c8.dir --rc=C:\PROGRA~2\WINDOW~4\10\bin\100162~1.0\x86\rc.exe --mt=C:\PROGRA~2\WINDOW~4\10\bin\100162~1.0\x86\mt.exe --manifests  -- C:\PROGRA~2\MICROS~2\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\Hostx86\x86\link.exe /nologo CMakeFiles\cmTC_310c8.dir\testCXXCompiler.cxx.obj  /out:cmTC_310c8.exe /implib:cmTC_310c8.lib /pdb:cmTC_310c8.pdb /version:0.0 /machine:X86  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
FAILED: cmTC_310c8.exe
C:\Windows\system32\cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_310c8.dir --rc=C:\PROGRA~2\WINDOW~4\10\bin\100162~1.0\x86\rc.exe --mt=C:\PROGRA~2\WINDOW~4\10\bin\100162~1.0\x86\mt.exe --manifests  -- C:\PROGRA~2\MICROS~2\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\Hostx86\x86\link.exe /nologo CMakeFiles\cmTC_310c8.dir\testCXXCompiler.cxx.obj  /out:cmTC_310c8.exe /implib:cmTC_310c8.lib /pdb:cmTC_310c8.pdb /version:0.0 /machine:X86  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK Pass 1: command "C:\PROGRA~2\MICROS~2\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\Hostx86\x86\link.exe /nologo CMakeFiles\cmTC_310c8.dir\testCXXCompiler.cxx.obj /out:cmTC_310c8.exe /implib:cmTC_310c8.lib /pdb:cmTC_310c8.pdb /version:0.0 /machine:X86 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_310c8.dir/intermediate.manifest CMakeFiles\cmTC_310c8.dir/manifest.res" failed (exit code 1104) with the following output:
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
ninja: build stopped: subcommand failed.