From: Hangbin Liu <liuhangbin@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org, David Ahern <dsahern@kernel.org>,
Andrea Claudi <aclaudi@redhat.com>, Ying Xu <yinxu@redhat.com>
Subject: Re: [PATCH iproute2] lib: move rtnl_echo_talk from libnetlink to utils
Date: Wed, 12 Jul 2023 11:11:46 +0800 [thread overview]
Message-ID: <ZK4Z8j7hFHcjWv1i@Laptop-X1> (raw)
In-Reply-To: <20230711090011.4e4c4fec@hermes.local>
On Tue, Jul 11, 2023 at 09:00:11AM -0700, Stephen Hemminger wrote:
> On Tue, 11 Jul 2023 15:31:17 +0800
> Hangbin Liu <liuhangbin@gmail.com> wrote:
>
> > In commit 6c09257f1bf6 ("rtnetlink: add new function rtnl_echo_talk()"),
> > some json obj functions were exported in libnetlink. Which cause build
> > error like:
> > /usr/bin/ld: /tmp/cc6YaGBM.o: in function `rtnl_echo_talk':
> > libnetlink.c:(.text+0x25bd): undefined reference to `new_json_obj'
> > /usr/bin/ld: libnetlink.c:(.text+0x25c7): undefined reference to `open_json_object'
> > /usr/bin/ld: libnetlink.c:(.text+0x25e3): undefined reference to `close_json_object'
> > /usr/bin/ld: libnetlink.c:(.text+0x25e8): undefined reference to `delete_json_obj'
> > collect2: error: ld returned 1 exit status
> >
> > Commit 6d68d7f85d8a ("testsuite: fix build failure") only fixed this issue
> > for iproute building. But if other applications include the libnetlink.a,
> > they still have this problem, because libutil.a is not exported to the
> > LDLIBS. So let's move the rtnl_echo_talk() from libnetlink.c to utils.c
> > to avoid this issue.
> >
> > After the fix, we can also remove the update by c0a06885b944 ("testsuite: fix
> > testsuite build failure when iproute build without libcap-devel").
> >
> > Reported-by: Ying Xu <yinxu@redhat.com>
> > Fixes: 6c09257f1bf6 ("rtnetlink: add new function rtnl_echo_talk()")
> > Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
>
> I don't see this when iproute2 is built.
Yes, because commit 6d68d7f85d8a fixed this for iproute2.
> Libnetlink is not a public API. And there is no guarantee about
OK..
> compatibility if an application links with it. Collect2 should be
> using a supported library like libmnl instea.
It's not about compatibility. If an application linked with netlink.a, the
build will failed. e.g.
# cat test.c
#include <libnetlink.h>
int main()
{
struct rtnl_handle rth = { .dump = 123456, };
rtnl_close(&rth);
return 0;
}
# cc test.c -lnetlink -lmnl
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libnetlink.a(libnetlink.o): in function `rtnl_echo_talk':
(.text[.text.group]+0x1f78): undefined reference to `new_json_obj'
/usr/bin/ld: (.text[.text.group]+0x1f7f): undefined reference to `open_json_object'
/usr/bin/ld: (.text[.text.group]+0x1f94): undefined reference to `close_json_object'
/usr/bin/ld: (.text[.text.group]+0x1f99): undefined reference to `delete_json_obj'
collect2: error: ld returned 1 exit status
Thanks
Hangbin
next prev parent reply other threads:[~2023-07-12 3:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 7:31 [PATCH iproute2] lib: move rtnl_echo_talk from libnetlink to utils Hangbin Liu
2023-07-11 16:00 ` Stephen Hemminger
2023-07-12 3:11 ` Hangbin Liu [this message]
2023-07-13 22:28 ` Stephen Hemminger
2023-07-14 3:28 ` Hangbin Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZK4Z8j7hFHcjWv1i@Laptop-X1 \
--to=liuhangbin@gmail.com \
--cc=aclaudi@redhat.com \
--cc=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
--cc=yinxu@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox