HuajianUP / Photo-SLAM

[CVPR 2024] Photo-SLAM: Real-time Simultaneous Localization and Photorealistic Mapping for Monocular, Stereo, and RGB-D Cameras
GNU General Public License v3.0
295 stars 25 forks source link

How can i run in ubuntn18.04LTS? #1

Closed chengYi-xun closed 3 months ago

chengYi-xun commented 3 months ago

when I run replica_mono test and when I run to

std::shared_ptr<GaussianMapper> pGausMapper = std::make_shared<GaussianMapper>(pSLAM, gaussian_cfg_path, output_dir, 0, device_type); here, an error occurs. terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc

chengYi-xun commented 3 months ago

How can I fix this error? i use the ubuntn18.04LTS build it successfully,but i can not run it

chengYi-xun commented 3 months ago

At the same time, when I run to here:

std::filesystem::path pathImageDir(strImageDir);
pathImageDir /= "results";

it also throws an error“段错误 (核心已转储)”. This seems to be an issue with std::filesystem::path, and I don't know how to resolve it.

liquorleaf commented 3 months ago

Hi! It looks like the default version of gcc/g++ provided in Ubuntu 18.04 LTS does not support std::filesystem, which is formally implemented in C++17. I'm sorry that we have not tested with this OS before. Still, we find some solutions that might work for you. askubuntu.com says there might be two possible solutions:

  1. move from <filesystem> to <experimental/filesystem>
  2. install gcc-9 and g++-9, then create soft links to let cmake use them.
chengYi-xun commented 3 months ago

Thank you very much for your work. I have successfully run the code on Ubuntu 18.04. The error was resolved using the following method: 1.

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-9 g++-9

and add to CMakeLists:

set(CMAKE_CXX_STANDARD_REQUIRED ON)
link_libraries(stdc++fs)