[lxc-users] The purpose of init.lxc.static

Serge Hallyn serge.hallyn at ubuntu.com
Wed Jun 18 14:08:00 UTC 2014


Quoting Stéphane Graber (stgraber at ubuntu.com):
> On Wed, Jun 18, 2014 at 12:19:14AM -0400, Leonid Isaev wrote:
> > Hi,
> > 
> > 	I couldn't find anything in the mailing lists and the commit message
> > (in commit 2d4b3e3) is rather terse. So, I wonder in which scenarios and why
> > init.lxc.static is necessary? There appears to be no ./configure flag which
> > disables this (like --disable-static).
> > 	The practical reason for this question is that Archlinux has recently
> > dropped static libs from most packages [1], and as a result, I can not build
> > the current git, AFAIU because of the -static flag:
> > ------
> > gcc -I../../src -DLXCROOTFSMOUNT=\"/usr/lib/lxc/rootfs\"
> > -DLXCPATH=\"/var/lib/lxc\" -DLXC_GLOBAL_CONF=\"/etc/lxc/lxc.conf\"
> > -DLXCINITDIR=\"/usr/lib\" -DLIBEXECDIR=\"/usr/lib\"
> > -DLXCTEMPLATEDIR=\"/usr/share/lxc/templates\" -DLOGPATH=\"/var/log/lxc\"
> > -DLXC_DEFAULT_CONFIG=\"/etc/lxc/default.conf\"
> > -DLXC_USERNIC_DB=\"/run/lxc/nics\" -DLXC_USERNIC_CONF=\"/etc/lxc/lxc-usernet\"
> > -DDEFAULT_CGROUP_PATTERN=\"/lxc/%n\" -DRUNTIME_PATH=\"/run\"
> > -DSBINDIR=\"/usr/bin\"     -DHAVE_SECCOMP  -march=x86-64 -mtune=generic -O1
> > -pipe -fstack-protector-all -fexceptions -fno-delete-null-pointer-checks
> > --param=ssp-buffer-size=4 -Wall -Werror -static
> > -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -o init.lxc.static lxc_init.o
> > error.o log.o utils.o caps.o  -lcap -lutil -lpthread -lcap 
> > /usr/bin/ld: cannot find -lcap
> > /usr/bin/ld: cannot find -lutil
> > /usr/bin/ld: cannot find -lcap
> > collect2: error: ld returned 1 exit status
> > Makefile:877: recipe for target 'init.lxc.static' failed
> > ------
> > 
> > There are no libcap.a (from libcap-2.24) and libutil.a (from glibc-2.19). In
> > the case of glibc, the static libs are actually shipped by the package (e.g.
> > libpthread.a), so it seems that libutils.a is not provided by upstream. The
> > libcap package has only shared libs.
> 
> Sounds like we really want a way to detect that case and turn off
> building the static init in that case.
> 
> The reason for the static init is to make lxc-execute work in all cases,
> including cases where the host architecture doesn't match the
> container's and cases where the container doesn't run the same libc as
> the host (or doesn't have a libc at all).
> 
> LXC has fallback code to look for the dynamically linked init.lxc, so
> there's no reason why the static one would be an hard dependency.
> 
> Serge?

Well the -lcap we can fix easily, but no -lutil?  That's a bit messed
up.  So perhaps we should simply have configure.ac check for the static
libraries ahead of time.  If there is no AM_FOO for that we can do our
own quick test.

Leonid are you up writing such a patch?

-serge


More information about the lxc-users mailing list