When running a sandbox with a / different from the host one, we will need to copy all init-lxc dependencies into a mounted folder... but we have no way to tell libvirt to set the LD_LIBRARY_PATH for the init command.
Turning init-lxc all-static help us work around that problem, and drops the useless dependencies on glib and libvirt-sandbox. --- libvirt-sandbox/Makefile.am | 11 +---------- libvirt-sandbox/libvirt-sandbox-init-lxc.c | 8 ++++---- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/libvirt-sandbox/Makefile.am b/libvirt-sandbox/Makefile.am index b6fcdf7..1cd6ea3 100644 --- a/libvirt-sandbox/Makefile.am +++ b/libvirt-sandbox/Makefile.am @@ -202,22 +202,13 @@ libvirt_sandbox_init_lxc_CFLAGS = \ -DSANDBOXCONFIGDIR="\"$(sandboxconfigdir)\"" \ -I$(top_srcdir) \ -I$(top_builddir) \ - $(GIO_UNIX_CFLAGS) \ - $(LIBVIRT_GLIB_CFLAGS) \ - $(LIBVIRT_GOBJECT_CFLAGS) \ $(WARN_CFLAGS) \ $(NULL) libvirt_sandbox_init_lxc_LDFLAGS = \ - libvirt-sandbox-1.0.la \ + -all-static \ $(COVERAGE_CFLAGS:-f%=-Wc,f%) \ - $(GIO_UNIX_LIBS) \ - $(LIBVIRT_GLIB_LIBS) \ - $(LIBVIRT_GOBJECT_LIBS) \ $(WARN_CFLAGS) \ $(NULL) -libvirt_sandbox_init_lxc_LDADD = \ - libvirt-sandbox-1.0.la \ - $(NULL) libvirt_sandbox_init_qemu_SOURCES = libvirt-sandbox-init-qemu.c libvirt_sandbox_init_qemu_CFLAGS = \ diff --git a/libvirt-sandbox/libvirt-sandbox-init-lxc.c b/libvirt-sandbox/libvirt-sandbox-init-lxc.c index 61f46a1..798af37 100644 --- a/libvirt-sandbox/libvirt-sandbox-init-lxc.c +++ b/libvirt-sandbox/libvirt-sandbox-init-lxc.c @@ -28,8 +28,6 @@ #include <config.h> -#include <glib.h> - #include <stdio.h> #include <sys/wait.h> #include <termios.h> @@ -38,6 +36,8 @@ #include <string.h> #include <errno.h> +#define STRNEQ(x,y) (strcmp(x,y) != 0) + static void set_debug(void); static int has_command_arg(const char *name, char **val); @@ -45,7 +45,7 @@ static int has_command_arg(const char *name, static int debug = 0; int -main(int argc G_GNUC_UNUSED, char **argv G_GNUC_UNUSED) +main(int argc, char **argv) { const char *args[50]; int narg = 0; @@ -69,7 +69,7 @@ main(int argc G_GNUC_UNUSED, char **argv G_GNUC_UNUSED) args[narg++] = "/tmp/sandbox.log"; args[narg++] = "-f"; args[narg++] = "-ff"; - if (strace && !g_str_equal(strace, "1")) { + if (strace && STRNEQ(strace, "1")) { args[narg++] = "-e"; args[narg++] = strace; } -- 2.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list