3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/os-specific/linux/lxc/default.nix
aszlig 2a894cd2d1
lxc: Fix build error with glibc 2.26
This issue doesn't necessarily have to do with glibc 2.26 and it could
have been fixed if we'd replace -Werror with -Wall.

The error in question was:

storage/overlay.c:808:13: error: 'dirlen' may be used uninitialized in
this function [-Werror=maybe-uninitialized]

After looking at the code in overlay.c it indeed might use dirlen
unitialized.

Unrelated to the glibc upgrade which brought the problem to the surface,
this also has been fixed upstream at lxc/lxc@180c477a32.

The reason however, that led to the upstream fix was a segfault which
has been reported at lxc/lxc#1802.

Signed-off-by: aszlig <aszlig@nix.build>
Cc: @wkennington, @globin, @fpletz
2017-11-09 02:21:00 +01:00

105 lines
3.4 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ stdenv, fetchurl, fetchpatch, autoreconfHook, pkgconfig, perl, docbook2x
, docbook_xml_dtd_45, python3Packages
# Optional Dependencies
, libapparmor ? null, gnutls ? null, libselinux ? null, libseccomp ? null
, cgmanager ? null, libnih ? null, dbus ? null, libcap ? null, systemd ? null
}:
let
enableCgmanager = cgmanager != null && libnih != null && dbus != null;
in
with stdenv.lib;
stdenv.mkDerivation rec {
name = "lxc-${version}";
version = "2.1.0";
src = fetchurl {
url = "https://linuxcontainers.org/downloads/lxc/lxc-${version}.tar.gz";
sha256 = "1qld0gi19mximxm0qyr6vzav32gymhc7fvp0bzwv37j0b8q0fi1r";
};
nativeBuildInputs = [
autoreconfHook pkgconfig perl docbook2x python3Packages.wrapPython
];
buildInputs = [
libapparmor gnutls libselinux libseccomp cgmanager libnih dbus libcap
python3Packages.python python3Packages.setuptools systemd
];
patches = [
./support-db2x.patch
# Fix build error against glibc 2.26
(fetchpatch {
url = "https://github.com/lxc/lxc/commit/"
+ "180c477a326ce85632249ff16990e8c29db1b6fa.patch";
sha256 = "05jkiiixxk9ibj1fwzmy56rkkign28bd9mrmgiz12g92r2qahm2z";
})
];
postPatch = ''
sed -i '/chmod u+s/d' src/lxc/Makefile.am
'';
XML_CATALOG_FILES = "${docbook_xml_dtd_45}/xml/dtd/docbook/catalog.xml";
# FIXME
# glibc 2.25 moved major()/minor() to <sys/sysmacros.h>.
# this commit should detect this: https://github.com/lxc/lxc/pull/1388/commits/af6824fce9c9536fbcabef8d5547f6c486f55fdf
# However autotools checks if mkdev is still defined in <sys/types.h> runs before
# checking if major()/minor() is defined there. The mkdev check succeeds with
# a warning and the check which should set MAJOR_IN_SYSMACROS is skipped.
NIX_CFLAGS_COMPILE = [ "-DMAJOR_IN_SYSMACROS" ];
configureFlags = [
"--localstatedir=/var"
"--sysconfdir=/etc"
"--disable-api-docs"
"--with-init-script=none"
"--with-distro=nixos" # just to be sure it is "unknown"
] ++ optional (libapparmor != null) "--enable-apparmor"
++ optional (libselinux != null) "--enable-selinux"
++ optional (libseccomp != null) "--enable-seccomp"
++ optional (libcap != null) "--enable-capabilities"
++ [
"--disable-examples"
"--enable-python"
"--disable-lua"
"--enable-bash"
(if doCheck then "--enable-tests" else "--disable-tests")
"--with-rootfs-path=/var/lib/lxc/rootfs"
];
doCheck = false;
installFlags = [
"localstatedir=\${TMPDIR}"
"sysconfdir=\${out}/etc"
"sysconfigdir=\${out}/etc/default"
"bashcompdir=\${out}/share/bash-completion/completions"
"READMEdir=\${TMPDIR}/var/lib/lxc/rootfs"
"LXCPATH=\${TMPDIR}/var/lib/lxc"
];
postInstall = ''
wrapPythonPrograms
'';
meta = {
homepage = https://linuxcontainers.org/;
description = "Userspace tools for Linux Containers, a lightweight virtualization system";
license = licenses.lgpl21Plus;
longDescription = ''
LXC is the userspace control package for Linux Containers, a
lightweight virtual system mechanism sometimes described as
"chroot on steroids". LXC builds up from chroot to implement
complete virtual systems, adding resource management and isolation
mechanisms to Linuxs existing process management infrastructure.
'';
platforms = platforms.linux;
maintainers = with maintainers; [ wkennington globin fpletz ];
};
}