Skip to contentSkip to conversation

Add common pieces to support musl as system C library alternative

PATCH New Khem Raj 1 participant 8 messages May 29, 2014

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

cover Add common pieces to support musl as system C library alternative

This patchset is part of musl support in config metadata and class metadata there are more patches for individual recipes to let it build with musl but those can be housed in a layer of its own. Once this common support is available in OE-Core

The following changes since commit 32ac58819580d359e22161be1abf62215d202250:

i2c-tools: Add i2c-tools to the core (2014-05-28 09:41:11 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib kraj/musl
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=kraj/musl

Khem Raj (7):
siteinfo,insane: Recognize musl specific triplets tclibc-musl.inc: Add musl specific distro policy file
multilib_header: Do not install mutlilib headers for musl image.bbclass: Remove dependency on ldconfig-native for musl cross-canadian.bbclass: Recognise musl
gnu-config: Let it recognise *-*-musl* triplets layer.conf: Add musl to safe recipes for exclusion

 meta/classes/cross-canadian.bbclass                |  4 +-
 meta/classes/image.bbclass                         |  1 +
 meta/classes/insane.bbclass                        | 21 +++++++++
 meta/classes/multilib_header.bbclass               |  7 +++
 meta/classes/siteinfo.bbclass                      | 13 ++++++
 meta/conf/distro/include/tclibc-musl.inc           | 27 +++++++++++
 meta/conf/layer.conf                               |  1 +
 .../gnu-config/gnu-config/musl-support.patch       | 25 +++++++++++
 .../gnu-config/gnu-config_20120814.bb              |  1 +
 meta/site/common-musl                              | 52 ++++++++++++++++++++++
 10 files changed, 151 insertions(+), 1 deletion(-)
 create mode 100644 meta/conf/distro/include/tclibc-musl.inc
 create mode 100644 meta/recipes-devtools/gnu-config/gnu-config/musl-support.patch
 create mode 100644 meta/site/common-musl
Signature · 1 line
1.9.3
author
#1 lore raw

PATCH 1/7 siteinfo, insane: Recognize musl specific triplets

We will use '-musl' to identify musl based systems this patch lays the foundation for recognising those and map them to internal variable representations

---
 meta/classes/insane.bbclass   | 21 +++++++++++++++++
 meta/classes/siteinfo.bbclass | 13 +++++++++++
 meta/site/common-musl         | 52 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 86 insertions(+)
 create mode 100644 meta/site/common-musl
meta/classes/insane.bbclass +21 -0
index 9ce3364..c8fa711 100644
@@ -98,6 +98,20 @@ def package_qa_get_machine_dict():
                         "sh4":        (42,       0,    0,          True,          32),
 
                       },
+            "linux-musl" : { 
+                        "arm" :       (  40,    97,    0,          True,          32),
+                        "armeb":      (  40,    97,    0,          False,         32),
+                        "powerpc":    (  20,     0,    0,          False,         32),
+                        "i386":       (   3,     0,    0,          True,          32),
+                        "i486":       (   3,     0,    0,          True,          32),
+                        "i586":       (   3,     0,    0,          True,          32),
+                        "i686":       (   3,     0,    0,          True,          32),
+                        "x86_64":     (  62,     0,    0,          True,          64),
+                        "mips":       (   8,     0,    0,          False,         32),
+                        "mipsel":     (   8,     0,    0,          True,          32),
+                        "mips64":     (   8,     0,    0,          False,         64),
+                        "mips64el":   (   8,     0,    0,          True,          64),
+                      },
             "uclinux-uclibc" : {
                         "bfin":       ( 106,     0,    0,          True,         32),
                       }, 
@@ -105,6 +119,10 @@ def package_qa_get_machine_dict():
                         "arm" :       (40,     0,    0,          True,          32),
                         "armeb" :     (40,     0,    0,          False,         32),
                       },
