From 92a244ba8bf1a80dba746dbb6b7ab0a45b1dd375 Mon Sep 17 00:00:00 2001 From: Thomas Perale Date: Thu, 31 Jul 2025 18:57:00 +0200 Subject: [PATCH] package/janet: fix build w/ musl Since the commit [1] the janet package started failing on the autobuilder when using musl libc: ``` [50/56] Compiling C object libjanet.so.1.35.2.p/meson-generated_.._janet.c.o FAILED: libjanet.so.1.35.2.p/meson-generated_.._janet.c.o /workdir/instance-0/output-1/host/bin/armeb-buildroot-linux-musleabi-gcc -Ilibjanet.so.1.35.2.p -I. -I.. -I../src/include -fdiagnostics-color=always -Wall -Winvalid-pch -std=c99 -O3 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O1 -g3 -fPIC -pthread -fvisibility=hidden -MD -MQ libjanet.so.1.35.2.p/meson-generated_.._janet.c.o -MF libjanet.so.1.35.2.p/meson-generated_.._janet.c.o.d -o libjanet.so.1.35.2.p/meson-generated_.._janet.c.o -c janet.c src/core/util.c: In function 'janet_strerror': src/core/util.c:977:12: error: returning 'int' from a function with return type 'const char *' makes pointer from integer without a cast [-Wint-conversion] [51/56] Compiling C object janet-native.p/meson-generated_.._janet.c.o ``` The commit [2] introduced the issue in v1.35.0, the `strerror` function has different definition on glibc compared to musl. This issue has been addressed in commit [3]. This patch add the upstream commit [3]. [1] 31212c4c58 package/janet: bump to version 1.35.2 [2] https://github.com/janet-lang/janet/commit/8334504f4e5aa253502a45db3eeb4db265490b4e [3] https://github.com/janet-lang/janet/commit/a5d6b2283834422a9fa9e79b5c7ad9b932b52568 Fixes: https://autobuild.buildroot.org/results/ff1/ff1d6063c1a79d17cfa9910cca824e704a4a0c67/build-end.log Signed-off-by: Thomas Perale Signed-off-by: Romain Naour --- ...heck-for-glibc-instead-of-gnu-source.patch | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 package/janet/0001-check-for-glibc-instead-of-gnu-source.patch diff --git a/package/janet/0001-check-for-glibc-instead-of-gnu-source.patch b/package/janet/0001-check-for-glibc-instead-of-gnu-source.patch new file mode 100644 index 0000000000..5ee021e658 --- /dev/null +++ b/package/janet/0001-check-for-glibc-instead-of-gnu-source.patch @@ -0,0 +1,26 @@ +From a5d6b2283834422a9fa9e79b5c7ad9b932b52568 Mon Sep 17 00:00:00 2001 +From: Calvin Rose +Date: Fri, 21 Jun 2024 17:17:22 -0500 +Subject: [PATCH] Check for __GLIBC__ instead of _GNU_SOURCE + +musl doesn't obey this behavior. + +Upstream: https://github.com/janet-lang/janet/commit/a5d6b2283834422a9fa9e79b5c7ad9b932b52568 +Signed-off-by: Thomas Perale +--- + src/core/util.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/util.c b/src/core/util.c +index 4bb37abc5..6cb5676e0 100644 +--- a/src/core/util.c ++++ b/src/core/util.c +@@ -972,7 +972,7 @@ const char *janet_strerror(int e) { + #ifdef JANET_WINDOWS + /* Microsoft strerror seems sane here and is thread safe by default */ + return strerror(e); +-#elif defined(_GNU_SOURCE) ++#elif defined(__GLIBC__) + /* See https://linux.die.net/man/3/strerror_r */ + return strerror_r(e, janet_vm.strerror_buf, sizeof(janet_vm.strerror_buf)); + #else