ceres-solver / ceres-solver

A large scale non-linear optimization library

Home Page:http://ceres-solver.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CMake Error at cmake/FindTBB.cmake:434 (file): file STRINGS file "/usr/include/tbb/tbb_stddef.h" cannot be read.

monajalal opened this issue · comments

How can I fix this?

(new-pvnet) mona@ada:~/anaconda3/envs/new-pvnet/ceres-solver-2.0.0$ mkdir build
(new-pvnet) mona@ada:~/anaconda3/envs/new-pvnet/ceres-solver-2.0.0$ cd build
(new-pvnet) mona@ada:~/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build$ cmake -DBUILD_SHARED_LIBS=ON -DLAPACK_LIBRARIES=/home/mona/anaconda3/envs/new-pvnet/lib/ -DLIBOPENBLAS_LIBRARY=/usr/lib/x86_64-linux-gnu/libopenblas.so ..
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- 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
-- 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
-- Detected Ceres version: 2.0.0 from /home/mona/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/include/ceres/version.h
-- Detected available Ceres threading models: [CXX_THREADS, OPENMP, NO_THREADS]
-- Building with C++14
-- Found Eigen version 3.3.7: /home/mona/anaconda3/envs/new-pvnet/include/eigen3
-- Enabling use of Eigen as a sparse linear algebra library.
-- 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 LAPACK library: /home/mona/anaconda3/envs/new-pvnet/lib/
-- Found AMD headers in: /usr/include/suitesparse
-- Found AMD library: /usr/lib/x86_64-linux-gnu/libamd.so
-- Found CAMD headers in: /usr/include/suitesparse
-- Found CAMD library: /usr/lib/x86_64-linux-gnu/libcamd.so
-- Found COLAMD headers in: /usr/include/suitesparse
-- Found COLAMD library: /usr/lib/x86_64-linux-gnu/libcolamd.so
-- Found CCOLAMD headers in: /usr/include/suitesparse
-- Found CCOLAMD library: /usr/lib/x86_64-linux-gnu/libccolamd.so
-- Found CHOLMOD headers in: /usr/include/suitesparse
-- Found CHOLMOD library: /usr/lib/x86_64-linux-gnu/libcholmod.so
-- Found SUITESPARSEQR headers in: /usr/include/suitesparse
-- Found SUITESPARSEQR library: /usr/lib/x86_64-linux-gnu/libspqr.so
CMake Error at cmake/FindTBB.cmake:434 (file):
  file STRINGS file "/usr/include/tbb/tbb_stddef.h" cannot be read.
Call Stack (most recent call first):
  cmake/FindSuiteSparse.cmake:309 (find_package)
  CMakeLists.txt:282 (find_package)