+            "linux-musleabi" : {
+                        "arm" :       (40,     0,    0,          True,          32),
+                        "armeb" :     (40,     0,    0,          False,         32),
+                      },
             "linux-uclibceabi" : {
                         "arm" :       (40,     0,    0,          True,          32),
                         "armeb" :     (40,     0,    0,          False,         32),
@@ -112,6 +130,9 @@ def package_qa_get_machine_dict():
             "linux-gnuspe" : {
                         "powerpc":    (20,     0,    0,          False,         32),
                       },
+            "linux-muslspe" : {
+                        "powerpc":    (20,     0,    0,          False,         32),
+                      },
             "linux-uclibcspe" : {
                         "powerpc":    (20,     0,    0,          False,         32),
                       },
meta/classes/siteinfo.bbclass +13 -0
index 9ae2561..e90632a 100644
@@ -58,6 +58,9 @@ def siteinfo_data(d):
         "linux-uclibc": "common-linux common-uclibc",
         "linux-uclibceabi": "common-linux common-uclibc",
         "linux-uclibcspe": "common-linux common-uclibc",
+        "linux-musl": "common-linux common-musl",
+        "linux-musleabi": "common-linux common-musl",
+        "linux-muslspe": "common-linux common-musl",
         "uclinux-uclibc": "common-uclibc",
         "cygwin": "common-cygwin",
         "mingw32": "common-mingw",
@@ -66,21 +69,31 @@ def siteinfo_data(d):
         "aarch64-linux-gnu": "aarch64-linux",
         "aarch64_be-linux-gnu": "aarch64_be-linux",
         "arm-linux-gnueabi": "arm-linux",
+        "arm-linux-musleabi": "arm-linux",
         "arm-linux-uclibceabi": "arm-linux-uclibc",
         "armeb-linux-gnueabi": "armeb-linux",
         "armeb-linux-uclibceabi": "armeb-linux-uclibc",
+        "armeb-linux-musleabi": "armeb-linux",
+        "mips-linux-musl": "mips-linux",
+        "mipsel-linux-musl": "mipsel-linux",
+        "mips64-linux-musl": "mips-linux",
+        "mips64el-linux-musl": "mipsel-linux",
         "mips64-linux-gnun32": "mips-linux bit-32",
         "mips64el-linux-gnun32": "mipsel-linux bit-32",
         "powerpc-linux": "powerpc32-linux",
+        "powerpc-linux-musl": "powerpc-linux powerpc32-linux",
         "powerpc-linux-uclibc": "powerpc-linux powerpc32-linux",
         "powerpc-linux-gnuspe": "powerpc-linux powerpc32-linux",
+        "powerpc-linux-muslspe": "powerpc-linux powerpc32-linux",
         "powerpc-linux-uclibcspe": "powerpc-linux powerpc32-linux powerpc-linux-uclibc",
         "powerpc64-linux-gnuspe": "powerpc-linux powerpc64-linux",
+        "powerpc64-linux-muslspe": "powerpc-linux powerpc64-linux",
         "powerpc64-linux": "powerpc-linux",
         "x86_64-cygwin": "bit-64",
         "x86_64-darwin": "bit-64",
         "x86_64-darwin9": "bit-64",
         "x86_64-linux": "bit-64",
+        "x86_64-linux-musl": "x86_64-linux bit-64",
         "x86_64-linux-uclibc": "bit-64",
         "x86_64-linux-gnu": "bit-64 x86_64-linux",
         "x86_64-linux-gnux32": "bit-32 ix86-common x32-linux",
meta/site/common-musl new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
1.9.3
author
#2 lore raw

PATCH 2/7 tclibc-musl.inc: Add musl specific distro policy file

With this we could use TCLIBC=musl to switch to images based on musl

---
 meta/conf/distro/include/tclibc-musl.inc | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 meta/conf/distro/include/tclibc-musl.inc
meta/conf/distro/include/tclibc-musl.inc new file +27 -0
new file mode 100644
index 0000000..d375d8d
@@ -0,0 +1,27 @@
+#
+# musl specific configuration
+#
+
+LIBCEXTENSION = "-musl"
+
+# Add uclibc overrides to the overrides.
+LIBCOVERRIDE = ":libc-musl"
+OVERRIDES .= "${LIBCOVERRIDE}"
+
+PREFERRED_PROVIDER_virtual/libc ?= "musl"
+PREFERRED_PROVIDER_virtual/libiconv ?= "musl"
+PREFERRED_PROVIDER_virtual/libintl ?= "gettext"
+PREFERRED_PROVIDER_virtual/nativesdk-libintl ?= "nativesdk-eglibc"
+PREFERRED_PROVIDER_virtual/nativesdk-libiconv ?= "nativesdk-eglibc"
+
+USE_NLS ?= "no"
+
+CXXFLAGS += "-fvisibility-inlines-hidden"
+
+IMAGE_LINGUAS = ""
+
+LIBC_DEPENDENCIES = "\
+    musl \
+    musl-dbg \
+    musl-dev \
+    "
Signature · 1 line
1.9.3
author
#3 lore raw

PATCH 3/7 multilib_header: Do not install mutlilib headers for musl

In reply to Khem Raj

musl is not multilib and this creates trouble. eg. when util-linux probes for ncurses it does not find it because ncurses has installed the multilibbed header and this header includes bits/wordsize.h and this header does not exist on musl systems. If and when musl adds multilib support we will revisit it.

---
 meta/classes/multilib_header.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)
meta/classes/multilib_header.bbclass +7 -0
index 4d049a8..5ee0a2d 100644
@@ -6,6 +6,13 @@ inherit siteinfo
 # all of the ABI variants for that given architecture.
 #
 oe_multilib_header() {
+
+	case ${HOST_OS} in
+	*-musl*)
+		return
+		;;
+	*)
+	esac
         # We use
         # For ARM: We don't support multilib builds.
         # For MIPS: "n32" is a special case, which needs to be
