Ubuntu22.04编译报错

编译错误

以下错误都是我自己遇到的,参考网上的解决办法,有一些没有遇到,如果出现请自行搜索解决

libfakeroot.c:99:40: error: ‘_STAT_VER’ undeclared (first use in this function)
在libfakeroot.c 增加

#ifndef _STAT_VER
 #if defined (__aarch64__)
  #define _STAT_VER 0
 #elif defined (__x86_64__)
  #define _STAT_VER 1
 #else
  #define _STAT_VER 3
 #endif
#endif

c-stack.c:55:26: error: missing binary operator before token "(" 55 | #elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
进入c-stack.c的文件夹下

wget https://raw.githubusercontent.com/keyfour/openwrt/2722d51c5cf6a296b8ecf7ae09e46690403a6c3d/tools/m4/patches/011-fix-sigstksz.patch
patch c-stack.c < 011-fix-sigstksz.patch

gdbusauth.c:1302:11: error: ‘%s’ directive argument is null

if(line != NULL)
    debug_print ("SERVER: WaitingForBegin, read '%s'", line);

gdbusmessage.c:2702:30: error: ‘%s’ directive argument is null

if(signature_str!= NULL)
    tupled_signature_str = g_strdup_printf ("(%s)", signature_str);

(.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin)😦.text+0x0): first defined here
多个 dtc-lexer.l 文件中的

YYLTYPE yylloc;

改为

extern YYLTYPE yylloc;

gstlib下的文件引用错误,错误很多,使用了最笨的办法将\去掉就行了,以下只是一个文件的错误
video-enumtypes.c error: stray '' in program

\#include "video.h" 
\#include "video-format.h" 
\#include "video-color.h" 
\#include "video-info.h" 
\#include "video-dither.h" 
\#include "colorbalance.h" 
\#include "navigation.h" 
\#include "video-chroma.h" 
\#include "video-tile.h" 
\#include "video-converter.h" 
\#include "video-resampler.h" 
\#include "video-frame.h" 
\#include "video-scaler.h"

改为

#include "video.h" 
#include "video-format.h" 
#include "video-color.h" 
#include "video-info.h" 
#include "video-dither.h" 
#include "colorbalance.h" 
#include "navigation.h" 
#include "video-chroma.h" 
#include "video-tile.h" 
#include "video-converter.h" 
#include "video-resampler.h" 
#include "video-frame.h" 
#include "video-scaler.h"

Ubuntu22.04报错:

报错1:
c-stack.c:55:26: error: missing binary operator before token "(" 55 | #elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384

解决办法:
进入c-stack.c的文件夹下

wget https://raw.githubusercontent.com/keyfour/openwrt/2722d51c5cf6a296b8ecf7ae09e46690403a6c3d/tools/m4/patches/011-fix-sigstksz.patch

patch c-stack.c < 011-fix-sigstksz.patch

报错2:
failure_signal_handler.cc:138:32: error: no matching function for call to ‘max(long int, int)’
  138 |   size_t stack_size = (std::max(SIGSTKSZ, 65536) + page_mask) & ~page_mask;
      |                        ~~~~~~~~^~~~~~~~~~~~~~~~~

解决办法:
在failure_signal_handler.cc:138:修改为
size_t stack_size = (std::max((long int)SIGSTKSZ, (long int)65536) + page_mask) & ~page_mask;

报错3:
DTB报错

解决办法:
https://blog.youkuaiyun.com/wanpengpenga/article/details/122313358 

### Ubuntu 22.04 编译安装 yaml-cpp 教程 #### 准备工作 为了确保编译过程顺利,在开始之前需要更新系统的包列表并安装必要的依赖工具。 ```bash sudo apt update && sudo apt upgrade -y sudo apt install -y build-essential cmake git ``` #### 获取源码 通过 Git 克隆官方仓库获取最新版本的 `yaml-cpp` 源代码: ```bash git clone https://github.com/jbeder/yaml-cpp.git cd yaml-cpp ``` #### 创建构建目录 建议在一个独立的子目录内完成编译操作,这有助于保持项目结构清晰整洁。 ```bash mkdir build cd build ``` #### 配置 CMake 构建选项 可以指定是否生成共享库(`BUILD_SHARED_LIBS`)以及其他自定义设置。对于大多数应用场景而言,推荐启用此功能以便于后续程序调用[^3]。 ```bash cmake -DBUILD_SHARED_LIBS=ON .. ``` #### 执行编译与安装 一旦配置完毕即可运行 Make 命令启动实际编译流程;完成后利用超级用户权限将其部署到系统环境中去,并刷新动态链接器缓存以使更改生效。 ```bash make sudo make install sudo ldconfig ``` 如果遇到任何关于找不到头文件或其他类似的编译报错情况,则可能是因为缺少某些特定软件包的支持。此时可以根据具体提示信息补充相应的依赖项后再试一次上述步骤。 #### 测试验证 最后编写一段简单的测试代码确认安装成功与否: ```cpp #include <iostream> #include "yaml-cpp/yaml.h" int main() { YAML::Node config = YAML::LoadFile("example.yaml"); std::cout << config["name"].as<std::string>() << "\n"; } ``` 保存为 `.cpp` 文件并通过 g++ 或者 clang++ 来编译它,记得连接 `-lyaml-cpp` 库哦!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值