Bug#986746: systemd: Symbols are missing when building systemd by Clang

Shawn Chang citypw at hardenedlinux.org
Sun Apr 11 07:40:07 BST 2021


Package: systemd
Version: 241-7~deb10u7
Severity: serious
Tags: ftbfs
Justification: fails to build from source (but built successfully in the past)

Dear Maintainer,

Reproducible steps:
--------------------
# cat /etc/dpkg/buildflags.conf 
APPEND CFLAGS -O -fPIE  
APPEND CXXFLAGS -O -fPIE 
APPEND LDFLAGS -pie -fuse-ld=lld

# Add below to debian/rules
export CC=clang
export CXX=clang++

3 test cases will failed, you can ignore them by:
  1) Edit debian/rules, comment a few lines:
------------------------
ifeq (, $(filter nocheck, $(DEB_BUILD_OPTIONS)))
#       echo "01234567890123456789012345678901" > build-deb/machine-id
        # some tests hang under fakeroot, so disable fakeroot
#       env -u LD_PRELOAD SYSTEMD_MACHINE_ID_PATH=$(CURDIR)/build-deb/machine-id meson test -C build-deb $(TEST_TIMEOUT_MULTIPLIER) || ( \
        #
        env -u LD_PRELOAD  meson test -C build-deb $(TEST_TIMEOUT_MULTIPLIER) || ( \
------------------------
  2) Drop two patches(0001-util-lib-static-array-argument-sizes-are-apparently-.patch and test-bus-track.patch) into debian/patches:

diff --git a/src/basic/string-util.c b/src/basic/string-util.c
index 7c487fb9a3..9586b3940e 100644
--- a/src/basic/string-util.c
+++ b/src/basic/string-util.c
@@ -725,10 +725,17 @@ char *strreplace(const char *text, const char *old_string, const char *new_strin
         return ret;
 }

-static void advance_offsets(ssize_t diff, size_t offsets[static 2], size_t shift[static 2], size_t size) {
+static void advance_offsets(
+                ssize_t diff,
+                size_t offsets[2], /* note: we can't use [static 2] here, since this may be NULL */
+                size_t shift[static 2],
+                size_t size) {
+
         if (!offsets)
                 return;

+        assert(shift);
+
         if ((size_t) diff < offsets[0])
                 shift[0] += size;
         if ((size_t) diff < offsets[1])
@@ -844,8 +851,7 @@ char *strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {

         fclose(f);

-        free(*ibuf);
-        *ibuf = obuf;
+        free_and_replace(*ibuf, obuf);

         if (_isz)
                 *_isz = osz;
@@ -855,7 +861,7 @@ char *strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {
                 highlight[1] += shift[1];
         }

-        return obuf;
+        return *ibuf;
 }

 char *strextend_with_separator(char **x, const char *separator, ...) {

diff --git a/src/libsystemd/sd-bus/test-bus-track.c b/src/libsystemd/sd-bus/test-bus-track.c
index 68a0010368..57af185d46 100644
--- a/src/libsystemd/sd-bus/test-bus-track.c
+++ b/src/libsystemd/sd-bus/test-bus-track.c
@@ -49,6 +49,7 @@ int main(int argc, char *argv[]) {
         const char *unique;
         int r;

+       return 0;
         test_setup_logging(LOG_INFO);

         r = sd_event_default(&event);

  3) Add those two patch files's name into debian/patches/series

Begin to build the package:
# dpkg-buildpackage -rfakeroot -us -uc
....
....
....
make[1]: Entering directory '/opt/debian10/build/tmp/systemd-241'
dh_missing --sourcedir debian/install/deb --fail-missing
make[1]: Leaving directory '/opt/debian10/build/tmp/systemd-241'
   dh_strip -O--buildsystem=meson
   debian/rules override_dh_makeshlibs
make[1]: Entering directory '/opt/debian10/build/tmp/systemd-241'
sed 's/SHARED_LIB_VERSION/241/' debian/shlibs.local.in > debian/shlibs.local
dh_makeshlibs -plibudev1 --add-udeb=libudev1-udeb -- -c4
dpkg-gensymbols: error: some symbols or patterns disappeared in the symbols file: see diff output below
dpkg-gensymbols: warning: debian/libudev1/DEBIAN/symbols doesn't match completely debian/libudev1.symbols
--- debian/libudev1.symbols (libudev1_241-7~deb10u7_amd64)
+++ dpkg-gensymbolshwl7L5       2021-04-11 14:15:58.815007345 +0800
@@ -1,10 +1,10 @@
 libudev.so.1 libudev1 #MINVER#
 * Build-Depends-Package: libudev-dev
- LIBUDEV_183 at LIBUDEV_183 183
- LIBUDEV_189 at LIBUDEV_189 189
- LIBUDEV_196 at LIBUDEV_196 196
- LIBUDEV_199 at LIBUDEV_199 199
- LIBUDEV_215 at LIBUDEV_215 215
+#MISSING: 241-7~deb10u7# LIBUDEV_183 at LIBUDEV_183 183
+#MISSING: 241-7~deb10u7# LIBUDEV_189 at LIBUDEV_189 189
+#MISSING: 241-7~deb10u7# LIBUDEV_196 at LIBUDEV_196 196
+#MISSING: 241-7~deb10u7# LIBUDEV_199 at LIBUDEV_199 199
+#MISSING: 241-7~deb10u7# LIBUDEV_215 at LIBUDEV_215 215
  udev_device_get_action at LIBUDEV_183 183
  udev_device_get_devlinks_list_entry at LIBUDEV_183 183
  udev_device_get_devnode at LIBUDEV_183 183
dh_makeshlibs: failing due to earlier errors
make[1]: *** [debian/rules:295: override_dh_makeshlibs] Error 1
make[1]: Leaving directory '/opt/debian10/build/tmp/systemd-241'
make: *** [debian/rules:311: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2


-- Package-specific info:

-- System Information:
Debian Release: 10.9
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-16-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_HK.UTF-8, LC_CTYPE=en_HK.UTF-8 (charmap=UTF-8), LANGUAGE=en_HK:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages systemd depends on:
ii  adduser          3.118
ii  libacl1          2.2.53-4
ii  libapparmor1     2.13.2-10
ii  libaudit1        1:2.8.4-3
ii  libblkid1        2.33.1-0.1
ii  libc6            2.28-10
ii  libcap2          1:2.25-2
ii  libcryptsetup12  2:2.1.0-5+deb10u2
ii  libgcrypt20      1.8.4-5
ii  libgnutls30      3.6.7-4+deb10u6
ii  libgpg-error0    1.35-1
ii  libidn11         1.33-2.2
ii  libip4tc0        1.8.2-4
ii  libkmod2         26-1
ii  liblz4-1         1.8.3-1
ii  liblzma5         5.2.4-1
ii  libmount1        2.33.1-0.1
ii  libpam0g         1.3.1-5
ii  libseccomp2      2.3.3-4
ii  libselinux1      2.8-1+b1
ii  libsystemd0      241-7~deb10u7
ii  mount            2.33.1-0.1
ii  util-linux       2.33.1-0.1

Versions of packages systemd recommends:
ii  dbus            1.12.20-0+deb10u1
ii  libpam-systemd  241-7~deb10u7

Versions of packages systemd suggests:
pn  policykit-1        <none>
pn  systemd-container  <none>

Versions of packages systemd is related to:
pn  dracut           <none>
ii  initramfs-tools  0.133+deb10u1
ii  udev             241-7~deb10u7

-- no debconf information



More information about the Pkg-systemd-maintainers mailing list