[systemd-devel] [RFC 00/25] Compile against the musl libc

Emil Renner Berthing systemd at esmil.dk
Thu Sep 18 06:24:36 PDT 2014


Hi,

Around the internet one can read statements such as "systemd
is designed with glibc in mind" and "the systemd developers' idea
of a standard libc is one that has bug-for-bug compatibility with
glibc". So in a fit of naivety I decided to test this out and see
how much work it would take to make systemd work with musl.

The real reason is of course that I'd like to see systemd running
on my router and other small devices that usually run some OpenWRT
derivative.

This series makes systemd compile cleanly against musl 1.1.4 with
a minimal configuration and also fixes a few runtime errors. It is
only lightly tested and a few of patches could definitely be done
in a nicer, more generic way. Also I'd love to get even more stuff
working like eg. networkd and resolved. However I would like some
early feedback and see if this is something that could one day make
it upstream or I'm just wasting my time.

The first two patches are not strictly needed, but it makes the
compilation much quieter and they are correct according POSIX.

/Emil

Emil Renner Berthing (25):
  include poll.h rather than sys/poll.h
  include fcntl.h rather than sys/fcntl.h
  udev: link-config: remove unneded linux/netdevice.h include
  sd-rtnl: rtnl-message: remove unneeded linux includes
  shared/util.h: include sys/reg.h for __WORDSIZE
  shared/label.h: add missing stdio.h include
  shared/sparse-endian.h: add missing byteswap.h include
  don't fail if GLOB_BRACE is not defined
  shared/socket-util: don't fail if libc doesn't support IDN
  shared/pty: fall back to kernel header for TIOCSIG
  shared/missing.h: fall pack to insecure getenv
  shared/missing.h: check for missing canonicalize_file_name
  shared/missing.h: check for missing strndupa
  shared/missing.h: check for missing __compar_fn_t typedef
  shared/utmp-wtmp: don't fail if libc doesn't support utmpx/wtmpx
  add fallback parse_printf_format implementation
  dhcp-internal.h: add fallback IPTOS_CLASS_CS6 definition
  sd-ipv4all: fall back to random if no random_r
  mount-setup: skip relabelling when SELinux and SMACK not supported
  udevadm-hwdb: don't use glibc-specific qsort_r
  make sure basename that doesn't alter it's argument
  support POSIX strerror_r returning int
  mount: order options before other arguments to mount
  units: order options before other arguments
  add -z muldefs to linker flags

 Makefile.am                                        |   4 +
 configure.ac                                       |  10 +-
 man/sd_journal_get_fd.xml                          |   2 +-
 src/ask-password/ask-password.c                    |   2 +-
 src/bus-proxyd/bus-proxyd.c                        |   2 +-
 src/core/execute.c                                 |   8 +-
 src/core/load-fragment.c                           |   2 +-
 src/core/manager.c                                 |   4 +-
 src/core/mount-setup.c                             |   4 +
 src/core/mount.c                                   |   8 +-
 src/core/unit.c                                    |   6 +-
 src/delta/delta.c                                  |  14 +-
 src/initctl/initctl.c                              |   2 +-
 src/journal/journal-send.c                         |  38 ++-
 src/journal/journalctl.c                           |   2 +-
 src/journal/sd-journal.c                           |   2 +-
 src/libsystemd-network/dhcp-internal.h             |   4 +
 src/libsystemd-network/sd-ipv4ll.c                 |  25 +-
 src/libsystemd/sd-bus/bus-error.c                  |  14 +-
 src/libsystemd/sd-bus/bus-socket.c                 |   2 +-
 src/libsystemd/sd-bus/sd-bus.c                     |   2 +-
 src/libsystemd/sd-login/sd-login.c                 |   2 +-
 src/libsystemd/sd-login/test-login.c               |   2 +-
 src/libsystemd/sd-network/sd-network.c             |   2 +-
 src/libsystemd/sd-resolve/sd-resolve.c             |   2 +-
 src/libsystemd/sd-rtnl/rtnl-message.c              |   6 -
 src/libudev/libudev-monitor.c                      |   2 +-
 src/locale/localectl.c                             |   2 +-
 src/login/logind-inhibit.c                         |   2 +-
 src/login/logind-seat.c                            |   2 +-
 src/login/logind-session.c                         |   2 +-
 src/nspawn/nspawn.c                                |   2 +-
 src/readahead/readahead-collect.c                  |   2 +-
 src/reply-password/reply-password.c                |   2 +-
 src/resolve/resolved-manager.c                     |   2 +-
 src/shared/ask-password-api.c                      |   2 +-
 src/shared/cgroup-show.c                           |   4 +-
 src/shared/conf-files.c                            |   4 +-
 src/shared/install.c                               |  14 +-
 src/shared/label.h                                 |   1 +
 src/shared/log.c                                   |   2 +-
 src/shared/logs-show.c                             |   2 +-
 src/shared/missing.h                               |  24 +-
 src/shared/parse-printf-format.c                   | 273 +++++++++++++++++++++
 src/shared/parse-printf-format.h                   |  57 +++++
 src/shared/path-util.c                             |   8 +
 src/shared/path-util.h                             |   5 +
 src/shared/pty.c                                   |   5 +
 src/shared/socket-util.c                           |  10 +
 src/shared/sparse-endian.h                         |   1 +
 src/shared/spawn-polkit-agent.c                    |   2 +-
 src/shared/util.c                                  |  12 +-
 src/shared/util.h                                  |   1 +
 src/shared/utmp-wtmp.c                             |  10 +-
 src/shutdownd/shutdownd.c                          |   2 +-
 src/socket-proxy/socket-proxyd.c                   |   2 +-
 src/systemctl/systemctl.c                          |  12 +-
 src/sysv-generator/sysv-generator.c                |   4 +-
 src/test/test-install.c                            |  18 +-
 src/test/test-path-util.c                          |   8 +-
 src/tmpfiles/tmpfiles.c                            |   6 +
 .../tty-ask-password-agent.c                       |   2 +-
 src/udev/net/link-config.c                         |   1 -
 src/udev/udev-ctrl.c                               |   2 +-
 src/udev/udev-event.c                              |   2 +-
 src/udev/udevadm-hwdb.c                            |  16 +-
 src/udev/udevadm-settle.c                          |   2 +-
 src/udev/udevadm-test-builtin.c                    |   2 +-
 src/udev/udevd.c                                   |   2 +-
 units/initrd-udevadm-cleanup-db.service.in         |   2 +-
 units/kmod-static-nodes.service.in                 |   2 +-
 units/systemd-journal-flush.service.in             |   2 +-
 units/systemd-udev-hwdb-update.service.in          |   2 +-
 units/systemd-udev-trigger.service.in              |   2 +-
 74 files changed, 591 insertions(+), 126 deletions(-)
 create mode 100644 src/shared/parse-printf-format.c
 create mode 100644 src/shared/parse-printf-format.h

-- 
2.1.0



More information about the systemd-devel mailing list