-- Found Intel Thread Building Blocks (TBB) library (. / ) include location: /usr/include. Assuming SuiteSparseQR was compiled with TBB.
-- Found SUITESPARSE_CONFIG headers in: /usr/include/suitesparse
-- Found SUITESPARSE_CONFIG library: /usr/lib/x86_64-linux-gnu/libsuitesparseconfig.so
-- Found LIBRT library: /usr/lib/x86_64-linux-gnu/librt.a
-- Adding librt: /usr/lib/x86_64-linux-gnu/librt.a 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 SuiteSparse: TRUE (found version "5.10.1") 
-- Found SuiteSparse 5.10.1, building with SuiteSparse.
-- Found CXSparse: /usr/include/suitesparse (found version "3.2.0") 
-- Found CXSparse version: 3.2.0, building with CXSparse.
-- Building without Apple's Accelerate sparse support.
-- Found Google Flags (gflags) version 2.2.2: /home/mona/anaconda3/envs/new-pvnet/lib/cmake/gflags
-- No preference for use of exported glog CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported glog CMake configuration if available.
-- Found installed version of glog: /home/mona/anaconda3/envs/new-pvnet/lib/cmake/glog
-- Detected glog version: 0.5.0
-- Found Glog: glog::glog  
-- Found Google Log (glog). Assuming glog was built with gflags support as gflags was found. This will make gflags a public dependency of Ceres.
-- Using Ceres threading model: CXX_THREADS
-- Failed to find Google benchmark library, disabling build of benchmarks.
-- Building Ceres as a shared library.
-- No build type specified; defaulting to CMAKE_BUILD_TYPE=Release.
-- Performing Test CHECK_CXX_FLAG_Wmissing_declarations
-- Performing Test CHECK_CXX_FLAG_Wmissing_declarations - Success
-- Performing Test CHECK_CXX_FLAG_Wno_unknown_pragmas
-- Performing Test CHECK_CXX_FLAG_Wno_unknown_pragmas - Success
-- Performing Test CHECK_CXX_FLAG_Wno_sign_compare
-- Performing Test CHECK_CXX_FLAG_Wno_sign_compare - Success
-- Performing Test CHECK_CXX_FLAG_Wno_unused_parameter
-- Performing Test CHECK_CXX_FLAG_Wno_unused_parameter - Success
-- Performing Test CHECK_CXX_FLAG_Wno_missing_field_initializers
-- Performing Test CHECK_CXX_FLAG_Wno_missing_field_initializers - Success
-- Creating configured Ceres config.h output directory: /home/mona/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build/config/ceres/internal
-- Enabling CERES_USE_EIGEN_SPARSE in Ceres config.h
-- Enabling CERES_NO_ACCELERATE_SPARSE in Ceres config.h
-- Enabling CERES_USE_CXX_THREADS in Ceres config.h
-- Enabling CERES_USING_SHARED_LIBRARY in Ceres config.h
-- Performing Test CHECK_CXX_FLAG_Wno_missing_declarations
-- Performing Test CHECK_CXX_FLAG_Wno_missing_declarations - Success
-- Build the examples.
-- Configuring incomplete, errors occurred!
See also "/home/mona/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/mona/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build/CMakeFiles/CMakeError.log".
(new-pvnet) mona@ada:~/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build$ cat CMakeFiles/CMakeError.log
Determining if the function sgemm_ exists failed with the following output:
Change Dir: /home/mona/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_45afb/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_45afb.dir/build.make CMakeFiles/cmTC_45afb.dir/build
gmake[1]: Entering directory '/home/mona/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_45afb.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=sgemm_ -o CMakeFiles/cmTC_45afb.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.22/Modules/CheckFunctionExists.c
Linking C executable cmTC_45afb
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_45afb.dir/link.txt --verbose=1
/usr/bin/cc  -DCHECK_FUNCTION_EXISTS=sgemm_ CMakeFiles/cmTC_45afb.dir/CheckFunctionExists.c.o -o cmTC_45afb 
/usr/bin/ld: CMakeFiles/cmTC_45afb.dir/CheckFunctionExists.c.o: in function `main':
CheckFunctionExists.c:(.text+0x14): undefined reference to `sgemm_'
collect2: error: ld returned 1 exit status
gmake[1]: *** [CMakeFiles/cmTC_45afb.dir/build.make:99: cmTC_45afb] Error 1
gmake[1]: Leaving directory '/home/mona/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_45afb/fast] Error 2

(base) mona@ada:~$ uname -a
Linux ada 6.2.0-37-generic #38~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov  2 18:01:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
(base) mona@ada:~$ lsb_release -a
LSB Version:	core-11.1.0ubuntu4-noarch:security-11.1.0ubuntu4-noarch
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.3 LTS
Release:	22.04
Codename:	jammy

Please notice if I just do this:

(base) mona@ada:~/anaconda3/envs/new-pvnet/ceres-solver-2.0.0$ rm -rf build; mkdir build; cd build
(base) mona@ada:~/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build$ cmake ..
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- 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
-- 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
-- Detected Ceres version: 2.0.0 from /home/mona/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/include/ceres/version.h
-- Detected available Ceres threading models: [CXX_THREADS, OPENMP, NO_THREADS]
-- Building with C++14
-- Found Eigen version 3.4.0: /usr/include/eigen3
-- Enabling use of Eigen as a sparse linear algebra library.
-- 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 LAPACK library: /usr/lib/x86_64-linux-gnu/libopenblas.so;-lm;-ldl
-- Found AMD headers in: /usr/include/suitesparse
-- Found AMD library: /usr/lib/x86_64-linux-gnu/libamd.so
-- Found CAMD headers in: /usr/include/suitesparse
-- Found CAMD library: /usr/lib/x86_64-linux-gnu/libcamd.so
-- Found COLAMD headers in: /usr/include/suitesparse
-- Found COLAMD library: /usr/lib/x86_64-linux-gnu/libcolamd.so
-- Found CCOLAMD headers in: /usr/include/suitesparse
-- Found CCOLAMD library: /usr/lib/x86_64-linux-gnu/libccolamd.so
-- Found CHOLMOD headers in: /usr/include/suitesparse
-- Found CHOLMOD library: /usr/lib/x86_64-linux-gnu/libcholmod.so
-- Found SUITESPARSEQR headers in: /usr/include/suitesparse
-- Found SUITESPARSEQR library: /usr/lib/x86_64-linux-gnu/libspqr.so
CMake Error at cmake/FindTBB.cmake:434 (file):
  file STRINGS file "/usr/include/tbb/tbb_stddef.h" cannot be read.
Call Stack (most recent call first):
  cmake/FindSuiteSparse.cmake:309 (find_package)
  CMakeLists.txt:282 (find_package)


