openwrt dreambox 编译出错

在尝试编译openwrt为dreambox的过程中遇到了三个问题:1) 'gets' undeclared错误,通过在stdio.in.h中删除相关行解决;2) '::close'未声明的问题,通过在elf.cpp中引入unistd.h修复;3) 971-ocf_20080917.patch应用失败,手动删除随机部分。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、编译环境

sudo apt-get install subversion git flex g++ gawk zlib1g-dev libncurses5-dev

2、编译出错

a. ./stdio.h:456:1: error: 'gets' undeclared here (not in a function)

   进入相应的目录执行

   sed -i -e '/gets is a security/d' ./stdio.in.h

   http://www.openwrt.org.cn/bbs/forum.php?mod=viewthread&tid=13909

b.elf.cpp:68:5: error: '::close' has not been declared

修改 ./build_dir/host/mklibs/src/mklibs-readelf/elf.cpp


  1. #include "elf_data.hpp"

  2. #include <stdexcept>

  3. #include <fcntl.h>
  4. #include <sys/mman.h>
  5. #include <sys/stat.h>
复制代码
下面添加一行"#include <unistd.h>"成:

  1. #include "elf_data.hpp"

  2. #include <stdexcept>

  3. #include <fcntl.h>
  4. #include <sys/mman.h>
  5. #include <sys/stat.h>
  6. #include <unistd.h>
复制代码
解决问题。  

  https://dev.openwrt.org.cn/ticket/45

c.Applying /home/zzf/openwrt-dreambox/target/linux/generic/patches-2.6.32/971-ocf_20080917.patch using plaintext: 
patching file drivers/char/random.c
Hunk #1 succeeded at 139 with fuzz 2 (offset 10 lines).
Hunk #2 succeeded at 155 with fuzz 2 (offset 12 lines).
Hunk #3 FAILED at 724.
1 out of 3 hunks FAILED -- saving rejects to file drivers/char/random.c.rej

删除971-ocf_20080917.patch 下的random部分。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值