Netdev List
 help / color / mirror / Atom feed
* [PATCH iproute2] testsuite: fix build failure
@ 2022-10-23 15:37 Andrea Claudi
  2022-10-24  2:32 ` Hangbin Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Andrea Claudi @ 2022-10-23 15:37 UTC (permalink / raw)
  To: netdev; +Cc: stephen, dsahern, liuhangbin

After commit 6c09257f1bf6 ("rtnetlink: add new function
rtnl_echo_talk()") "make check" results in:

$ make check

make -C testsuite
make -C iproute2 configure
make -C testsuite alltests
make -C tools
    CC       generate_nlmsg
/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
make[2]: *** [Makefile:6: generate_nlmsg] Error 1
make[1]: *** [Makefile:40: generate_nlmsg] Error 2
make: *** [Makefile:130: check] Error 2

This is due to json function calls included in libutil and not in
libnetlink. Fix this adding libutil.a to the tools Makefile, and linking
against libcap as required by libutil itself.

Fixes: 6c09257f1bf6 ("rtnetlink: add new function rtnl_echo_talk()")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
---
 testsuite/tools/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testsuite/tools/Makefile b/testsuite/tools/Makefile
index e3e771d7..e0162ccc 100644
--- a/testsuite/tools/Makefile
+++ b/testsuite/tools/Makefile
@@ -2,8 +2,8 @@
 CFLAGS=
 include ../../config.mk
 
-generate_nlmsg: generate_nlmsg.c ../../lib/libnetlink.c
-	$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -I../../include -I../../include/uapi -include../../include/uapi/linux/netlink.h -o $@ $^ -lmnl
+generate_nlmsg: generate_nlmsg.c ../../lib/libnetlink.a ../../lib/libutil.a
+	$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -I../../include -I../../include/uapi -include../../include/uapi/linux/netlink.h -o $@ $^ -lmnl -lcap
 
 clean:
 	rm -f generate_nlmsg
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH iproute2] testsuite: fix build failure
  2022-10-23 15:37 [PATCH iproute2] testsuite: fix build failure Andrea Claudi
@ 2022-10-24  2:32 ` Hangbin Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Hangbin Liu @ 2022-10-24  2:32 UTC (permalink / raw)
  To: Andrea Claudi; +Cc: netdev, stephen, dsahern

On Sun, Oct 23, 2022 at 05:37:11PM +0200, Andrea Claudi wrote:
> After commit 6c09257f1bf6 ("rtnetlink: add new function
> rtnl_echo_talk()") "make check" results in:
> 
> $ make check
> 
> make -C testsuite
> make -C iproute2 configure
> make -C testsuite alltests
> make -C tools
>     CC       generate_nlmsg
> /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
> make[2]: *** [Makefile:6: generate_nlmsg] Error 1
> make[1]: *** [Makefile:40: generate_nlmsg] Error 2
> make: *** [Makefile:130: check] Error 2
> 
> This is due to json function calls included in libutil and not in
> libnetlink. Fix this adding libutil.a to the tools Makefile, and linking
> against libcap as required by libutil itself.
> 
> Fixes: 6c09257f1bf6 ("rtnetlink: add new function rtnl_echo_talk()")
> Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
> ---
>  testsuite/tools/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/testsuite/tools/Makefile b/testsuite/tools/Makefile
> index e3e771d7..e0162ccc 100644
> --- a/testsuite/tools/Makefile
> +++ b/testsuite/tools/Makefile
> @@ -2,8 +2,8 @@
>  CFLAGS=
>  include ../../config.mk
>  
> -generate_nlmsg: generate_nlmsg.c ../../lib/libnetlink.c
> -	$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -I../../include -I../../include/uapi -include../../include/uapi/linux/netlink.h -o $@ $^ -lmnl
> +generate_nlmsg: generate_nlmsg.c ../../lib/libnetlink.a ../../lib/libutil.a
> +	$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -I../../include -I../../include/uapi -include../../include/uapi/linux/netlink.h -o $@ $^ -lmnl -lcap
>  
>  clean:
>  	rm -f generate_nlmsg
> -- 
> 2.37.3
> 

Thanks for the fix.

Acked-by: Hangbin Liu <liuhangbin@gmail.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-24  2:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-23 15:37 [PATCH iproute2] testsuite: fix build failure Andrea Claudi
2022-10-24  2:32 ` Hangbin Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox