【LEDE】x86软路由之路-07-GCC编译失败(glibc2.26)

在x86_64架构上用OpenWrt SDK编译gcc时遇到错误。通过查看GitHub上的issue找到了解决方案,即修改libgcc的源文件md-unwind-support.h,将struct ucontext替换为ucontext_t以兼容glibc2.26。重新编译后,二进制文件运行正常。建议除非必要,否则最好采用打补丁的方式来解决此类问题。
摘要由CSDN通过智能技术生成

架构x86_64

在使用OpenWrt SDK编译gcc package的时候,报如下错误:

i486-openwrt-linux-gnu-gcc -g -O2 -g -Os -O2 -g -O2 -g -Os -DIN_GCC -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -mlong-double-80 -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fpic -mlong-double-80 -I. -I. -I../../host-i486-openwrt-linux-gnu/gcc -I../.././libgcc -I../.././libgcc/. -I../.././libgcc/../gcc -I../.././libgcc/../include -DHAVE_CC_TLS -DUSE_TLS -o unwind-dw2.o -MT unwind-dw2.o -MD -MP -MF unwind-dw2.dep -fexceptions -c ../.././libgcc/unwind-dw2.c -fvisibility=hidden -DHIDE_EXPORTS
cc1: note: someone does not honour COPTS correctly, passed 0 times
In file included from ../.././libgcc/unwind-dw2.c:401:0:
./md-unwind-support.h: In function 'x86_fallback_frame_state':
./md-unwind-support.h:141:18: error: field 'uc' has incomplete type
struct ucontext uc;
^~
../.././libgcc/shared-object.mk:14: recipe for target 'unwind-dw2.o' failed
make[5]: *** [unwind-dw2.o] Error 1
make[5]: Leaving directory '/home/wang/Desktop/openwrt-x86/build_dir/target-i386_pentium4_glibc/gcc-5.4.0/i486-openwrt-linux-gnu/libgcc'
Makefile:12262: recipe for target 'all-target-libgcc' failed
make[4]: *** [all-target-libgcc] Error 2
make[4]: Leaving directory '/home/wang/Desktop/openwrt-x86/build_dir/target-i386_pentium4_glibc/gcc-5.4.0'
Makefile:879: recipe for target 'all' failed
make[3]: *** [all] Error 2
make[3]: Leaving directory '/home/wang/Desktop/openwrt-x86/build_dir/target-i386_pentium4_glibc/gcc-5.4.0'
Makefile:176: recipe for target '/home/wang/Desktop/openwrt-x86/build_dir/target-i386_pentium4_glibc/gcc-5.4.0/.built' failed
make[2]: *** [/home/wang/Desktop/openwrt-x86/build_dir/target-i386_pentium4_glibc/gcc-5.4.0/.built] Error 2
make[2]: Leaving directory '/home/wang/Desktop/openwrt-x86/feeds/packages/devel/gcc'
Command exited with non-zero status 2
time: package/feeds/packages/gcc/compile#1.49#1.08#19.61
package/Makefile:107: recipe for target 'package/feeds/packages/gcc/compile' failed
make[1]: *** [package/feeds/packages/gcc/compile] Error 2
make[1]: Leaving directory '/home/wang/Desktop/openwrt-x86'
/home/wang/Desktop/openwrt-x86/include/toplevel.mk:216: recipe for target 'package/gcc/compile' failed
make: *** [package/gcc/compile] Erro
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值