Signature · 1 line
1.9.3
author
#4 lore raw

PATCH 4/7 image.bbclass: Remove dependency on ldconfig-native for musl

In reply to Khem Raj

it does not grok glibc ldconfig format

---
 meta/classes/image.bbclass | 1 +
 1 file changed, 1 insertion(+)
meta/classes/image.bbclass +1 -0
index ceee848..a03b880 100644
@@ -70,6 +70,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 LDCONFIGDEPEND ?= "ldconfig-native:do_populate_sysroot"
 LDCONFIGDEPEND_libc-uclibc = ""
+LDCONFIGDEPEND_libc-musl = ""
 
 do_rootfs[depends] += "makedevs-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot ${LDCONFIGDEPEND}"
 do_rootfs[depends] += "virtual/update-alternatives-native:do_populate_sysroot update-rc.d-native:do_populate_sysroot"
Signature · 1 line
1.9.3
author
#5 lore raw

PATCH 5/7 cross-canadian.bbclass: Recognise musl

In reply to Khem Raj
---
 meta/classes/cross-canadian.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/classes/cross-canadian.bbclass +3 -1
index cea6afb..25e246d 100644
@@ -27,7 +27,9 @@ python () {
     tarch = d.getVar("TARGET_ARCH", True)
     if tarch == "powerpc":
         tos = d.getVar("TARGET_OS", True)
-        if (tos != "linux" and tos != "linux-gnuspe" and tos != "linux-uclibc" and tos != "linux-uclibcspe"):
+        if (tos != "linux" and tos != "linux-gnuspe"
+            and tos != "linux-uclibc" and tos != "linux-uclibcspe"
+            and tos != "linux-musl" and tos != "linux-muslspe"):
             bb.fatal("Building cross-candian powerpc for an unknown TARGET_SYS (%s), please update cross-canadian.bbclass" % d.getVar("TARGET_SYS", True))
         # This is a bit ugly. We need to zero LIBC/ABI extension which will change TARGET_OS
         # however we need the old value in some variables. We expand those here first.
Signature · 1 line
1.9.3
author
#6 lore raw

PATCH 6/7 gnu-config: Let it recognise *-*-musl* triplets

In reply to Khem Raj

This will help autotools based packages to recognise musl

---
 .../gnu-config/gnu-config/musl-support.patch       | 25 ++++++++++++++++++++++
 .../gnu-config/gnu-config_20120814.bb              |  1 +
 2 files changed, 26 insertions(+)
 create mode 100644 meta/recipes-devtools/gnu-config/gnu-config/musl-support.patch
meta/recipes-devtools/gnu-config/gnu-config/musl-support.patch new file +25 -0
new file mode 100644
index 0000000..3147435
@@ -0,0 +1,25 @@
+support musl
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+
+Index: gnu-config-20120814/config.sub
+===================================================================
+--- gnu-config-20120814.orig/config.sub	2012-09-18 02:27:45.000000000 -0700
++++ gnu-config-20120814/config.sub	2014-03-26 00:34:19.955996709 -0700
+@@ -123,6 +123,7 @@
+ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+ case $maybe_os in
+   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
++  linux-musl* | \
+   linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+   knetbsd*-gnu* | netbsd*-gnu* | \
+   kopensolaris*-gnu* | \
+@@ -1365,6 +1366,7 @@
+ 	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ 	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+ 	      | -linux-newlib* | -linux-uclibc* \
++	      | -linux-musl* \
+ 	      | -uxpv* | -beos* | -mpeix* | -udk* \
+ 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
meta/recipes-devtools/gnu-config/gnu-config_20120814.bb +1 -0
index 44e1b5d..d67466a 100644
@@ -11,6 +11,7 @@ INHIBIT_DEFAULT_DEPS = "1"
 
 SRC_URI = "http://downloads.yoctoproject.org/releases/gnu-config/gnu-config-${PV}.tar.bz2 \
 	   file://config-guess-uclibc.patch \
+	   file://musl-support.patch \
            file://gnu-configize.in"
 
 SRC_URI[md5sum] = "bcfca5a2bb39edad4aae5a65efc84094"
Signature · 1 line
1.9.3
author
#7 lore raw

PATCH 7/7 layer.conf: Add musl to safe recipes for exclusion

In reply to Khem Raj
---
 meta/conf/layer.conf | 1 +
 1 file changed, 1 insertion(+)
meta/conf/layer.conf +1 -0
index dbcb653..75ca232 100644
@@ -34,6 +34,7 @@ SIGGEN_EXCLUDERECIPES_ABISAFE += " \
 
 SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS += " \
   gcc-cross-${TARGET_ARCH}->eglibc \
+  gcc-cross-${TARGET_ARCH}->musl \
   gcc-cross-${TARGET_ARCH}->uclibc \
   gcc-cross-${TARGET_ARCH}->linux-libc-headers \
 "
Signature · 1 line
1.9.3