mapillary / OpenSfM

Open source Structure-from-Motion pipeline
https://www.opensfm.org/
BSD 2-Clause "Simplified" License
3.36k stars 854 forks source link

Build Error in Conda env on Windows #963

Open kenanoestreich opened 1 year ago

kenanoestreich commented 1 year ago

Hello, I am pretty new to all this, so bear with me. I'm trying to build this package and every step before I run "python setup.py build" works fine with no errors. However, the build command results in these errors near the end of the output. Other info that may or may not be relevant is that I am doing this in a conda environment on Windows. I manually ran pip install cmake in addition to the usual setup steps given in the docs because I didn't have it installed. Any help would be greatly appreciated.

Here is the end of the output from "python setup.py build"

C:/Users/ToppLab/Photogrammetry/OpenSfM/vcpkg/installed/x64-windows/include\glog/log_severity.h(57,1): fatal error C11 89: #error: ERROR macro is defined. Define GLOG_NO_ABBREVIATED_SEVERITIES before including logging.h. See the document for detail. [C:\Users\ToppLab\Photogrammetry\OpenSfM\cmake_build\geometry\pygeometry.vcxproj] Building Custom Rule C:/Users/ToppLab/Photogrammetry/OpenSfM/opensfm/src/map/CMakeLists.txt landmark.cc map.cc rig.cc shot.cc dataviews.cc observation.cc tracks_manager.cc The contents of are available only with C++17 or later. C:\Users\ToppLab\Photogrammetry\OpenSfM\opensfm\src\map\src\tracks_manager.cc(206,69): warning C4267: 'return': convers ion from 'size_t' to 'int', possible loss of data [C:\Users\ToppLab\Photogrammetry\OpenSfM\cmake_build\map\map.vcxproj] C:\Users\ToppLab\Photogrammetry\OpenSfM\opensfm\src\map\src\tracks_manager.cc(208,70): warning C4267: 'return': convers ion from 'size_t' to 'int', possible loss of data [C:\Users\ToppLab\Photogrammetry\OpenSfM\cmake_build\map\map.vcxproj] C:\Users\ToppLab\Photogrammetry\OpenSfM\opensfm\src\map\src\tracks_manager.cc(376,34): warning C4267: 'argument': conve rsion from 'size_t' to '_Ty', possible loss of data [C:\Users\ToppLab\Photogrammetry\OpenSfM\cmake_build\map\map.vcxpro j] with [ _Ty=int ] Generating Code... map.vcxproj -> C:\Users\ToppLab\Photogrammetry\OpenSfM\cmake_build\map\Release\map.lib Building Custom Rule C:/Users/ToppLab/Photogrammetry/OpenSfM/opensfm/src/map/CMakeLists.txt pybind.cc C:\Users\ToppLab\Photogrammetry\OpenSfM\opensfm\src\map\python\pybind.cc(46,1): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See on line help for details. [C:\Users\ToppLab\Photogrammetry\OpenSfM\cmake_build\map\pymap.vcxproj] Creating library C:/Users/ToppLab/Photogrammetry/OpenSfM/cmake_build/map/Release/pymap.lib and object C:/Users/Top pLab/Photogrammetry/OpenSfM/cmake_build/map/Release/pymap.exp Generating code Finished generating code pymap.vcxproj -> C:\Users\ToppLab\Photogrammetry\OpenSfM\opensfm\pymap.cp39-win_amd64.pyd Building Custom Rule C:/Users/ToppLab/Photogrammetry/OpenSfM/opensfm/src/robust/CMakeLists.txt absolute_pose_model.cc absolute_pose_known_rotation_model.cc relative_rotation_model.cc relative_pose_model.cc C:/Users/ToppLab/Photogrammetry/OpenSfM/vcpkg/installed/x64-windows/include\glog/log_severity.h(57,1): fatal error C11 89: #error: ERROR macro is defined. Define GLOG_NO_ABBREVIATED_SEVERITIES before including logging.h. See the document for detail. [C:\Users\ToppLab\Photogrammetry\OpenSfM\cmake_build\robust\robust.vcxproj] line_model.cc instanciations.cc C:/Users/ToppLab/Photogrammetry/OpenSfM/vcpkg/installed/x64-windows/include\glog/log_severity.h(57,1): fatal error C11 89: #error: ERROR macro is defined. Define GLOG_NO_ABBREVIATED_SEVERITIES before including logging.h. See the document for detail. [C:\Users\ToppLab\Photogrammetry\OpenSfM\cmake_build\robust\robust.vcxproj] Generating Code... Building Custom Rule C:/Users/ToppLab/Photogrammetry/OpenSfM/opensfm/src/sfm/CMakeLists.txt retriangulation.cc ba_helpers.cc C:/Users/ToppLab/Photogrammetry/OpenSfM/vcpkg/installed/x64-windows/include\glog/log_severity.h(57,1): fatal error C11 89: #error: ERROR macro is defined. Define GLOG_NO_ABBREVIATED_SEVERITIES before including logging.h. See the document for detail. [C:\Users\ToppLab\Photogrammetry\OpenSfM\cmake_build\sfm\sfm.vcxproj] tracks_helpers.cc Generating Code... Traceback (most recent call last): File "C:\Users\ToppLab\Photogrammetry\OpenSfM\setup.py", line 60, in build_c_extension() File "C:\Users\ToppLab\Photogrammetry\OpenSfM\setup.py", line 50, in build_c_extension subprocess.check_call( File "C:\Users\ToppLab\Miniconda3\lib\subprocess.py", line 373, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release']' returned non-zero exit status 1.

Loayaltal commented 1 year ago

Facing the same issue.

asahdjh commented 1 year ago

AnyOne Can Fix this Problem?

fabianschenk commented 1 year ago

HI @asahdjh @kenanoestreich @Loayaltal ,

This line looks like you need C++17 to compile:

The contents of are available only with C++17 or later.

Look for instructions on how to update to C++17 and then try again. I don't have access to any Windows computer, so can't help you.

havok69 commented 6 months ago

I am facing the same issue while trying to build OpenSFM on windows, using a virtual environment in conda. I'm getting the same error:

subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release']' returned non-zero exit status 1.