当前位置:网站首页>编译basalt时出现的报错
编译basalt时出现的报错
2022-06-22 09:17:00 【蓝域小兵】
把总结写在前面
- 请使用GCC9或以上版本编译basalt
- 如果apt安装的fmt版本太低,请编译安装高一点版本的fmt
- 使用CLion编译请在配置好运行时的LD_LIBRARY_PATH
报错一:
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
这个报错是由于在CMake的C++编译选项中添加了-Werror,即将所有警告当作错误对待,这个strncpy函数,由于是C风格的函数,拷贝字符串后面没有加’\0’这个结束符,但是这里其实不需要加结束符,因此在项目中全文搜索-Werror的位置,然后空一格在后面加上-Wno-error=stringop-truncation就行。
报错二:
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."
这个报错是因为代码中检查了是否直接包含AlignedBox.h,即在range.h中直接使用了
#include <Eigen/src/Geometry/AlignedBox.h>
然后在AlignedBox.h中,有一个#include "./InternalHeaderCheck.h"直接检查了出来。
因此报错了,需要将range.h中的
#include <Eigen/src/Geometry/AlignedBox.h>
修改为
#include <Eigen/Geometry>
报错三:
[ 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...);
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
这个报错是GCC版本的原因,我使用的是GCC8.3.0,虽然已经全面支持C++17了,但是我不知道为什么开启不了C++17的特性,这个问题也不不想研究太深了,直接下载GCC9或者以上的版本,然后编译安装,使用update-alternative进行版本管理,需要注意在LD_LIBRARY_PATH里面添加GCC新的版本库目录,fmt也要使用新的GCC编译过后再安装,而且不要使用apt方式安装fmt,我使用的是deepin,apt源里面的libfmt库是5.2.1好像,太老了,直接下载8.1.1版本的,使用新的GCC编译后安装,然后再编译
报错四:
点击debug调试的时候,可执行文件显示链接到了/lib/x86_64-linux-gnu/libstdc++.so…这个库,这个库不支持新的GLIBCXX.3.29等等
这是因为CLion运行时配置里面没有设置环境变量LD_LIBRARY_PATH,感觉就直接使用的系统库目录,配置好LD_LIBRARY_PATH之后就可以运行
在CLION的运行->编辑配置->左侧选取你要debug的程序,然后设置环境变量就行。
边栏推荐
- 两个线程各执行100次i++,得到的可能值
- [network security officer] an attack technology that needs to be understood - high hidden and high persistent threats
- Embedded development terminology concept summary
- Quick search system (aso+xls) v1.0
- Kali Trojan invades win7 system
- ==经典面试题
- 国外十款免费开源PHP网店程序介绍
- Variable things
- 变量那些事
- 断言assert()
猜你喜欢

Byte/byte? Don't get dizzy!

DHCP中继代理

Performance optimization topics

DOM programming
![[uni app] actual combat summary (including multi terminal packaging)](/img/35/6b0672311b033bc89f1518dd794777.png)
[uni app] actual combat summary (including multi terminal packaging)

Manually mining XSS vulnerabilities

機器學習|nltk_Data下載錯誤|nltk的stopwords語料下載錯誤解决方法
![[node] please accept the crawler. We won't worry about the data any more](/img/f1/cb2ab621f9f714b650f0fbe3a26afa.png)
[node] please accept the crawler. We won't worry about the data any more

Threejs implementation of simple panoramic view demo

5 interview questions, grasp the underlying principle of string!
随机推荐
[Architect (Part 39)] connecting MySQL database developed by server
微服务架构概述
DHCP中继代理
Win+sublime Text3 + go 1.9.2 environment setup diagram
5 interview questions, grasp the underlying principle of string!
一个老开源人的自述-如何干好开源这件事
Php+sql get the field name and detailed attributes of MySQL data table
Solutions to prompt non standard import in go language
list_ head
simple_strtoull字符转换相关函数
国外十款免费开源PHP网店程序介绍
C语言刷题 | 温度转换(11)
File upload attack and protection
通过docker安装mysql(5.7+8.0)并配置主从复制(GTID+增强半同步)
在ensp上做防火墙的双机热备
Unicode字符/静态非静态的访问
Variable things
Yiwen approaches ZMQ
Monaco editor format JSON, SQL
Node cannot recognize the 'node' entry as the name of a cmdlet, function, script file, or runnable program. Please check the spelling of the name. If the path is included, make sure the path is correc