flatpak / xdg-dbus-proxy

GNU Lesser General Public License v2.1
53 stars 21 forks source link

DBus-proxy fails to compile on musl-based systems #36

Closed AbsolutelyLudicrous closed 2 years ago

AbsolutelyLudicrous commented 4 years ago

Linux distribution and version

KISS Linux, rolling (source based, close to being LFS)

Flatpak version

1.6.0 and 1.6.1 were both tested

Description of problem

Building Flatpak fails due to dbus-proxy not compiling. This occurs both when using --without-system-dbus-proxy and --with-system-dbus-proxy; in the case of the latter, flatpak/xdg-dbus-proxy fails to compile in the same file.

Here's the text of the error message:

  CC       dbus-proxy/flatpak_dbus_proxy-dbus-proxy.o
dbus-proxy/dbus-proxy.c: In function ‘fd_readall_bytes’:
dbus-proxy/dbus-proxy.c:47:7: error: implicit declaration of function ‘TEMP_FAILURE_RETRY’ [-Werror=implicit-function-declaration]
   47 |   if (TEMP_FAILURE_RETRY (fstat (fd, &stbuf)) != 0)
      |       ^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [Makefile:4525: dbus-proxy/flatpak_dbus_proxy-dbus-proxy.o] Error 1

When trying to build flatpak/xdg-dbus-proxy, the build fails in about the same spot:

  CC       dbus-proxy.o
dbus-proxy.c: In function ‘fd_readall_bytes’:
dbus-proxy.c:73:7: warning: implicit declaration of function ‘TEMP_FAILURE_RETRY’ [-Wimplicit-function-declaration]
   73 |   if (TEMP_FAILURE_RETRY (fstat (fd, &stbuf)) != 0)
      |       ^~~~~~~~~~~~~~~~~~
  CCLD     xdg-dbus-proxy
/usr/lib/gcc/x86_64-pc-linux-musl/9.2.0/../../../../x86_64-pc-linux-musl/bin/ld: dbus-proxy.o: in function `fd_readall_bytes':
/root/.cache/kiss/build-30335/xdg-dbus-proxy/dbus-proxy.c:73: undefined reference to `TEMP_FAILURE_RETRY'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:903: xdg-dbus-proxy] Error 1

Steps to reproduce

Build Flatpak on x86_64-pc-linux-musl, I guess.

Here's what I have as dependencies:

autoconf make
automake make
libtool make
bison make
gettext
libcap
libarchive
libxml2
libsoup
gpgme
libXau
linux-headers
polkit
json-glib
appstream-glib
dbus
bubblewrap

And here's my build script:

#!/bin/sh -e

patch -p0 -N -i musl-macros.patch

autoreconf -fi

./configure --prefix=/usr --disable-seccomp --disable-documentation --disable-gtk-doc --with-system-bubblewrap --without-system-dbus-proxy --enable-sandboxed-triggers
make ${MAKEOPTS}
make install DESTDIR=$1

And here's the contents of musl-macros.patch, which I stole from Void Linux's port of Flatpak:

--- config.h.in.orig
+++ config.h.in
@@ -151,3 +151,12 @@

 /* Define to 1 if you need to in order for `stat' and other things to work. */
 #undef _POSIX_SOURCE
+
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expression) \
+  (__extension__                                                              \
+    ({ long int __result;                                                     \
+       do __result = (long int) (expression);                                 \
+       while (__result == -1L && errno == EINTR);                             \
+       __result; }))
+#endif
smcv commented 2 years ago

This is not really a Flatpak bug, so I've transferred it to xdg-dbus-proxy, where it is a duplicate of #19.

For the --with-system-dbus-proxy case, this should be fixed by using a system copy of xdg-dbus-proxy >= 0.1.3, as a result of #13.

Flatpak 1.13.1 will include xdg-dbus-proxy 0.1.3, resolving this for the --without-system-dbus-proxy case.