Skip to contentSkip to conversation

mtools: Fix build with clang

PATCH New Khem Raj 2 participants 3 messages Sep 19, 2018

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 mtools: Fix build with clang

Identify with __clang__ to undefine UNUSED

---
 .../mtools/mtools/clang_UNUSED.patch            | 17 +++++++++++++++++
 meta/recipes-devtools/mtools/mtools_4.0.18.bb   |  1 +
 2 files changed, 18 insertions(+)
 create mode 100644 meta/recipes-devtools/mtools/mtools/clang_UNUSED.patch
meta/recipes-devtools/mtools/mtools/clang_UNUSED.patch new file +17 -0
new file mode 100644
index 0000000000..6bb9d6a3da
@@ -0,0 +1,17 @@
+Undefine UNUSED macros with clang
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+Index: mtools-4.0.18/sysincludes.h
+===================================================================
+--- mtools-4.0.18.orig/sysincludes.h
++++ mtools-4.0.18/sysincludes.h
+@@ -101,7 +101,7 @@ typedef void *caddr_t;
+ #if defined __GNUC__ && defined __STDC__
+ /* gcc -traditional doesn't have PACKED, UNUSED and NORETURN */
+ # define PACKED __attribute__ ((packed))
+-# if __GNUC__ == 2 && __GNUC_MINOR__ > 6 || __GNUC__ >= 3
++# if (__GNUC__ == 2 && __GNUC_MINOR__ > 6 || __GNUC__ >= 3) && !defined(__clang__)
+ /* gcc 2.6.3 doesn't have "unused" */		/* mool */
+ #  define UNUSED(x) x __attribute__ ((unused));x
+ #  define UNUSEDP __attribute__ ((unused))
meta/recipes-devtools/mtools/mtools_4.0.18.bb +1 -0
index 91f7b7c610..3c31aca3ad 100644
@@ -32,6 +32,7 @@ SRC_URI = "${GNU_MIRROR}/mtools/mtools-${PV}.tar.bz2 \
            file://no-x11.gplv3.patch \
            file://0001-Continue-even-if-fs-size-is-not-divisible-by-sectors.patch \
            file://0001-remove-LOCK_NB-to-use-blocking-request.patch \
+           file://clang_UNUSED.patch \
            "
 
 SRC_URI_append_class-native = " file://disable-hardcoded-configs.patch"
Signature · 1 line
2.19.0
author
#1 lore raw

PATCH v2 2/2 musl: Add aliases for glibc provided libraries

This is a step towards running pebuilt applications for glibc on musl There are many realworld applications which are not always built from source, especially provided by third party

Package the glibc symlinks into new package musl-glibc-compat

---
V2 - Package new symlinks into separate compat package

 meta/recipes-core/musl/musl_git.bb | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
meta/recipes-core/musl/musl_git.bb +22 -0
index be31718e3a..efdf620c6c 100644
@@ -26,6 +26,14 @@ DEPENDS = "virtual/${TARGET_PREFIX}binutils \
            bsd-headers \
            libssp-nonshared \
           "
+GLIBC_LDSO ?= "ld.so.1"
+GLIBC_LDSO_arm = "${@ bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'ld-linux-armhf.so.3', 'ld-linux.so.3', d)}"
+GLIBC_LDSO_aarch64 = "ld-linux-aarch64.so.1"
+GLIBC_LDSO_x86 = "ld-linux.so.2"
+GLIBC_LDSO_x86_64 = "ld-linux-x86-64.so.2"
+GLIBC_LDSO_x32 = "ld-linux-x32.so.2"
+GLIBC_LDSO_powerpc64 = "ld64.so.1"
+GLIBC_LDSO_mips64 = "ld64.so.1"
 
 export CROSS_COMPILE="${TARGET_PREFIX}"
 
@@ -62,12 +70,26 @@ do_install() {
 	install -d ${D}${bindir}
 	rm -f ${D}${bindir}/ldd
 	lnr ${D}${libdir}/libc.so ${D}${bindir}/ldd
+	lnr ${D}${libdir}/libc.so ${D}${base_libdir}/${GLIBC_LDSO}
 	for l in crypt dl m pthread resolv rt util xnet
 	do
 		ln -sf libc.so ${D}${libdir}/lib$l.so
 	done
+	for i in libc.so.6 libcrypt.so.1 libdl.so.2 libm.so.6 libpthread.so.0 libresolv.so.2 librt.so.1 libutil.so.1; do
+		ln -sf libc.so ${D}${libdir}/$i
+	done
 }
 
+PACKAGES =+ "${PN}-glibc-compat"
+
+FILES_${PN}-glibc-compat += "\
+                ${libdir}/libc.so.6 ${libdir}/libcrypt.so.1 \
+                ${libdir}/libdl.so.2 ${libdir}/libm.so.6 \
+                ${libdir}/libpthread.so.0 ${libdir}/libresolv.so.2 \
+                ${libdir}/librt.so.1 ${libdir}/libutil.so.1 \
+                ${base_libdir}/${GLIBC_LDSO} \
+                "
+
 RDEPENDS_${PN}-dev += "linux-libc-headers-dev bsd-headers-dev libssp-nonshared-staticdev"
 RPROVIDES_${PN}-dev += "libc-dev virtual-libc-dev"
 RPROVIDES_${PN} += "ldd libsegfault rtld(GNU_HASH)"
Signature · 1 line
2.19.0
#2 lore raw

Re: [PATCH V2 2/2] musl: Add aliases for glibc provided libraries

Quoted 26 lines · Khem Raj

This is a step towards running pebuilt applications for glibc on musl
There are many realworld applications which are not always built from source, especially provided by third party

Package the glibc symlinks into new package musl-glibc-compat

---
V2 - Package new symlinks into separate compat package

 meta/recipes-core/musl/musl_git.bb | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
meta/recipes- renamed from meta/recipes-core/musl/musl_git.bb +0 -0

core/musl/musl_git.bb
index be31718e3a..efdf620c6c 100644

meta/recipes-core/musl/musl_git.bb +2 -0
@@ -26,6 +26,14 @@ DEPENDS = "virtual/${TARGET_PREFIX}binutils \
            bsd-headers \
            libssp-nonshared \
           "
+GLIBC_LDSO ?= "ld.so.1"
+GLIBC_LDSO_arm = "${@ bb.utils.contains('TUNE_FEATURES',

'callconvention-hard', 'ld-linux-armhf.so.3', 'ld-linux.so.3', d)}"

meta/recipes-core/musl/musl_git.bb DEPENDS = "virtual/${TARGET_PREFIX}binutils \ · line 36

Quoted 6 lines
meta/recipes-core/musl/musl_git.bb +6 -0
+GLIBC_LDSO_aarch64 = "ld-linux-aarch64.so.1"
+GLIBC_LDSO_x86 = "ld-linux.so.2"
+GLIBC_LDSO_x86_64 = "ld-linux-x86-64.so.2"
+GLIBC_LDSO_x32 = "ld-linux-x32.so.2"
+GLIBC_LDSO_powerpc64 = "ld64.so.1"
+GLIBC_LDSO_mips64 = "ld64.so.1"

How about we tweak linuxloader.bbclass to have a glibc specific function could call to get this? I'm not a fan of adding another set of these lists...

Cheers,

Richard