Closed kostadinsh closed 1 year ago
fixed by 4c681e77075af34e890c2946c3d17d33c9c8a10d.
Thanks.
Nice that mold warns about such errors.
I've just tested again with a fresh clone of the repo without the --fatal-warnings
flag, and a couple more appear. I guess when I was building with that option the build failed before these symbols were used. I am also attaching the complete log.
libtool: link: gcc -shared -fPIC -DPIC lib/fib_lookup/.libs/libnl_route_3_la-lookup.o lib/fib_lookup/.libs/libnl_route_3_la-request.o lib/route/.libs/libnl_route_3_la-act.o lib/route/act/.libs/libnl_route_3_la-gact.o lib/route/act/.libs/libnl_route_3_la-mirred.o lib/route/act/.libs/libnl_route_3_la-nat.o lib/route/act/.libs/libnl_route_3_la-skbedit.o lib/route/act/.libs/libnl_route_3_la-vlan.o lib/route/.libs/libnl_route_3_la-addr.o lib/route/.libs/libnl_route_3_la-class.o lib/route/.libs/libnl_route_3_la-classid.o lib/route/.libs/libnl_route_3_la-cls.o lib/route/cls/.libs/libnl_route_3_la-basic.o lib/route/cls/.libs/libnl_route_3_la-cgroup.o lib/route/cls/.libs/libnl_route_3_la-ematch.o lib/route/cls/ematch/.libs/libnl_route_3_la-cmp.o lib/route/cls/ematch/.libs/libnl_route_3_la-container.o lib/route/cls/ematch/.libs/libnl_route_3_la-meta.o lib/route/cls/ematch/.libs/libnl_route_3_la-nbyte.o lib/route/cls/ematch/.libs/libnl_route_3_la-text.o lib/route/cls/.libs/libnl_route_3_la-flower.o lib/route/cls/.libs/libnl_route_3_la-fw.o lib/route/cls/.libs/libnl_route_3_la-mall.o lib/route/cls/.libs/libnl_route_3_la-police.o lib/route/cls/.libs/libnl_route_3_la-u32.o lib/route/.libs/libnl_route_3_la-link.o lib/route/link/.libs/libnl_route_3_la-api.o lib/route/link/.libs/libnl_route_3_la-bonding.o lib/route/link/.libs/libnl_route_3_la-bridge.o lib/route/link/.libs/libnl_route_3_la-bridge_info.o lib/route/link/.libs/libnl_route_3_la-can.o lib/route/link/.libs/libnl_route_3_la-dummy.o lib/route/link/.libs/libnl_route_3_la-geneve.o lib/route/link/.libs/libnl_route_3_la-ifb.o lib/route/link/.libs/libnl_route_3_la-inet.o lib/route/link/.libs/libnl_route_3_la-inet6.o lib/route/link/.libs/libnl_route_3_la-ip6gre.o lib/route/link/.libs/libnl_route_3_la-ip6tnl.o lib/route/link/.libs/libnl_route_3_la-ip6vti.o lib/route/link/.libs/libnl_route_3_la-ipgre.o lib/route/link/.libs/libnl_route_3_la-ipip.o lib/route/link/.libs/libnl_route_3_la-ipvlan.o lib/route/link/.libs/libnl_route_3_la-ipvti.o lib/route/link/.libs/libnl_route_3_la-macsec.o lib/route/link/.libs/libnl_route_3_la-macvlan.o lib/route/link/.libs/libnl_route_3_la-ppp.o lib/route/link/.libs/libnl_route_3_la-sit.o lib/route/link/.libs/libnl_route_3_la-sriov.o lib/route/link/.libs/libnl_route_3_la-team.o lib/route/link/.libs/libnl_route_3_la-veth.o lib/route/link/.libs/libnl_route_3_la-vlan.o lib/route/link/.libs/libnl_route_3_la-vrf.o lib/route/link/.libs/libnl_route_3_la-vxlan.o lib/route/link/.libs/libnl_route_3_la-xfrmi.o lib/route/.libs/libnl_route_3_la-mdb.o lib/route/.libs/libnl_route_3_la-neigh.o lib/route/.libs/libnl_route_3_la-neightbl.o lib/route/.libs/libnl_route_3_la-netconf.o lib/route/.libs/libnl_route_3_la-nexthop.o lib/route/.libs/libnl_route_3_la-nexthop_encap.o lib/route/.libs/libnl_route_3_la-nh.o lib/route/.libs/libnl_route_3_la-nh_encap_mpls.o lib/route/.libs/libnl_route_3_la-pktloc.o lib/route/.libs/libnl_route_3_la-qdisc.o lib/route/qdisc/.libs/libnl_route_3_la-blackhole.o lib/route/qdisc/.libs/libnl_route_3_la-cbq.o lib/route/qdisc/.libs/libnl_route_3_la-dsmark.o lib/route/qdisc/.libs/libnl_route_3_la-fifo.o lib/route/qdisc/.libs/libnl_route_3_la-fq_codel.o lib/route/qdisc/.libs/libnl_route_3_la-hfsc.o lib/route/qdisc/.libs/libnl_route_3_la-htb.o lib/route/qdisc/.libs/libnl_route_3_la-ingress.o lib/route/qdisc/.libs/libnl_route_3_la-mqprio.o lib/route/qdisc/.libs/libnl_route_3_la-netem.o lib/route/qdisc/.libs/libnl_route_3_la-plug.o lib/route/qdisc/.libs/libnl_route_3_la-prio.o lib/route/qdisc/.libs/libnl_route_3_la-red.o lib/route/qdisc/.libs/libnl_route_3_la-sfq.o lib/route/qdisc/.libs/libnl_route_3_la-tbf.o lib/route/.libs/libnl_route_3_la-route.o lib/route/.libs/libnl_route_3_la-route_obj.o lib/route/.libs/libnl_route_3_la-route_utils.o lib/route/.libs/libnl_route_3_la-rtnl.o lib/route/.libs/libnl_route_3_la-rule.o lib/route/.libs/libnl_route_3_la-tc.o lib/route/cls/.libs/libnl_route_3_la-ematch_grammar.o lib/route/cls/.libs/libnl_route_3_la-ematch_syntax.o lib/route/.libs/libnl_route_3_la-pktloc_grammar.o lib/route/.libs/libnl_route_3_la-pktloc_syntax.o -Wl,-rpath -Wl,/home/kshishmanov/libnl/lib/.libs lib/.libs/libnl-3.so -lpthread -g -O2 -Wl,--version-script=./libnl-route-3.sym -fuse-ld=mold -Wl,-soname -Wl,libnl-route-3.so.200 -o lib/.libs/libnl-route-3.so.200.26.0
mold: warning: ./libnl-route-3.sym: cannot assign version `libnl_3_8` to symbol `rtnl_nh_clone`: symbol not found
mold: warning: ./libnl-route-3.sym: cannot assign version `libnl_3_8` to symbol `rtnl_nh_compare`: symbol not found
mold: warning: ./libnl-route-3.sym: cannot assign version `libnl_3_8` to symbol `rtnl_nh_dump`: symbol not found
fixed that too by f475c3b2b10dbab2dde8128e12b4187eafb9c12a. thanks!!
I tried to enable a test in github actions, but it doesn't seem to fail. See https://github.com/thom311/libnl/actions/runs/5749583232/job/15584671802, the "Link with mold" step passes (although it shouldn't). Logfile here. The test does:
- name: Link with mold
run: |
sudo apt-get -y --no-install-recommends install \
mold
git clean -fdx
export LDFLAGS="-fuse-ld=mold -Wl,--fatal-warnings"
./autogen.sh
./configure
make -j 5 V=1
Could that depend on the mold version? This is ubuntu 22.04, mold-1.0.3+dfsg-2
Any idea?
I did some limited amount of testing, and from what I could find out, the first version that emitted the warnings at all was v1.8.0.
https://github.com/rui314/mold/releases/tag/v1.8.0
You could also try adding-Wl,--no-undefined-version,--fatal-warnings
to the LDFLAGS in your clang builds, lld should warn about the same thing too, this has become the default behavior with LLVM/lld 16.
thank you. Very helpful!!
I'll see to add a test for that.
You are welcome! :-)
I just checked and the --no-undefined-version
flag should also be available with GCC/ld, so it is up to you to see which one would work out best for you. :D
I did https://github.com/thom311/libnl/commit/391063096b5091a1b61dff8e5b4a9a49b01f5abe
Thanks again for your pointers.
@thom311 Could I trouble you for a new release perhaps? The patches don't apply cleanly (I admit they're probably easy to rebase though) so figured it was worth asking.
a new release will happen soon.
Thank you!
It seems that libnl has some issues during the linking phase regarding a symbol not being found when building with the mold linker. I've turned mold's warnings into errors with -Wl,--fatal-warnings, so I can catch them more easily. Below is the last couple of lines from the build log, and I am also adding the complete log as an attachment.
libnl source used is cbafad9ddf24caef5230fef715d34f0539603be0 mold used is commit
b04aba89d3a1931470983212925443e7aefca1e1
gcc (Gentoo 13.1.1_p20230527 p3) 13.1.1 20230527Steps to reproduce:
cd
into itexport LDFLAGS="-fuse-ld=mold -Wl,--fatal-warnings"
autoreconf -vfi
and./configure --prefix=/usr
make V=1
libnl-github.log