Created attachment 490518 [details] networkmanager-1.8.2-musl.patch Hello. I have been tinkering with getting networkmanager to compile (and hopefully run) on musl libc. I've taken some patches from alpine and redid them against version 1.8.2. The problem is, one has to run eautoreconf to get the changes to configure.ac to propagate into configure, and due to the complexity of the ebuild I can't quite get it to work myself. I know autotools.eclass will be needed. Find attached the patch I worked together using alpine linux's package as a basis, with cruft no longer needed removed. It mostly works, with the exception of the lack of propagating changes to configure.ac into configure, which results in libtool appending "none required" to the end of its link flags, which obviously fails.
build.log: https://bpaste.net/show/79bc4bb4be60 (too large to attach normally)
Created attachment 490520 [details] emerge --info
https://gitweb.gentoo.org/dev/anarchy.git/commit/?id=af74216899f3de56da5aac64b8f5ff48a87db246 Needs to be cleaned up but works as expected on musl. CFLAGS="${CFLAGS} -DHAVE_SECURE_GETENV -Dsecure_getenv=getenv -D__USE_POSIX199309" CFLAGS used via /etc/portage/package.env
(In reply to Jory A. Pratt from comment #3) > https://gitweb.gentoo.org/dev/anarchy.git/commit/ > ?id=af74216899f3de56da5aac64b8f5ff48a87db246 > > Needs to be cleaned up but works as expected on musl. > > CFLAGS="${CFLAGS} -DHAVE_SECURE_GETENV -Dsecure_getenv=getenv > -D__USE_POSIX199309" > > CFLAGS used via /etc/portage/package.env I have added the CFLAGS to ebuild so they will be appended for musl support only. All you have to do is fetch the package out my dev overlay and emerge it, I will move it to musl overlay later today.
Has been added to the musl overlay :) enjoy
(In reply to Jory A. Pratt from comment #5) > Has been added to the musl overlay :) enjoy Honestly since the patching only changes the musl compile (glibc should result in identical code due to the way its done) would it not be apropos to end up in the main gentoo 'overlay' ?
Let me comment a bit on the patch. (I haven't looked at the actual code, so take everything with a grain of salt.) > diff --git a/configure.ac b/configure.ac > index 6f190c0..ddc25f0 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -278,6 +278,7 @@ dnl > dnl Checks for libdl - on certain platforms its part of libc > dnl > AC_SEARCH_LIBS([dlopen], [dl dld], [], [ac_cv_search_dlopen=]) > +AS_IF([test "$ac_cv_search_dlopen" = "none required"],[ac_cv_search_dlopen=""]) looks upstreamable > AC_SUBST([DL_LIBS], "$ac_cv_search_dlopen") > > PKG_CHECK_MODULES(GLIB, [gio-unix-2.0 >= 2.37.6 gmodule-2.0], > diff --git a/libnm-core/nm-utils.h b/libnm-core/nm-utils.h > index 77fe18a..dcc776f 100644 > --- a/libnm-core/nm-utils.h > +++ b/libnm-core/nm-utils.h > @@ -30,7 +30,11 @@ > #include <netinet/in.h> > > /* For ETH_ALEN and INFINIBAND_ALEN */ > +#if defined(__GLIBC__) > #include <linux/if_ether.h> > +#else > +#define ETH_ALEN 6 /* Octets in one ethernet addr */ > +#endif > #include <linux/if_infiniband.h> > > #include "nm-core-enum-types.h" > diff --git a/src/platform/wifi/wifi-utils.h b/src/platform/wifi/wifi-utils.h > index 705717b..da3edc4 100644 > --- a/src/platform/wifi/wifi-utils.h > +++ b/src/platform/wifi/wifi-utils.h > @@ -22,7 +22,11 @@ > #ifndef __WIFI_UTILS_H__ > #define __WIFI_UTILS_H__ > > +#if defined(__GLIBC__) > #include <net/ethernet.h> > +#else /* musl libc */ > +#define ETH_ALEN 6 /* Octets in one ethernet addr */ > +#endif > > #include "nm-dbus-interface.h" > musl does have the definition of ETH_ALEN in netinet/if_ether.h and also indirectly in net/ethernet.h. > diff --git a/src/systemd/src/basic/socket-util.h b/src/systemd/src/basic/socket-util.h > index 19a9ddb..337b20e 100644 > --- a/src/systemd/src/basic/socket-util.h > +++ b/src/systemd/src/basic/socket-util.h > @@ -28,6 +28,11 @@ > #include <sys/un.h> > #include <linux/netlink.h> > #include <linux/if_packet.h> > +#if !defined(__GLIBC__) > +/* SIOCGSTAMPNS from linux/asm-generic.h > + * for src/systemd/src/libsystemd-network/sd-lldp.c */ > +#include <linux/sockios.h> > +#endif SIOCGSTAMPNS has recently been added to musl. (Not yet in any release.) > > #include "macro.h" > #include "missing.h" > diff --git a/src/systemd/src/basic/stdio-util.h b/src/systemd/src/basic/stdio-util.h > index bd1144b..9eafacb 100644 > --- a/src/systemd/src/basic/stdio-util.h > +++ b/src/systemd/src/basic/stdio-util.h > @@ -19,7 +19,9 @@ > along with systemd; If not, see <http://www.gnu.org/licenses/>. > ***/ > > +#if defined(__GLIBC__) > #include <printf.h> > +#endif This seems to indicate that the header is completely superfluous here. > #include <stdarg.h> > #include <stdio.h> > #include <sys/types.h> > diff --git a/src/systemd/src/basic/util.h b/src/systemd/src/basic/util.h > index c7da6c3..d19e1b2 100644 > --- a/src/systemd/src/basic/util.h > +++ b/src/systemd/src/basic/util.h > @@ -46,6 +46,11 @@ > #include "missing.h" > #include "time-util.h" > > +#if !defined(__GLIBC__) > +typedef int (*__compar_fn_t) (const void*, const void*); > +typedef __compar_fn_t comparison_fn_t; > +#endif > + I would prefer replacing all occurences of comparison_fn_t (for upstream). > size_t page_size(void) _pure_; > #define PAGE_ALIGN(l) ALIGN_TO((l), page_size()) >