-- Found Intel Thread Building Blocks (TBB) library (. / ) include location: /usr/include. Assuming SuiteSparseQR was compiled with TBB.
-- Found SUITESPARSE_CONFIG headers in: /usr/include/suitesparse
-- Found SUITESPARSE_CONFIG library: /usr/lib/x86_64-linux-gnu/libsuitesparseconfig.so
-- Found LIBRT library: /usr/lib/x86_64-linux-gnu/librt.a
-- Adding librt: /usr/lib/x86_64-linux-gnu/librt.a 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 SuiteSparse: TRUE (found version "5.10.1") 
-- Found SuiteSparse 5.10.1, building with SuiteSparse.
-- Found CXSparse: /usr/include/suitesparse (found version "3.2.0") 
-- Found CXSparse version: 3.2.0, building with CXSparse.
-- Building without Apple's Accelerate sparse support.
-- Found Google Flags (gflags) version 2.2.2: /home/mona/anaconda3/lib/cmake/gflags
-- No preference for use of exported glog CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported glog CMake configuration if available.
-- Found installed version of glog: /home/mona/anaconda3/lib/cmake/glog
-- Detected glog version: 0.5.0
-- Found Glog: glog::glog  
-- Found Google Log (glog). Assuming glog was built with gflags support as gflags was found. This will make gflags a public dependency of Ceres.
-- Using Ceres threading model: CXX_THREADS
-- Found Google benchmark library. Building Ceres benchmarks.
-- Building Ceres as a static library.
-- No build type specified; defaulting to CMAKE_BUILD_TYPE=Release.
-- Performing Test CHECK_CXX_FLAG_Wmissing_declarations
-- Performing Test CHECK_CXX_FLAG_Wmissing_declarations - Success
-- Performing Test CHECK_CXX_FLAG_Wno_unknown_pragmas
-- Performing Test CHECK_CXX_FLAG_Wno_unknown_pragmas - Success
-- Performing Test CHECK_CXX_FLAG_Wno_sign_compare
-- Performing Test CHECK_CXX_FLAG_Wno_sign_compare - Success
-- Performing Test CHECK_CXX_FLAG_Wno_unused_parameter
-- Performing Test CHECK_CXX_FLAG_Wno_unused_parameter - Success
-- Performing Test CHECK_CXX_FLAG_Wno_missing_field_initializers
-- Performing Test CHECK_CXX_FLAG_Wno_missing_field_initializers - Success
-- Creating configured Ceres config.h output directory: /home/mona/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build/config/ceres/internal
-- Enabling CERES_USE_EIGEN_SPARSE in Ceres config.h
-- Enabling CERES_NO_ACCELERATE_SPARSE in Ceres config.h
-- Enabling CERES_USE_CXX_THREADS in Ceres config.h
-- Performing Test CHECK_CXX_FLAG_Wno_missing_declarations
-- Performing Test CHECK_CXX_FLAG_Wno_missing_declarations - Success
-- Build the examples.
-- Configuring incomplete, errors occurred!
See also "/home/mona/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/mona/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build/CMakeFiles/CMakeError.log".

the error is:

(base) mona@ada:~/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build$ cat /home/mona/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build/CMakeFiles/CMakeError.log
Determining if the function sgemm_ exists failed with the following output:
Change Dir: /home/mona/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_0b694/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_0b694.dir/build.make CMakeFiles/cmTC_0b694.dir/build
gmake[1]: Entering directory '/home/mona/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_0b694.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=sgemm_ -o CMakeFiles/cmTC_0b694.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.22/Modules/CheckFunctionExists.c
Linking C executable cmTC_0b694
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0b694.dir/link.txt --verbose=1
/usr/bin/cc  -DCHECK_FUNCTION_EXISTS=sgemm_ CMakeFiles/cmTC_0b694.dir/CheckFunctionExists.c.o -o cmTC_0b694 
/usr/bin/ld: CMakeFiles/cmTC_0b694.dir/CheckFunctionExists.c.o: in function `main':
CheckFunctionExists.c:(.text+0x14): undefined reference to `sgemm_'
collect2: error: ld returned 1 exit status
gmake[1]: *** [CMakeFiles/cmTC_0b694.dir/build.make:99: cmTC_0b694] Error 1
gmake[1]: Leaving directory '/home/mona/anaconda3/envs/new-pvnet/ceres-solver-2.0.0/build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_0b694/fast] Error 2


libtbb-dev uses OneAPI TBB as its source. This library doesnt include tbb/tbb_stddef.h anymore. OpenCV was also dealing with this issue and they fixed it as follows: yppah56/OpenFPGA@8cdaceb

This easy fix can also be implemented for ceres.