记录遇到的问题以及解决方法

博客内容涉及在编译openwrt工具链时遇到的警告及解决方法,包括环境变量设置、重定向输出、在64位系统上编译、处理宽DHCPv6编译错误、解决flex库找不到问题、configure生成Makefile时的依赖包安装,以及编译.hpp文件和中文编码转换等常见问题。

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

1. 在使用openwrt编译工具链编译测试程序。

(/opt/toolchain_mspdc2k/bin/arm-openwrt-linux-gcc main.c -o test)

警告信息:

arm-openwrt-linux-gcc: warning: environment variable "STAGING_DIR" not defined
arm-openwrt-linux-gcc: warning: environment variable "STAGING_DIR" not defined
arm-openwrt-linux-gcc: warning: environment variable "STAGING_DIR" not defined
/opt/toolchain_mspdc2k/lib/gcc/arm-openwrt-linux-gnueabi/4.5.4/../../../../arm-openwrt-linux-gnueabi/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc
/opt/toolchain_mspdc2k/lib/gcc/arm-openwrt-linux-gnueabi/4.5.4/../../../../arm-openwrt-linux-gnueabi/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc
/opt/toolchain_mspdc2k/lib/gcc/arm-openwrt-linux-gnueabi/4.5.4/../../../../arm-openwrt-linux-gnueabi/bin/ld: skipping incompatible /usr/lib/libc_nonshared.a when searching for libc_nonshared.a

解决方法:将工具链的编译工具所在目录加入的环境变量中。

export STAGING_DIR=/opt/toolchain_mspdc2k/bin:$STAGING_DIR
/opt/toolchain_mspdc2k/bin/arm-openwrt-linux-gcc main.c -o test


2. 将输出与错误输出都重定向到一个文件。

./build.sh > a 2>&1


3. 在64-bit OS 上编译代码

error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory

用一下命令安装 libmpc2:i386

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值