From: Evgeny Vereshchagin Date: Mon, 12 Apr 2021 04:19:11 +0000 (+0000) Subject: ci: link lib[au]san with init.lxc.static statically X-Git-Tag: lxc-5.0.0~200^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b8b83572b23cd9bed40d5cabf17466c4f3f3fe2;p=thirdparty%2Flxc.git ci: link lib[au]san with init.lxc.static statically init.lxc.static is run in arbitrary containers where the libasan library lxc has been built with isn't always installed. To make it work let's override GCC's default and link both libasan and libubsan statically. It should help to fix issues like ``` ++ lxc-execute -n c1 -- sudo -u ubuntu /nnptest lxc-init: error while loading shared libraries: libasan.so.5: cannot open shared object file: No such file or directory ``` Signed-off-by: Evgeny Vereshchagin --- diff --git a/.github/workflows/lxc-exercise b/.github/workflows/lxc-exercise index b7da20764..45b3b914c 100755 --- a/.github/workflows/lxc-exercise +++ b/.github/workflows/lxc-exercise @@ -72,6 +72,16 @@ apt-get install --yes --no-install-recommends \ python3-setuptools rsync squashfs-tools uidmap unzip uuid-runtime \ wget xz-utils +# init.lxc.static is run in arbitrary containers where the libasan library lxc has been built with +# isn't always installed. To make it work let's override GCC's default and link both libasan +# and libubsan statically. It should help to fix issues like +# ... +# ++ lxc-execute -n c1 -- sudo -u ubuntu /nnptest +# lxc-init: error while loading shared libraries: libasan.so.5: cannot open shared object file: No such file or directory +if [[ "$CC" == "gcc" ]]; then + sed -i '/init_lxc_static_LDFLAGS/s/$/ -static-libasan -static-libubsan/' src/lxc/Makefile.am +fi + ./autogen.sh CFLAGS=-fsanitize=address,undefined ./configure --enable-tests --prefix=/usr/ --sysconfdir=/etc/ --localstatedir=/var/ --disable-no-undefined make