ToniRV / NeRF-SLAM

NeRF-SLAM: Real-Time Dense Monocular SLAM with Neural Radiance Fields. https://arxiv.org/abs/2210.13641 + Sigma-Fusion: Probabilistic Volumetric Fusion for Dense Monocular SLAM https://arxiv.org/abs/2210.01276

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not able to build gtsam - make: *** [Makefile:166: all] Error 2

0x434D opened this issue · comments

Hey guys,

I keep trying to build gtsam like described in the repo but can't get it to work.

I'm very new to anything c/c++ and cmake related so any help would be highly appreciated !!

OS: Ubuntu 20.04

command --> cmake ./thirdparty/gtsam -DGTSAM_BUILD_PYTHON=1 -B build_gtsam

-- The CXX compiler identification is GNU 9.4.0
-- The C compiler identification is GNU 9.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- GTSAM Version: 4.2a8
-- Performing Test COMPILER_HAS_WSUGGEST_OVERRIDE
-- Performing Test COMPILER_HAS_WSUGGEST_OVERRIDE - Success
-- Performing Test COMPILER_HAS_WMISSING_OVERRIDE
-- Performing Test COMPILER_HAS_WMISSING_OVERRIDE - Failed
-- GTSAM_POSE3_EXPMAP=ON, enabling GTSAM_ROT3_EXPMAP as well
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.65") found components: serialization system filesystem thread program_options date_time timer chrono regex 
-- Found Eigen version: 3.3.7
-- Looking for execinfo.h
-- Looking for execinfo.h - found
-- Looking for getline
-- Looking for getline - found
-- checking for thread-local storage - found
-- Could NOT find MKL (missing: MKL_INCLUDE_DIR MKL_LIBRARIES) 
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- Found Python3: /home/chris/Programs/miniconda3/envs/nerf-slam/bin/python3.8 (found version "3.8.16") found components: Interpreter Development Development.Module Development.Embed 
-- Found TBB: /usr/include (found suitable version "2020.1", minimum required is "4.4") found components: tbb tbbmalloc 
-- Building 3rdparty
-- Could NOT find GeographicLib (missing: GeographicLib_LIBRARY_DIRS GeographicLib_LIBRARIES GeographicLib_INCLUDE_DIRS) 
-- Building base
-- Building basis
-- Building geometry
-- Building inference
-- Building symbolic
-- Building discrete
-- Building hybrid
-- Building linear
-- Building nonlinear
-- Building sam
-- Building sfm
-- Building slam
-- Building navigation
-- GTSAM Version: 4.2.0
-- Install prefix: /usr/local
-- Building GTSAM - shared: ON
-- Building base_unstable
-- Building geometry_unstable
-- Building linear_unstable
-- Building discrete_unstable
-- Building dynamics_unstable
-- Building nonlinear_unstable
-- Building slam_unstable
-- Building partition_unstable
-- GTSAM_UNSTABLE Version: 4.2.0
-- Install prefix: /usr/local
-- Found Python: /home/chris/Programs/miniconda3/envs/nerf-slam/bin/python3.8 (found suitable exact version "3.8.16") found components: Interpreter Development Development.Module Development.Embed 
-- gtwrap Package config : /usr/local/lib/cmake/gtwrap
-- gtwrap version        : 1.0
-- gtwrap CMake path     : /usr/local/lib/cmake/gtwrap
-- gtwrap library path   : /usr/local/lib/gtwrap
-- gtwrap binary path    : /usr/local/bin/gtwrap
-- gtwrap header path    : /usr/local/include/gtwrap
-- Checking Python Version
-- Setting Python version for wrapper
-- pybind11 v2.10.0 
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Wrote /home/chris/repos/NeRF-SLAM/build_gtsam/GTSAMConfig.cmake
-- Wrote /home/chris/repos/NeRF-SLAM/build_gtsam/GTSAM_UNSTABLEConfig.cmake
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- ===============================================================
-- ================  Configuration Options  ======================
--  CMAKE_CXX_COMPILER_ID type                       : GNU
--  CMAKE_CXX_COMPILER_VERSION                       : 9.4.0
--  CMake version                                    : 3.25.2
--  CMake generator                                  : Unix Makefiles
--  CMake build tool                                 : /usr/bin/make
-- Build flags                                               
--  Build Tests                                      : Enabled
--  Build examples with 'make all'                   : Enabled
--  Build timing scripts with 'make all'             : Disabled
--  Build shared GTSAM libraries                     : Enabled
--  Put build type in library name                   : Enabled
--  Build libgtsam_unstable                          : Enabled
--  Build GTSAM unstable Python                      : Enabled
--  Build MATLAB Toolbox for unstable                : Disabled
--  Build for native architecture                    : Disabled
--  Build type                                       : Release
--  C compilation flags                              :  -O3 -DNDEBUG
--  C++ compilation flags                            :  -O3 -DNDEBUG
--  GTSAM_COMPILE_FEATURES_PUBLIC                    : cxx_std_11
--  GTSAM_COMPILE_OPTIONS_PUBLIC                     : 
--  GTSAM_COMPILE_DEFINITIONS_PUBLIC                 : 
--  GTSAM_COMPILE_OPTIONS_PUBLIC_DEBUG               : 
--  GTSAM_COMPILE_DEFINITIONS_PUBLIC_DEBUG           : 
--  GTSAM_COMPILE_OPTIONS_PUBLIC_RELEASE             : 
--  GTSAM_COMPILE_DEFINITIONS_PUBLIC_RELEASE         : 
--  GTSAM_COMPILE_OPTIONS_PUBLIC_TIMING              : 
--  GTSAM_COMPILE_DEFINITIONS_PUBLIC_TIMING          : 
--  GTSAM_COMPILE_OPTIONS_PUBLIC_PROFILING           : 
--  GTSAM_COMPILE_DEFINITIONS_PUBLIC_PROFILING       : 
--  GTSAM_COMPILE_OPTIONS_PUBLIC_RELWITHDEBINFO      : 
--  GTSAM_COMPILE_DEFINITIONS_PUBLIC_RELWITHDEBINFO  : 
--  GTSAM_COMPILE_OPTIONS_PUBLIC_MINSIZEREL          : 
--  GTSAM_COMPILE_DEFINITIONS_PUBLIC_MINSIZEREL      : 
--  Use System Eigen                                 : OFF (Using version: 3.3.7)
--  Use System Metis                                 : OFF
--  Using Boost version                              : 1.71.0
--  Use Intel TBB                                    : Yes (Version: 2020.1)
--  Eigen will use MKL                               : MKL not found
--  Eigen will use MKL and OpenMP                    : OpenMP found but GTSAM_WITH_EIGEN_MKL is disabled
--  Default allocator                                : TBB
--  Cheirality exceptions enabled                    : YES
--  Build with ccache                                : No
-- Packaging flags
--  CPack Source Generator                           : TGZ
--  CPack Generator                                  : TGZ
-- GTSAM flags                                               
--  Quaternions as default Rot3                      : Disabled
--  Runtime consistency checking                     : Disabled
--  Rot3 retract is full ExpMap                      : Enabled
--  Pose3 retract is full ExpMap                     : Enabled
--  Allow features deprecated in GTSAM 4.1           : Enabled
--  Metis-based Nested Dissection                    : Enabled
--  Use tangent-space preintegration                 : Enabled
-- MATLAB toolbox flags
--  Install MATLAB toolbox                           : Disabled
-- Python toolbox flags                                      
--  Build Python module with pybind                  : Enabled
--  Python version                                   : 3.8.16
-- ===============================================================
-- Configuring done
-- Generating done
-- Build files have been written to: /home/chris/repos/NeRF-SLAM/build_gtsam

