package/mtd: fix musl compile
PATCH 1/1 package/mtd: fix musl compile
Expand existing rpmatch() patch for uClibc to musl. Add another patch to fix more compile issues with musl.
Patches sent upstream:
1) "include/common.h: fix build against musl"
[http://patchwork.ozlabs.org/patch/464074/]
2) "Makefile: fix build against musl"
[http://patchwork.ozlabs.org/patch/464072/]
3) "lib/libfec.c: fix build against musl"
[http://patchwork.ozlabs.org/patch/464073/]
---
...1-Fix-rpmatch-call-under-uClibc-and-musl.patch} | 49 ++++++++++++++--------
.../0002-Fix-compile-against-musl-C-library.patch | 46 ++++++++++++++++++++
2 files changed, 77 insertions(+), 18 deletions(-)
rename package/mtd/{0001-Fix-rpmatch-call-under-uClibc.patch => 0001-Fix-rpmatch-call-under-uClibc-and-musl.patch} (54%)
create mode 100644 package/mtd/0002-Fix-compile-against-musl-C-library.patchpackage/mtd/0001-Fix-rpmatch-call-under-uClibc-and-musl.patch renamed from package/mtd/0001-Fix-rpmatch-call-under-uClibc.patch +31 -18
@@ -1,12 +1,14 @@ -From aebb2831c13ffc6f1df79e638b99e78c52aed4ce Mon Sep 17 00:00:00 2001 -Message-Id: <aebb2831c13ffc6f1df79e638b99e78c52aed4ce.1397593673.git.baruch@tkos.co.il> +From b64616e1403090ad388a115d61bfc8671b5a5853 Mon Sep 17 00:00:00 2001 From: Baruch Siach <[email protected]> Date: Sun, 13 Apr 2014 15:26:46 +0300 -Subject: [PATCH] Fix rpmatch() call under uClibc +Subject: [PATCH 1/2] Fix rpmatch() call under uClibc and musl +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit -Combine the following two patches. The first is upstream (commit 50c9e11f7e), -the second has been posted upstream at -http://patchwork.ozlabs.org/patch/339365/. +Combine the following two upstream uClibc (commit 50c9e11f7e and +5923077649) and a musl patch sent to the mailing list +(http://patchwork.ozlabs.org/patch/464074/). include/common.h: fix build against current uClibc
@@ -25,25 +27,38 @@ So the uClibc version check introduced in commit 50c9e11f7e (include/common.h: fix build against current uClibc) is not enough. Rename the local rpmatch() implementation to avoid collision. +include/common.h: fix build against musl + +Like uClibc version older than (not yet released) 0.9.34 musl does not have +a rpmatch() implementation. + +uClibc defines both __UCLIBC__ and __GLIBC__. So first check for uCibc and its +version and then for a non glibc implementation (like musl). Note, musl does +not define __MUSL__. + +Signed-off-by: J?rg Krause <[email protected]> + Cc: Mike Frysinger <[email protected]> Signed-off-by: Baruch Siach <[email protected]> +Signed-off-by: J?rg Krause <[email protected]> --- include/common.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/common.h b/include/common.h -index 4ffccea17213..838dc757bdf1 100644 +index 4ffccea..d1be21e 100644 --- a/include/common.h +++ b/include/common.h @@ -102,6 +102,20 @@ extern "C" { - fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \ - } while(0) - -+#if defined(__UCLIBC__) -+/* uClibc versions before 0.9.34 don't have rpmatch() */ -+#if __UCLIBC_MAJOR__ == 0 && \ + fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \ +} while(0) + ++/* uClibc versions before 0.9.34 and musl don't have rpmatch() */ ++#if defined(__UCLIBC__) && \ ++ (__UCLIBC_MAJOR__ == 0 && \ + (__UCLIBC_MINOR__ < 9 || \ -+ (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 34)) ++ (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 34))) || \ ++ !defined(__GLIBC__) +#define rpmatch __rpmatch +static inline int __rpmatch(const char *resp) +{
@@ -51,11 +66,9 @@ index 4ffccea17213..838dc757bdf1 100644 + (resp[0] == 'n' || resp[0] == 'N') ? 0 : -1; +} +#endif -+#endif + /** * prompt the user for confirmation */ --- -1.9.1 - +-- +2.3.6
package/mtd/0002-Fix-compile-against-musl-C-library.patch new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
2.3.6
PATCH 1/1 package/mtd: fix musl compile
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"J?rg" == J?rg Krause <[email protected]> writes:
Expand existing
rpmatch()patch for uClibc to musl. Add another patch to fix more compile issues with musl.
Quoted 7 lines
Patches sent upstream:
1) "include/common.h: fix build against musl"
[http://patchwork.ozlabs.org/patch/464074/]
2) "Makefile: fix build against musl"
[http://patchwork.ozlabs.org/patch/464072/]
3) "lib/libfec.c: fix build against musl"
[http://patchwork.ozlabs.org/patch/464073/]
Thanks, but something seems wrong:
Quoted 18 lines
package/mtd/0001-Fix-rpmatch-call-under-uClibc-and-musl.patch renamed from package/mtd/0001-Fix-rpmatch-call-under-uClibc.patch +8
-1+uClibc defines both __UCLIBC__ and __GLIBC__. So first check for uCibc and its +version and then for a non glibc implementation (like musl). Note, musl does +not define __MUSL__. + +Signed-off-by: J?rg Krause <[email protected]> + Cc: Mike Frysinger <[email protected]> Signed-off-by: Baruch Siach <[email protected]> +Signed-off-by: J?rg Krause <[email protected]> --- include/common.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/common.h b/include/common.h -index 4ffccea17213..838dc757bdf1 100644 +index 4ffccea..d1be21e 100644 --- a/include/common.h +++ b/include/common.h
package/mtd/0001-Fix-rpmatch-call-under-uClibc-and-musl.patch So the uClibc version check introduced in commit 50c9e11f7e (include/common.h: · line 55
Quoted 10 lines
package/mtd/0001-Fix-rpmatch-call-under-uClibc-and-musl.patch renamed from package/mtd/0001-Fix-rpmatch-call-under-uClibc.patch +3
-6@@ -102,6 +102,20 @@ extern "C" { - fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \ - } while(0) - -+#if defined(__UCLIBC__) -+/* uClibc versions before 0.9.34 don't have rpmatch() */ -+#if __UCLIBC_MAJOR__ == 0 && \ + fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \ +} while(0) +
This is not valid patch syntax (context lines should start with a space). Perhaps you mailed corrupted the patch?
With that fixed, it still doesn't build for me:
CC recv_image.o
recv_image.c:7:19: fatal error: error.h: No such file or directory
#include <error.h>
^compilation terminated.
common.mk:82: recipe for target '/home/peko/source/buildroot/output/build/mtd-1.5.1/recv_image.o' failed
Care to fix that and resend?
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 package/mtd: fix musl compile
Hi Peter,
Quoted 14 lines · Peter Korsgaard
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"J?rg" == J?rg Krause <[email protected]> writes:
Expand existing
rpmatch()patch for uClibc to musl. Add anotherpatch to
Quoted 9 lines
fix more compile issues with musl.
Patches sent upstream:
1) "include/common.h: fix build against musl"
[http://patchwork.ozlabs.org/patch/464074/]
2) "Makefile: fix build against musl"
[http://patchwork.ozlabs.org/patch/464072/]
3) "lib/libfec.c: fix build against musl"
[http://patchwork.ozlabs.org/patch/464073/]
Quoted 1 line
Thanks, but something seems wrong:
Thanks for testing!
Quoted 30 lines
Quoted 4 lines
+uClibc defines both
__UCLIBC__and__GLIBC__. So first check for uCibc and its
+version and then for a non glibc implementation (like musl).Note, musl does
Quoted 8 lines
package/mtd/0001-Fix-rpmatch-call-under-uClibc-and-musl.patch renamed from package/mtd/0001-Fix-rpmatch-call-under-uClibc.patch +5
-0+not define __MUSL__. + +Signed-off-by: J?rg Krause <[email protected]> + Cc: Mike Frysinger <[email protected]> Signed-off-by: Baruch Siach <[email protected]> +Signed-off-by: J?rg Krause <[email protected]> ---package/mtd/0001-Fix-rpmatch-call-under-uClibc-and-musl.patch So the uClibc version check introduced in commit 50c9e11f7e (include/common.h:
Quoted 10 lines
package/mtd/0001-Fix-rpmatch-call-under-uClibc-and-musl.patch renamed from package/mtd/0001-Fix-rpmatch-call-under-uClibc.patch +1
-2include/common.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/common.h b/include/common.h -index 4ffccea17213..838dc757bdf1 100644 +index 4ffccea..d1be21e 100644 --- a/include/common.h +++ b/include/common.h @@ -102,6 +102,20 @@ extern "C" { - fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME,##__VA_ARGS__); \
Quoted 6 lines
- } while(0)
-
-+#ifdefined(__UCLIBC__)
-+/* uClibc versions before 0.9.34 don't haverpmatch()*/ -+#if__UCLIBC_MAJOR__== 0 && \
+ fprintf(stderr, "%s: warning!: " fmt "\n",PROGRAM_NAME,
Quoted 6 lines
##__VA_ARGS__); \
package/mtd/0001-Fix-rpmatch-call-under-uClibc-and-musl.patch So the uClibc version check introduced in commit 50c9e11f7e (include/common.h: · line 55
Quoted 2 lines
package/mtd/0001-Fix-rpmatch-call-under-uClibc-and-musl.patch renamed from package/mtd/0001-Fix-rpmatch-call-under-uClibc.patch +2
-0+} while(0) +This is not valid patch syntax (context lines should start with a space). Perhaps you mailed corrupted the patch?
Oops, something went terribly wrong here when removing trailing whitespaces, I guess. Fixed.
Quoted 5 lines
With that fixed, it still doesn't build for me:
CC recv_image.o
recv_image.c:7:19: fatal error:error.h: No such file or directory
Quoted 8 lines
#include <error.h> ^compilation terminated.
common.mk:82: recipe for target '/home/peko/source/buildroot/output/build/mtd-1.5.1/recv_image.o' failedCare to fix that and resend?
I see, this happens for the recv_image tool. I just tested the default enabled tools.
Yes, I will fix that.
Best regards
J?rg Krause