mapillary / OpenSfM

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

Error: Build on Ubuntu #955

Open uestcwcw opened 1 year ago

uestcwcw commented 1 year ago

Hi, there is a error on python3 build, the ubuntu is 20.04 Configuring for python 3.10... -- A library with LAPACK API found. -- Found AMD library: /usr/lib/x86_64-linux-gnu/libamd.so -- Found AMD header in: /usr/include/suitesparse -- Found CAMD library: /usr/lib/x86_64-linux-gnu/libcamd.so -- Found CAMD header in: /usr/include/suitesparse -- Found COLAMD library: /usr/lib/x86_64-linux-gnu/libcolamd.so -- Found COLAMD header in: /usr/include/suitesparse -- Found CCOLAMD library: /usr/lib/x86_64-linux-gnu/libccolamd.so -- Found CCOLAMD header in: /usr/include/suitesparse -- Found CHOLMOD library: /usr/lib/x86_64-linux-gnu/libcholmod.so -- Found CHOLMOD header in: /usr/include/suitesparse -- Found CXSPARSE library: /usr/lib/x86_64-linux-gnu/libcxsparse.so -- Found SuiteSparseQR library: /usr/lib/x86_64-linux-gnu/libspqr.so -- Found SuiteSparseQR header in: /usr/include/suitesparse -- Found Intel Thread Building Blocks (TBB) library: /usr/lib/x86_64-linux-gnu/libtbb.so, assuming SuiteSparseQR was compiled with TBB. -- Found Intel Thread Building Blocks (TBB) Malloc library: /usr/lib/x86_64-linux-gnu/libtbbmalloc.so -- Found SuiteSparse_config library: /usr/lib/x86_64-linux-gnu/libsuitesparseconfig.so -- Found SuiteSparse_config header in: /usr/include/suitesparse -- Adding librt: /usr/lib/x86_64-linux-gnu/librt.so to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing). -- Did not find METIS library (optional SuiteSparse dependency) -- Found installed version of Eigen: /usr/lib/cmake/eigen3 -- Found required Ceres dependency: Eigen version 3.3.7 in /usr/include/eigen3 -- Found required Ceres dependency: glog -- Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags -- Detected gflags version: 2.2.2 -- Found required Ceres dependency: gflags -- Found Ceres version: 1.14.0 installed in: /usr with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, CXSparse, SchurSpecializations, OpenMP, Multithreading] -- Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags -- Detected gflags version: 2.2.2 -- Found OpenCV: /usr (found version "4.2.0") -- Found OpenCV: /usr (found version "4.2.0") found components: core imgproc calib3d imgcodecs -- pybind11 v2.11.0 dev1 -- Configuring done -- Generating done -- Build files have been written to: /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/cmake_build Compiling extension... [ 3%] Built target gtest [ 7%] Built target foundation [ 11%] Built target akaze [ 13%] Built target test_main [ 42%] Built target vl [ 44%] Built target dense [ 45%] Built target geo [ 46%] Built target bundle [ 52%] Built target geometry [ 53%] Linking CXX executable foundation_test [ 54%] Linking CXX executable dense_test [ 56%] Linking CXX executable geo_test [ 59%] Built target features [ 59%] Linking CXX shared module /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/pygeo.cpython-37m-x86_64-linux-gnu.so [ 60%] Linking CXX shared module /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/pydense.cpython-37m-x86_64-linux-gnu.so [ 61%] Linking CXX executable geometry_test [ 62%] Linking CXX executable bundle_test [ 63%] Linking CXX shared module /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/pybundle.cpython-37m-x86_64-linux-gnu.so [ 71%] Built target map [ 74%] Built target robust [ 74%] Linking CXX shared module /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/pyfeatures.cpython-37m-x86_64-linux-gnu.so [ 75%] Linking CXX shared module /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/pygeometry.cpython-37m-x86_64-linux-gnu.so /usr/bin/ld: 找不到 -lpybind11 collect2: error: ld returned 1 exit status make[2]: [foundation/CMakeFiles/foundation_test.dir/build.make:152:foundation/foundation_test] 错误 1 make[1]: [CMakeFiles/Makefile2:469:foundation/CMakeFiles/foundation_test.dir/all] 错误 2 make[1]: 正在等待未完成的任务.... /usr/bin/ld: 找不到 -lpybind11 collect2: error: ld returned 1 exit status make[2]: [dense/CMakeFiles/dense_test.dir/build.make:138:dense/dense_test] 错误 1 make[1]: [CMakeFiles/Makefile2:641:dense/CMakeFiles/dense_test.dir/all] 错误 2 /usr/bin/ld: 找不到 -lpybind11 collect2: error: ld returned 1 exit status make[2]: [geo/CMakeFiles/geo_test.dir/build.make:138:geo/geo_test] 错误 1 make[1]: [CMakeFiles/Makefile2:785:geo/CMakeFiles/geo_test.dir/all] 错误 2 /usr/bin/ld: 找不到 -lpybind11 collect2: error: ld returned 1 exit status make[2]: [geo/CMakeFiles/pygeo.dir/build.make:136:/media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/pygeo.cpython-37m-x86_64-linux-gnu.so] 错误 1 make[1]: [CMakeFiles/Makefile2:755:geo/CMakeFiles/pygeo.dir/all] 错误 2 /usr/bin/ld: 找不到 -lpybind11 collect2: error: ld returned 1 exit status make[2]: [dense/CMakeFiles/pydense.dir/build.make:136:/media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/pydense.cpython-37m-x86_64-linux-gnu.so] 错误 1 make[1]: [CMakeFiles/Makefile2:611:dense/CMakeFiles/pydense.dir/all] 错误 2 [ 76%] Building CXX object map/CMakeFiles/pymap.dir/python/pybind.cc.o [ 76%] Linking CXX shared module /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/pyrobust.cpython-37m-x86_64-linux-gnu.so [ 77%] Linking CXX executable map_test [ 80%] Built target sfm /usr/bin/ld: 找不到 -lpybind11 collect2: error: ld returned 1 exit status make[2]: [bundle/CMakeFiles/bundle_test.dir/build.make:181:bundle/bundle_test] 错误 1 make[1]: [CMakeFiles/Makefile2:556:bundle/CMakeFiles/bundle_test.dir/all] 错误 2 /usr/bin/ld: 找不到 -lpybind11 collect2: error: ld returned 1 exit status make[2]: [geometry/CMakeFiles/geometry_test.dir/build.make:184:geometry/geometry_test] 错误 1 make[1]: [CMakeFiles/Makefile2:870:geometry/CMakeFiles/geometry_test.dir/all] 错误 2 /usr/bin/ld: 找不到 -lpybind11 collect2: error: ld returned 1 exit status make[2]: [geometry/CMakeFiles/pygeometry.dir/build.make:137:/media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/pygeometry.cpython-37m-x86_64-linux-gnu.so] 错误 1 make[1]: [CMakeFiles/Makefile2:840:geometry/CMakeFiles/pygeometry.dir/all] 错误 2 /usr/bin/ld: 找不到 -lpybind11 collect2: error: ld returned 1 exit status make[2]: [bundle/CMakeFiles/pybundle.dir/build.make:164:/media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/pybundle.cpython-37m-x86_64-linux-gnu.so] 错误 1 make[1]: [CMakeFiles/Makefile2:525:bundle/CMakeFiles/pybundle.dir/all] 错误 2 /usr/bin/ld: 找不到 -lpybind11 collect2: error: ld returned 1 exit status make[2]: [features/CMakeFiles/pyfeatures.dir/build.make:138:/media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/pyfeatures.cpython-37m-x86_64-linux-gnu.so] 错误 1 make[1]: [CMakeFiles/Makefile2:698:features/CMakeFiles/pyfeatures.dir/all] 错误 2 /usr/bin/ld: 找不到 -lpybind11 collect2: error: ld returned 1 exit status make[2]: [map/CMakeFiles/map_test.dir/build.make:172:map/map_test] 错误 1 make[1]: [CMakeFiles/Makefile2:1083:map/CMakeFiles/map_test.dir/all] 错误 2 /usr/bin/ld: 找不到 -lpybind11 /usr/bin/ld: 找不到 -lpybind11 collect2: error: ld returned 1 exit status make[2]: [robust/CMakeFiles/pyrobust.dir/build.make:139:/media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/pyrobust.cpython-37m-x86_64-linux-gnu.so] 错误 1 make[1]: [CMakeFiles/Makefile2:926:robust/CMakeFiles/pyrobust.dir/all] 错误 2 In file included from /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/python/pybind.cc:4: /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/geometry/pose.h: In constructor ‘geometry::Pose::Pose(const Vec3d&, const Vec3d&)’: /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/geometry/pose.h:20:11: warning: variable ‘T_cw’ set but not used [-Wunused-but-set-variable] 20 | Mat4d T_cw = Mat4d::Identity(); | ^~~~ In file included from /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/dataviews.h:6, from /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/python/pybind.cc:5: /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/shot.h: At global scope: /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/shot.h:74:3: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 74 | const geometry::Pose const GetPose() const; | ^~~~~ /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/shot.h:75:3: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 75 | geometry::Pose const GetPose(); | ^~~~ /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/shot.h:137:3: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 137 | const geometry::Camera const GetCamera() const { return shotcamera; } | ^~~~~ In file included from /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/python/pybind.cc:10: /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/pybind_utils.h: In function ‘pybind11::iterator pybind11::make_ptr_iterator(Iterator, Sentinel, Extra&& ...)’: /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/pybind_utils.h:156:67: error: wrong number of template arguments (4, should be at least 5) 156 | typedef detail::iterator_state<Iterator, Sentinel, false, Policy> state; | ^ In file included from /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/third_party/pybind11/include/pybind11/functional.h:12, from /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/pybind_utils.h:3, from /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/python/pybind.cc:10: /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/third_party/pybind11/include/pybind11/pybind11.h:2278:8: note: provided for ‘template<class Access, pybind11::return_value_policy Policy, class Iterator, class Sentinel, class ValueType, class ... Extra> struct pybind11::detail::iterator_state’ 2278 | struct iterator_state { | ^~~~~~ In file included from /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/python/pybind.cc:10: /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/pybind_utils.h: In lambda function: /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/pybind_utils.h:163:23: error: request for member ‘first_or_done’ in ‘s’, which is of non-class type ‘state’ {aka ‘int’} 163 | if (!s.first_or_done) | ^~~~~ /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/pybind_utils.h:164:22: error: request for member ‘it’ in ‘s’, which is of non-class type ‘state’ {aka ‘int’} 164 | ++s.it; | ^~ /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/pybind_utils.h:166:20: error: request for member ‘first_or_done’ in ‘s’, which is of non-class type ‘state’ {aka ‘int’} 166 | s.first_or_done = false; | ^~~~~ /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/pybind_utils.h:167:22: error: request for member ‘it’ in ‘s’, which is of non-class type ‘state’ {aka ‘int’} 167 | if (s.it == s.end) { | ^~ /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/pybind_utils.h:167:30: error: request for member ‘end’ in ‘s’, which is of non-class type ‘state’ {aka ‘int’} 167 | if (s.it == s.end) { | ^~~ /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/pybind_utils.h:168:20: error: request for member ‘first_or_done’ in ‘s’, which is of non-class type ‘state’ {aka ‘int’} 168 | s.first_or_done = true; | ^~~~~ /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/pybind_utils.h:171:25: error: request for member ‘it’ in ‘s’, which is of non-class type ‘state’ {aka ‘int’} 171 | return s.it; | ^~ /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/pybind_utils.h: At global scope: /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/pybind_utils.h:183:10: error: redefinition of ‘template<pybind11::return_value_policy Policy, class Type, class ... Extra> pybind11::iterator pybind11::make_value_iterator(Type&, Extra&& ...)’ 183 | iterator make_value_iterator(Type &value, Extra &&... extra) { | ^~~~~~~ In file included from /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/third_party/pybind11/include/pybind11/functional.h:12, from /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/pybind_utils.h:3, from /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/map/python/pybind.cc:10: /media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/opensfm/src/third_party/pybind11/include/pybind11/pybind11.h:2445:10: note: ‘template<pybind11::return_value_policy Policy, class Type, class ... Extra> pybind11::iterator pybind11::make_value_iterator(Type&, Extra&& ...)’ previously declared here 2445 | iterator make_value_iterator(Type &value, Extra &&...extra) { | ^~~~~~~ make[2]: ** [map/CMakeFiles/pymap.dir/build.make:63:map/CMakeFiles/pymap.dir/python/pybind.cc.o] 错误 1 make[1]: [CMakeFiles/Makefile2:1114:map/CMakeFiles/pymap.dir/all] 错误 2 make: *** [Makefile:95:all] 错误 2 Traceback (most recent call last): File "/media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/setup.py", line 60, in build_c_extension() File "/media/kb459/844C32D34C32C02A/WangChenwei/OpenSfM-main/setup.py", line 54, in build_c_extension subprocess.check_call( File "/home/kb459/anaconda3/lib/python3.10/subprocess.py", line 369, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['make', '-j64']' returned non-zero exit status 2.

PaulSchuler commented 1 year ago

I got the same error except that I'm using Python 3.8 and the last line prints "-j8" instead of "-j64".

I would be very happy if someone has a solution that I can try.

ishaniis commented 1 year ago

I can see your problem, This problem is more of a system-based problem when there is not enough space at /usr/tmp/. Try closing all your running CPP programs in the background/foreground (if there are any) and then try to compile it again.

Hard Suggestion: Try cloning and building the package all again in a new directory. I can see most of your dependencies are already installed.

It's more of a common error, let me know if you were able to solve this error. I am able to run this without any problem on my setup - Ubuntu 22.04 itself. Happy to help.

dev111ce commented 5 months ago

Reducing the version of pybind11 to v2.2.4 may solve your problem