dgrzech / sobfu

real-time 3D reconstruction of non-rigidly deforming scenes using depth data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation in Ubuntu 20 fails [solved]

fsckawk opened this issue · comments

There are several issues related to compilation in an end-of-2021 system.

My setup:

  • NVIDIA GeForce RTX 3070
  • x86_64 GNU/Linux Ubuntu 20.04.3 LTS
  • gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
  • cuda_11.5.0_495.29.05
  • Ubuntu 20 lacks of "metslib" package: compiled from sources
wget https://www.coin-or.org/download/source/metslib/metslib-0.5.3.tgz
tar xzvf metslib-0.5.3.tgz
cd metslib-0.5.3
./configure --prefix=/usr/local
make
sudo make install
  • The imported target "vtk" references the file "/usr/bin/vtk" but "this file does not exist". And so on.
sudo update-alternatives --install /usr/bin/vtk vtk /usr/bin/vtk7 10
sudo update-alternatives --install /usr/bin/pvtk pvtk /usr/bin/python3 10
sudo touch /usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so
sudo touch /usr/bin/vtkParseOGLExt-7.1
  • CUDA_CUDA_LIBRARY (ADVANCED) -> NOTFOUND
    cmake -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_TESTS=ON ..
  • CUB_COMPILER_DEPRECATION_SOFT(C++14, C++11);
    Edit CMakeLists.txt:
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -MP -MD -pthread -fpermissive")
SET(CMAKE_C_COMPILER "/usr/bin/gcc-9")
SET(CMAKE_CXX_COMPILER "/usr/bin/g++-9")
  • Error compiling demo.cpp

src/apps/demo.cpp:311:43: error: "CV_LOAD_IMAGE_ANYDEPTH" was not declared in this scope
Edit and change that to:

            depth = cv::imread(depths[i], cv::IMREAD_ANYDEPTH);
            image = cv::imread(images[i], cv::IMREAD_COLOR);

With these changes, compilation ends succesfully. But "bin/app" complains:

Device 0:  "NVIDIA GeForce RTX 3070"  7960Mb
Can't determine number of cores. Unknown SM version 8.6!
, sm_86, 0 cores, Driver/Runtime ver.11.40/11.50

So, I tried replacing PCL 1.10 from distribution with my own compiled PCL 1.12.0 (with CUDA and GPU support).

Then, I had to change include/kfusion/cuda/marching_cubes.hpp too, replacing

typedef boost::shared_ptr<MarchingCubes> Ptr;
with

typedef pcl::shared_ptr<MarchingCubes> Ptr;

But resulting "app" still can't determine number of cores.

So, I've edited src/kfusion/core.cpp following the example in

helper_cuda_drvapi.h

i.e., add {0x80, 64}, {0x86, 128} to gpuArchCoresPerSM array, and now seems to be OK.

Device 0: "NVIDIA GeForce RTX 3070" 7960Mb, sm_86, 5888 cores, Driver/Runtime ver.11.40/11.50

You can find a quick n' dirty patch here:
sobfu.patch

With these changes, binaries are generated, and "app" works as expected with the "Snoopy" example.