当前位置:网站首页>编译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的程序,然后设置环境变量就行。
边栏推荐
- DOM programming
- ==Classic interview questions
- MySQL field attribute list sends a document for future reference
- IS_ ERR()
- Shengdun technology joined dragon lizard community to build a new open source ecosystem
- 接口抽象类的比较
- Alibaba big fish SMS interface PHP version, simplified version Alibaba big fish SMS sending interface PHP instance
- How C processes use non static methods
- Unicode characters / static non static access
- 一个老开源人的自述-如何干好开源这件事
猜你喜欢

OpenCV每日函数 直方图相关(3)

Common SQL statements in MySQL

Debian10 LVM逻辑卷

值(址)传递,看清名字,别掉沟里

MSSQL injection of SQL injection

5 interview questions, grasp the underlying principle of string!

Embedded development terminology concept summary

Manually mining XSS vulnerabilities

How C processes use non static methods

Network security Kali penetration learning how to conduct Nessus vulnerability detection
随机推荐
变量那些事
嵌入式开发专业术语概念汇总
Monaco editor format JSON, SQL
The circular queue is implemented in super detail. I understand it in a few seconds
使用ELK保存Syslog、Netflow日志和审计网络接口流量
Yiwen approaches ZMQ
traefik ingress实践
值(址)传递,看清名字,别掉沟里
Zabbix5系列-使用温湿度传感器监控机房温湿度 (二十)
container_ of
Fuzzy query and aggregate function
Phpexcel reads the contents of the xls/xlsx table and saves it as a CSV file
Machine learning | nltk_ Data download error |nltk's stopwords corpus download error solution
景联文科技:机器学习AI数据集产品汇总(三)
800+ PHP grammar and words are proficient only after you have used them
How C processes use non static methods
5 interview questions, grasp the underlying principle of string!
C语言刷题 | 判断某年是否只闰年(15)
==Classic interview questions
Solutions to prompt non standard import in go language