gcc11编译quagga-1.2.4报错

文章描述了在编译Quagga1.2.4版本时遇到的链接器错误,涉及到多个模块中的`__packed`符号定义冲突。解决方法是通过修改configure脚本添加`--with-cflags=-fcommon`,但指出这可能会影响性能。
摘要由CSDN通过智能技术生成

报错:

  CCLD     libzebra.la
/usr/bin/ld: .libs/sockunion.o (symbol from plugin): in function `inet_sutop':
(.text+0x0): multiple definition of `__packed'; .libs/vty.o (symbol from plugin):(.text+0x0): first defined here
/usr/bin/ld: .libs/prefix.o (symbol from plugin): in function `prefix_bit':
(.text+0x0): multiple definition of `__packed'; .libs/vty.o (symbol from plugin):(.text+0x0): first defined here
/usr/bin/ld: .libs/if.o (symbol from plugin): in function `if_cmp_func':
(.text+0x0): multiple definition of `__packed'; .libs/vty.o (symbol from plugin):(.text+0x0): first defined here
/usr/bin/ld: .libs/table.o (symbol from plugin): in function `route_table_init_with_delegate':
(.text+0x0): multiple definition of `__packed'; .libs/vty.o (symbol from plugin):(.text+0x0): first defined here
/usr/bin/ld: .libs/filter.o (symbol from plugin): in function `show_ip_access_list_cmd':
(.text+0x0): multiple definition of `__packed'; .libs/vty.o (symbol from plugin):(.text+0x0): first defined here
/usr/bin/ld: .libs/routemap.o (symbol from plugin): in function `route_map_lookup_by_name':
(.text+0x0): multiple definition of `__packed'; .libs/vty.o (symbol from plugin):(.text+0x0): first defined here
/usr/bin/ld: .libs/stream.o (symbol from plugin): in function `stream_new':
(.text+0x0): multiple definition of `__packed'; .libs/vty.o (symbol from plugin):(.text+0x0): first defined here
/usr/bin/ld: .libs/plist.o (symbol from plugin): in function `ip_prefix_list_cmd':
(.text+0x0): multiple definition of `__packed'; .libs/vty.o (symbol from plugin):(.text+0x0): first defined here
/usr/bin/ld: .libs/zclient.o (symbol from plugin): in function `zclient_debug':
(.text+0x0): multiple definition of `__packed'; .libs/vty.o (symbol from plugin):(.text+0x0): first defined here
/usr/bin/ld: .libs/vrf.o (symbol from plugin): in function `vrf_table':
(.text+0x0): multiple definition of `__packed'; .libs/vty.o (symbol from plugin):(.text+0x0): first defined here
/usr/bin/ld: .libs/nexthop.o (symbol from plugin): in function `nexthop_same_no_recurse':
(.text+0x0): multiple definition of `__packed'; .libs/vty.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:502: libzebra.la] Error 1
make[3]: Leaving directory '/root/rpmbuild/BUILD/quagga-1.2.4/lib'
make[2]: *** [Makefile:430: all] Error 2
make[2]: Leaving directory '/root/rpmbuild/BUILD/quagga-1.2.4/lib'
make[1]: *** [Makefile:467: all-recursive] Error 1
make[1]: Leaving directory '/root/rpmbuild/BUILD/quagga-1.2.4'
make: *** [Makefile:399: all] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.0KSRYb (%build)

效果:

Quagga configuration
--------------------
quagga version          : 1.2.4
host operating system   : linux-gnu
source code location    : .
compiler                : gcc
compiler flags          : -fcommon -I/usr/include -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
make                    : make
linker flags            : -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -rdynamic -lcrypt  -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -lm -L/usr/lib64 -lnetsnmpmibs -lsensors -lm -lrpm -lrpmio -lnetsnmpagent -Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -lnetsnmp -lm -lssl -lssl -lcrypto -lrt -lcap -lreadline  -ltermcap -lm
state file directory    : /var/run/quagga
config file directory   : /etc/quagga
example directory       : /etc/quagga
user to run as        : quagga
group to run as        : quagga
group for vty sockets    : quaggavt
config file mask        : 0600
log file mask           : 0600
zebra protobuf enabled  : no

解决方式:

在configure入参中加入

--with-cflags=-fcommon 会有性能方面弊端

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值