[libvirt] [PATCH] tools: Link libvirt.la to libvirt_shell.a

So, our mingw build is broken. It's because while libvirt_shell library is using some of our internal APIs, e.g. virStrndup, it's not being linked with libvirt.la. Only subsequent users of the library, like virsh, do link to libvirt.la. In fact, I'm surprised Linux linker doesn't care, because how can it make a static library with missing symbols is mystery to me. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- tools/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Makefile.am b/tools/Makefile.am index 0a00cee..3cf70db 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -143,6 +143,7 @@ libvirt_shell_la_LDFLAGS = \ $(NULL) libvirt_shell_la_LIBADD = \ $(LIBXML_LIBS) \ + ../src/libvirt.la \ ../gnulib/lib/libgnu.la \ $(NULL) libvirt_shell_la_SOURCES = vsh.c vsh.h @@ -220,7 +221,6 @@ virsh_LDFLAGS = \ virsh_LDADD = \ $(STATIC_BINARIES) \ $(PIE_LDFLAGS) \ - ../src/libvirt.la \ ../src/libvirt-lxc.la \ ../src/libvirt-qemu.la \ libvirt_shell.la \ -- 2.4.9

On 25/09/15 13:38, Michal Privoznik wrote:
So, our mingw build is broken. It's because while libvirt_shell library is using some of our internal APIs, e.g. virStrndup, it's not being linked with libvirt.la. Only subsequent users of the library, like virsh, do link to libvirt.la. In fact, I'm surprised Linux linker doesn't care, because how can it make a static library with missing symbols is mystery to me.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- tools/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/Makefile.am b/tools/Makefile.am index 0a00cee..3cf70db 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -143,6 +143,7 @@ libvirt_shell_la_LDFLAGS = \ $(NULL) libvirt_shell_la_LIBADD = \ $(LIBXML_LIBS) \ + ../src/libvirt.la \ ../gnulib/lib/libgnu.la \ $(NULL) libvirt_shell_la_SOURCES = vsh.c vsh.h @@ -220,7 +221,6 @@ virsh_LDFLAGS = \ virsh_LDADD = \ $(STATIC_BINARIES) \ $(PIE_LDFLAGS) \ - ../src/libvirt.la \ ../src/libvirt-lxc.la \ ../src/libvirt-qemu.la \ libvirt_shell.la \
There is also this little thing, we also link virsh against VIRSH_LIBS which are just READLINE_LIBS and in fact, it can be a bit confusing too = it really gave me some hard time to link virt-admin (devel version) without any error. Since VIRSH_LIBS isn't used anywhere else, I suggest going with READLINE_LIBS only and squashing also this snippet to your patch: diff --git a/configure.ac b/configure.ac index 03463b0..2d0603d 100644 --- a/configure.ac +++ b/configure.ac @@ -1670,10 +1670,6 @@ if test "$with_pm_utils" = "yes"; then fi AM_CONDITIONAL([WITH_PM_UTILS], [test "$with_pm_utils" = "yes"]) -dnl virsh libraries -VIRSH_LIBS="$VIRSH_LIBS $READLINE_LIBS" -AC_SUBST([VIRSH_LIBS]) - dnl check if the network driver should be compiled AC_ARG_WITH([network], diff --git a/tools/Makefile.am b/tools/Makefile.am index 3cf70db..d5638d9 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -143,6 +143,7 @@ libvirt_shell_la_LDFLAGS = \ $(NULL) libvirt_shell_la_LIBADD = \ $(LIBXML_LIBS) \ + $(READLINE_LIBS) \ ../src/libvirt.la \ ../gnulib/lib/libgnu.la \ $(NULL) @@ -223,8 +224,7 @@ virsh_LDADD = \ $(PIE_LDFLAGS) \ ../src/libvirt-lxc.la \ ../src/libvirt-qemu.la \ - libvirt_shell.la \ - $(VIRSH_LIBS) + libvirt_shell.la virsh_CFLAGS = \ $(WARN_CFLAGS) \ $(PIE_CFLAGS) \ ACK with this small adjustment. Btw, thanks for cleaning up the mess after me :). Erik
participants (2)
-
Erik Skultety
-
Michal Privoznik