]> git.proxmox.com Git - mirror_lxc.git/commitdiff
ci: link lib[au]san with init.lxc.static statically
authorEvgeny Vereshchagin <evvers@ya.ru>
Mon, 12 Apr 2021 04:19:11 +0000 (04:19 +0000)
committerEvgeny Vereshchagin <evvers@ya.ru>
Mon, 12 Apr 2021 23:20:29 +0000 (23:20 +0000)
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 <evvers@ya.ru>
.github/workflows/lxc-exercise

index b7da2076442f5aa72f4973c2b8775adbc3a68217..45b3b914c13d8d861bc4b88380e5e30e45c2d3e0 100755 (executable)
@@ -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