facebookresearch / robust_cvd

Robust Consistent Video Depth Estimation
https://robust-cvd.github.io/
Other
300 stars 24 forks source link

Local installation Windows 10 #15

Open semel1 opened 3 years ago

semel1 commented 3 years ago

Trying to install cvd2 locally under Windows 10. All required dependencies (including Detectron2) installed sussesfully (IMHO, please don't ask me how I managed to install all of them - it was couple days of real nightmare. I wouldn't be able memorize all steps unless start again ).

For pthread I installed pthread using vcpkg ([https://github.com/microsoft/vcpkg]) However that package doesn't consists "pthread.lib" but "pthreadVC3.lib,pthreadVCE3.lib,pthreadVSE3.lib" instead

After running cmake: `Microsoft Windows [Version 10.0.19042.928] (c) Microsoft Corporation. All rights reserved.

F:\robust_cvd-main\cvd2\lib\build>cmake .. -- Building for: Visual Studio 16 2019 -- Robust Consistent Video Depth Estimation -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042. -- The C compiler identification is MSVC 19.29.30038.1 -- The CXX compiler identification is MSVC 19.29.30038.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found glog: -- (Headers) C:/Program Files (x86)/glog/include/glog -- (Library) C:/Program Files (x86)/glog/lib/glogd.lib -- Found PythonInterp: C:/Program Files/Python37/python.exe (found suitable version "3.7.4", minimum required is "3.6") -- Found PythonLibs: C:/Program Files/Python37/libs/python37.lib -- Performing Test HAS_MSVC_GL_LTCG -- Performing Test HAS_MSVC_GL_LTCG - Success -- Found pybind11: C:/Program Files/Python37/include (found version "2.6.2" ) -- OpenCV ARCH: x64 -- OpenCV RUNTIME: vc14 -- OpenCV STATIC: OFF -- Found OpenCV: C:/Users/Operator/Anaconda3/Library (found version "4.1.0") -- Found OpenCV 4.1.0 in C:/Users/Operator/Anaconda3/Library/cmake/x64/vc14/lib -- You might need to add C:\Users\Operator\Anaconda3\Library\cmake\x64\vc14\bin to your PATH to be able to run your applications. -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - not found -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - yes -- Found Threads: TRUE -- Found required Ceres dependency: Eigen version 3.3.9 in F://include/eigen3 -- Found required Ceres dependency: glog -- Found required Ceres dependency: gflags -- Found Ceres version: 2.0.0 installed in: C:/Program Files (x86)/Ceres with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SchurSpecializations, Multithreading] -- Found Boost: C:/repos/boost_1_76_0 (found version "1.76.0") found components: system filesystem program_options -- Pybind11 version: 2.6.2 -- Python version: 3.7 -- Configuring done -- Generating done -- Build files have been written to: F:/robust_cvd-main/cvd2/lib/build

F:\robust_cvd-main\cvd2\lib\build>`

As result "CMakeError.log"

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output: Change Dir: F:/robust_cvd-main/cvd2/lib/build/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_86565.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.10.2+857e5a733 for .NET Framework

Copyright (C) Microsoft Corporation. All rights reserved.

Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30038.1 for x64

Copyright (C) Microsoft Corporation. All rights reserved.

src.c

cl /c /I"F:\robust_cvd-main\vcpkg-master\scripts\buildsystems\msbuild......\installed\x64-windows\include" /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D CMAKE_HAVE_LIBC_PTHREAD /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_86565.dir\Debug\" /Fd"cmTC_86565.dir\Debug\vc142.pdb" /external:env:EXTERNAL_INCLUDE /external:W3 /Gd /TC /errorReport:queue "F:\robust_cvd-main\cvd2\lib\build\CMakeFiles\CMakeTmp\src.c"

F:\robust_cvd-main\cvd2\lib\build\CMakeFiles\CMakeTmp\src.c(15,17): warning C4013: 'pthread_atfork' undefined; assuming extern returning int [F:\robust_cvd-main\cvd2\lib\build\CMakeFiles\CMakeTmp\cmTC_86565.vcxproj]

src.obj : error LNK2019: unresolved external symbol pthread_atfork referenced in function main [F:\robust_cvd-main\cvd2\lib\build\CMakeFiles\CMakeTmp\cmTC_86565.vcxproj]

F:\robust_cvd-main\cvd2\lib\build\CMakeFiles\CMakeTmp\Debug\cmTC_86565.exe : fatal error LNK1120: 1 unresolved externals [F:\robust_cvd-main\cvd2\lib\build\CMakeFiles\CMakeTmp\cmTC_86565.vcxproj]

Source file was:

include

static void test_func(void data) { return data; }

int main(void) { pthread_t thread; pthread_create(&thread, NULL, test_func, NULL); pthread_detach(thread); pthread_cancel(thread); pthread_join(thread, NULL); pthread_atfork(NULL, NULL, NULL); pthread_exit(NULL);

return 0; }

Determining if the function pthread_create exists in the pthreads failed with the following output: Change Dir: F:/robust_cvd-main/cvd2/lib/build/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_126dd.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.10.2+857e5a733 for .NET Framework

Copyright (C) Microsoft Corporation. All rights reserved.

Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30038.1 for x64

Copyright (C) Microsoft Corporation. All rights reserved.

CheckFunctionExists.c

cl /c /I"F:\robust_cvd-main\vcpkg-master\scripts\buildsystems\msbuild......\installed\x64-windows\include" /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D CHECK_FUNCTION_EXISTS=pthread_create /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_126dd.dir\Debug\" /Fd"cmTC_126dd.dir\Debug\vc142.pdb" /external:env:EXTERNAL_INCLUDE /external:W3 /Gd /TC /errorReport:queue "C:\Program Files (x86)\CMake\share\cmake-3.21\Modules\CheckFunctionExists.c"

LINK : fatal error LNK1104: cannot open file 'pthreads.lib' [F:\robust_cvd-main\cvd2\lib\build\CMakeFiles\CMakeTmp\cmTC_126dd.vcxproj]

Determining if the function pthread_create exists in the pthread failed with the following output: Change Dir: F:/robust_cvd-main/cvd2/lib/build/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_65f35.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.10.2+857e5a733 for .NET Framework

Copyright (C) Microsoft Corporation. All rights reserved.

Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30038.1 for x64

Copyright (C) Microsoft Corporation. All rights reserved.

CheckFunctionExists.c

cl /c /I"F:\robust_cvd-main\vcpkg-master\scripts\buildsystems\msbuild......\installed\x64-windows\include" /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D CHECK_FUNCTION_EXISTS=pthread_create /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_65f35.dir\Debug\" /Fd"cmTC_65f35.dir\Debug\vc142.pdb" /external:env:EXTERNAL_INCLUDE /external:W3 /Gd /TC /errorReport:queue "C:\Program Files (x86)\CMake\share\cmake-3.21\Modules\CheckFunctionExists.c"

LINK : fatal error LNK1104: cannot open file 'pthread.lib' [F:\robust_cvd-main\cvd2\lib\build\CMakeFiles\CMakeTmp\cmTC_65f35.vcxproj]

There are a some suggestions around to replace pthread.lib by pthreadVC3.lib in the sources. However I couldn't found reference to pthread.lib in cvd2 codebase and not sure if such approach will resolve this issue

Any suggestions would be greatly appreciated!

semel1 commented 3 years ago

Finally managed successfully complete cmake using MinGW Windows10:

F:\robust_cvd-main\cvd2\lib\build>cmake .. -G "MinGW Makefiles" -D OpenCV_DIR="C:\opencvMinGW\install" -- Robust Consistent Video Depth Estimation -- The C compiler identification is GNU 8.1.0 -- The CXX compiler identification is GNU 8.1.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/g++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found glog: -- (Headers) C:/Users/Operator/Anaconda3/Library/include -- (Library) C:/Users/Operator/Anaconda3/Library/lib/glog.lib -- Found PythonInterp: C:/Program Files/Python37/python.exe (found suitable version "3.7.4", minimum required is "3.6") -- Found PythonLibs: C:/Program Files/Python37/libs/python37.lib -- Performing Test HAS_FLTO -- Performing Test HAS_FLTO - Success -- Found pybind11: C:/Program Files/Python37/include (found version "2.6.2" ) -- OpenCV ARCH: x64 -- OpenCV RUNTIME: mingw -- OpenCV STATIC: OFF -- Found OpenCV: C:/opencvMinGW/install (found version "4.5.3") -- Found OpenCV 4.5.3 in C:/opencvMinGW/install/x64/mingw/lib -- You might need to add C:/opencvMinGW/install/x64/mingw/bin to your PATH to be able to run your applications. -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Found required Ceres dependency: Eigen version 3.3.9 in C:/Users/Operator/Anaconda3/Library/include/eigen3 -- Found required Ceres dependency: glog -- Found required Ceres dependency: gflags -- Found Ceres version: 2.0.0 installed in: C:/Users/Operator/Anaconda3/Library with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, CXSparse, SchurSpecializations, Multithreading] -- Found Boost: C:/boostMinGW/lib/cmake/Boost-1.76.0/BoostConfig.cmake (found version "1.76.0") found components: system filesystem program_options -- Pybind11 version: 2.6.2 -- Python version: 3.7 -- Configuring done -- Generating done -- Build files have been written to: F:/robust_cvd-main/cvd2/lib/build

However after "make" and successful "Built target lib_cvd" - "Linking CXX shared module lib_python.cp37-win_amd64.pyd"- throws an errors: [100%] Linking CXX shared module lib_python.cp37-win_amd64.pyd ............................................................. .............................................................

C:\PROGRA~1\MINGW-~1\X86_64~1.0-P\mingw64\bin\ar.exe: CMakeFiles/lib_python.dir/core/ParamsBase.obj: plugin needed to handle lto object C:\PROGRA~1\MINGW-~1\X86_64~1.0-P\mingw64\bin\ar.exe: CMakeFiles/lib_python.dir/core/Projection.obj: plugin needed to handle lto object C:\PROGRA~1\MINGW-~1\X86_64~1.0-P\mingw64\bin\ar.exe: CMakeFiles/lib_python.dir/core/cnpy.obj: plugin needed to handle lto object

Errors start:

C:\Users\Operator\AppData\Local\Temp\ccyUl55b.ltrans0.ltrans.o::(.text+0xbc645): undefined reference to __imp__ZN3fmt2v87vformatB5cxx11ENS0_17basic_string_viewIcEENS0_17basic_format_argsINS0_20basic_format_contextINS0_8appenderEcEEEE' C:\Users\Operator\AppData\Local\Temp\ccyUl55b.ltrans0.ltrans.o:<artificial>:(.text+0xc1877): undefined reference toimpZN3fmt2v87vformatB5cxx11ENS0_17basic_string_viewIcEENS0_17basic_format_argsINS0_20basic_format_contextINS0_8appenderEcEEEE' C:\Users\Operator\AppData\Local\Temp\ccyUl55b.ltrans0.ltrans.o::(.text+0xc1924): undefined reference to __imp__ZN3fmt2v87vformatB5cxx11ENS0_17basic_string_viewIcEENS0_17basic_format_argsINS0_20basic_format_contextINS0_8appenderEcEEEE' C:\Users\Operator\AppData\Local\Temp\ccyUl55b.ltrans0.ltrans.o:<artificial>:(.text+0xc1fe5): undefined reference toimpZN3fmt2v87vformatB5cxx11ENS0_17basic_string_viewIcEENS0_17basic_format_argsINS0_20basic_format_contextINS0_8appenderEcEEEE' C:\Users\Operator\AppData\Local\Temp\ccyUl55b.ltrans0.ltrans.o::(.text+0xc2133): undefined reference to __imp__ZN3fmt2v87vformatB5cxx11ENS0_17basic_string_viewIcEENS0_17basic_format_argsINS0_20basic_format_contextINS0_8appenderEcEEEE' C:\Users\Operator\AppData\Local\Temp\ccyUl55b.ltrans0.ltrans.o:<artificial>:(.text+0xc22f4): more undefined references toimpZN3fmt2v87vformatB5cxx11ENS0_17basic_string_viewIcEENS0_17basic_format_argsINS0_20basic_format_contextINS0_8appenderEcEEEE' follow C:\Users\Operator\AppData\Local\Temp\ccyUl55b.ltrans0.ltrans.o::(.text+0xd23fb): undefined reference to __imp__ZN6google10LogMessageC1EPKci' C:\Users\Operator\AppData\Local\Temp\ccyUl55b.ltrans0.ltrans.o:<artificial>:(.text+0xd240b): undefined reference toimpZN6google10LogMessage6streamEv' C:\Users\Operator\AppData\Local\Temp\ccyUl55b.ltrans0.ltrans.o::(.text+0xd249a): undefined reference to __imp__ZN6google10LogMessageD1Ev' C:\Users\Operator\AppData\Local\Temp\ccyUl55b.ltrans0.ltrans.o:<artificial>:(.text+0xd24fc): undefined reference toimpZN6google10LogMessageD1Ev' C:\Users\Operator\AppData\Local\Temp\ccyUl55b.ltrans0.ltrans.o::(.text+0xd261d): undefined reference to __imp__ZN6google10LogMessageC1EPKci' C:\Users\Operator\AppData\Local\Temp\ccyUl55b.ltrans0.ltrans.o:<artificial>:(.text+0xd262d): undefined reference toimpZN6google10LogMessage6streamEv'

and so on .................................................................... ..................................................................................... ..................................................................................... Any suggestions would be greatly appreciated!

ionvision commented 3 years ago

Thanks for trying this! We know the installation for C++ deps might be painful on Windows, and just wonder would it be possible to utilize the Linux subsystem under Windows?

Specifically for the error logs, you can try using some online tools for a better debugging experience, e.g. demangler. You can simply paste __imp__ZN3fmt2v87vformatB5cxx11ENS0_17basic_string_viewIcEENS0_17basic_format_argsINS0_20basic_format_contextINS0_8appenderEcEEEE in and then demangle it.