command --> cmake --build build_gtsam --config RelWithDebInfo -j

...
[ 58%] Linking CXX shared library libgtsam.so
[ 58%] Built target gtsam
make: *** [Makefile:166: all] Error 2

Following is the CMakeError.log :

Performing C++ SOURCE FILE Test COMPILER_HAS_WMISSING_OVERRIDE failed with the following output:
Change Dir: /home/chris/repos/NeRF-SLAM/build_gtsam/CMakeFiles/CMakeScratch/TryCompile-mSsxK8

Run Build Command(s):/usr/bin/make -f Makefile cmTC_e00fa/fast && /usr/bin/make  -f CMakeFiles/cmTC_e00fa.dir/build.make CMakeFiles/cmTC_e00fa.dir/build
make[1]: Entering directory '/home/chris/repos/NeRF-SLAM/build_gtsam/CMakeFiles/CMakeScratch/TryCompile-mSsxK8'
Building CXX object CMakeFiles/cmTC_e00fa.dir/src.cxx.o
/usr/bin/c++ -DCOMPILER_HAS_WMISSING_OVERRIDE  -Wmissing -o CMakeFiles/cmTC_e00fa.dir/src.cxx.o -c /home/chris/repos/NeRF-SLAM/build_gtsam/CMakeFiles/CMakeScratch/TryCompile-mSsxK8/src.cxx
c++: error: unrecognized command line option '-Wmissing'; did you mean '-Waliasing'?
make[1]: *** [CMakeFiles/cmTC_e00fa.dir/build.make:78: CMakeFiles/cmTC_e00fa.dir/src.cxx.o] Error 1
make[1]: Leaving directory '/home/chris/repos/NeRF-SLAM/build_gtsam/CMakeFiles/CMakeScratch/TryCompile-mSsxK8'
make: *** [Makefile:127: cmTC_e00fa/fast] Error 2


