当前位置:网站首页>Error reported when compiling basalt

Error reported when compiling basalt

2022-06-23 01:25:00 Blue area soldier

Write the summary at the front

  1. Please use GCC9 Or above basalt
  2. If apt Installed fmt Outdated Version , Please compile and install a higher version of fmt
  3. Use CLion When compiling, please configure the runtime LD_LIBRARY_PATH

Report a mistake :
github/basalt/thirdparty/Pangolin/src/image/image_io_lz4.cpp:42:12: error: ‘char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying 3 bytes from a string of the same length [-Werror=stringop-truncation]

 strncpy(header.magic,"LZ4",3);

 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~

cc1plus: all warnings being treated as errors
This error is due to CMake Of C++ Added... To the compilation options -Werror, Treat all warnings as errors , This strncpy function , Because it is C Function of style , Copy string is not followed by ’\0’ This terminator , But there is no need to add a terminator here , So full text search in the project -Werror The location of , Then add a blank space to the back -Wno-error=stringop-truncation Just go .

Error reporting II :

In file included 
from XXX/github/basalt/thirdparty/basalt-headers/thirdparty/eigen/Eigen/src/Geometry/AlignedBox.h:49,
from XXX/github/basalt/thirdparty/Pangolin/include/pangolin/plot/range.h:43,
from XXX/github/basalt/thirdparty/Pangolin/include/pangolin/image/image_utils.h:34,
from XXX/github/basalt/thirdparty/Pangolin/include/pangolin/handler/handler_image.h:30,
from /home/vipl/VIPL2021-CJ/github/basalt/thirdparty/Pangolin/src/handler/handler_image.cpp:1:

/home/vipl/VIPL2021-CJ/github/basalt/thirdparty/basalt-headers/thirdparty/eigen/Eigen/src/Geometry/InternalHeaderCheck.h:2:2: error: #error "Please include Eigen/Geometry instead of including headers inside the src directory directly."

 #error "Please include Eigen/Geometry instead of including headers inside the src directory directly."

This error is reported because the code checks whether it directly contains AlignedBox.h, That is to say range.h Used directly in

#include <Eigen/src/Geometry/AlignedBox.h>

And then in AlignedBox.h in , There is one #include "./InternalHeaderCheck.h" Directly checked out .
So the report is wrong , Need to put range.h Medium

#include <Eigen/src/Geometry/AlignedBox.h>
 It is amended as follows 
#include <Eigen/Geometry>

Error reporting 3 :
[ 87%] Building CXX object CMakeFiles/basalt.dir/src/utils/time_utils.cpp.o

In file included from /home/vipl/VIPL2021-CJ/github/basalt/src/utils/time_utils.cpp:2:

/home/vipl/VIPL2021-CJ/github/basalt/include/basalt/utils/format.hpp: In instantiation of ‘basalt::literals::operator""_format(const char*, size_t)::<lambda(auto:1&& …)> [with auto:1 = {const std::__cxx11::basic_string<char, std::char_traits, std::allocator >&, int&, double&, double&, double&, double&}]’:

/home/vipl/VIPL2021-CJ/github/basalt/src/utils/time_utils.cpp:134:56: required from here

/home/vipl/VIPL2021-CJ/github/basalt/include/basalt/utils/format.hpp:53:23: error: no matching function for call to ‘format(std::string_view, const std::__cxx11::basic_string&, int&, double&, double&, double&, double&)’

 return fmt::format(std::string_view(s, n), args...);

        ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This report is wrong GCC The reason for the version , I'm using GCC8.3.0, Although it has been fully supported C++17 了 , But I don't know why it can't be opened C++17 Characteristics of , I don't want to study this problem too deeply , Direct download GCC9 Or above , Then compile and install , Use update-alternative Version management , It is important to note that LD_LIBRARY_PATH Add inside GCC New version Library Directory ,fmt Also use new GCC Compile and install , And don't use apt Way to install fmt, I'm using deepin,apt From the source libfmt Kuo is 5.2.1 As if , Too old , Direct download 8.1.1 Version of , Use the new GCC Install after compilation , Then compile

Error reporting 4 :
Click on debug When debugging , The executable shows a link to /lib/x86_64-linux-gnu/libstdc++.so… This library , This library does not support new GLIBCXX.3.29 wait
 Insert picture description here
This is because CLion Environment variables are not set in the runtime configuration LD_LIBRARY_PATH, The system library directory used directly , Good configuration LD_LIBRARY_PATH Then you can run
stay CLION Operation of -> Edit the configuration -> Select the one you want on the left debug The program , Then set the environment variable .

原网站

版权声明
本文为[Blue area soldier]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206220917245715.html