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

Stéphane Graber stgraber at ubuntu.com
Wed Jun 18 04:24:27 UTC 2014


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?

> 
> The lxc-stable 1.0.4 builds fine though.
> 
> [1] https://www.archlinux.org/todo/remove-static-libraries/
> 
> Thanks in advance,
> -- 
> Leonid Isaev
> GPG fingerprints: DA92 034D B4A8 EC51 7EA6  20DF 9291 EE8A 043C B8C4
>                   C0DF 20D0 C075 C3F1 E1BE  775A A7AE F6CB 164B 5A6D



> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20140618/b87a566d/attachment-0001.sig>


More information about the lxc-users mailing list