Source file was:
int main() { return 0; }

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/chris/repos/NeRF-SLAM/build_gtsam/CMakeFiles/CMakeScratch/TryCompile-QS7hy9

Run Build Command(s):/usr/bin/make -f Makefile cmTC_22939/fast && /usr/bin/make  -f CMakeFiles/cmTC_22939.dir/build.make CMakeFiles/cmTC_22939.dir/build
make[1]: Entering directory '/home/chris/repos/NeRF-SLAM/build_gtsam/CMakeFiles/CMakeScratch/TryCompile-QS7hy9'
Building C object CMakeFiles/cmTC_22939.dir/src.c.o
/usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD   -o CMakeFiles/cmTC_22939.dir/src.c.o -c /home/chris/repos/NeRF-SLAM/build_gtsam/CMakeFiles/CMakeScratch/TryCompile-QS7hy9/src.c
Linking C executable cmTC_22939
/opt/cmake-3.25.2-linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/cmTC_22939.dir/link.txt --verbose=1
/usr/bin/cc -rdynamic CMakeFiles/cmTC_22939.dir/src.c.o -o cmTC_22939 
/usr/bin/ld: CMakeFiles/cmTC_22939.dir/src.c.o: in function `main':
src.c:(.text+0x46): undefined reference to `pthread_create'
/usr/bin/ld: src.c:(.text+0x52): undefined reference to `pthread_detach'
/usr/bin/ld: src.c:(.text+0x5e): undefined reference to `pthread_cancel'
/usr/bin/ld: src.c:(.text+0x6f): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_22939.dir/build.make:99: cmTC_22939] Error 1
make[1]: Leaving directory '/home/chris/repos/NeRF-SLAM/build_gtsam/CMakeFiles/CMakeScratch/TryCompile-QS7hy9'
make: *** [Makefile:127: cmTC_22939/fast] Error 2


Source file was:
#include <pthread.h>

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: /home/chris/repos/NeRF-SLAM/build_gtsam/CMakeFiles/CMakeScratch/TryCompile-onaQU5

Run Build Command(s):/usr/bin/make -f Makefile cmTC_df07c/fast && /usr/bin/make  -f CMakeFiles/cmTC_df07c.dir/build.make CMakeFiles/cmTC_df07c.dir/build
make[1]: Entering directory '/home/chris/repos/NeRF-SLAM/build_gtsam/CMakeFiles/CMakeScratch/TryCompile-onaQU5'
Building C object CMakeFiles/cmTC_df07c.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_df07c.dir/CheckFunctionExists.c.o -c /home/chris/repos/NeRF-SLAM/build_gtsam/CMakeFiles/CMakeScratch/TryCompile-onaQU5/CheckFunctionExists.c
Linking C executable cmTC_df07c
/opt/cmake-3.25.2-linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/cmTC_df07c.dir/link.txt --verbose=1
/usr/bin/cc  -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_df07c.dir/CheckFunctionExists.c.o -o cmTC_df07c  -lpthreads 
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_df07c.dir/build.make:99: cmTC_df07c] Error 1
make[1]: Leaving directory '/home/chris/repos/NeRF-SLAM/build_gtsam/CMakeFiles/CMakeScratch/TryCompile-onaQU5'
make: *** [Makefile:127: cmTC_df07c/fast] Error 2

Maybe to add to it:

I tried deleting the build_gtsam folder completely and redoing the steps to get it

This results in cmake failing at random percentages - e.g. sometimes it crashes at 17%, 97% or like the one I posted at 58%

I'm having the same problem, has this been resolved?

I'm having the same problem, has this been resolved?

maybe delete the whole gtsam folder and download from this, then build the project like readme.txt. It is work for me and hope to help you.