Skip to contentSkip to conversation

package/mcelog: fix musl build with gcc >= 14.x

PATCH Applied Bernd Kuhls 2 participants 4 messages Jan 18 – Feb 6

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/mcelog: fix musl build with gcc >= 14.x

Fixes:
https://autobuild.buildroot.net/results/902/9020e4fda8cbc4f9886d5e8725f6df8d99716241/

The build error does not occur with gcc-13.

---
 ...orrect-prameter-type-for-connect-API.patch | 43 +++++++++++++++++++
 .../0002-client.c-fix-build-w-musl-libc.patch | 42 ++++++++++++++++++
 2 files changed, 85 insertions(+)
 create mode 100644 package/mcelog/0001-server-Correct-prameter-type-for-connect-API.patch
 create mode 100644 package/mcelog/0002-client.c-fix-build-w-musl-libc.patch
package/mcelog/0001-server-Correct-prameter-type-for-connect-API.patch new file +43 -0
new file mode 100644
index 0000000000..cc9d0e84c6
@@ -0,0 +1,43 @@
+From c17897deb52daab300c585a6a6c2456d062d80cf Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 11 May 2024 22:50:19 -0700
+Subject: [PATCH] server: Correct prameter type for connect() API
+
+connect() function expects the second argument to be point to sockaddr
+as per man sockaddr
+
+int connect (int, const struct sockaddr *, socklen_t);
+
+Fixes build failures with -Wincompatible-pointer-types when using GCC-14
+and musl
+
+Fixes
+| server.c: In function 'server_ping':
+| server.c:308:33: error: passing argument 2 of 'connect' from incompatible pointer type [-Wincompatible-pointer-types]
+|   308 |                 if (connect(fd, un, sizeof(struct sockaddr_un)) < 0)
+|       |                                 ^~
+|       |                                 |
+|       |                                 struct sockaddr_un *
+
+Signed-off-by: Andi Kleen <[email protected]>
+
+Upstream: https://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git/commit/?id=c17897deb52daab300c585a6a6c2456d062d80cf
+
+Signed-off-by: Bernd Kuhls <[email protected]>
+---
+ server.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/server.c b/server.c
+index 54c7d57..51b7d3a 100644
+--- a/server.c
++++ b/server.c
+@@ -305,7 +305,7 @@ static int server_ping(struct sockaddr_un *un)
+ 	if (sigsetjmp(ping_timeout_ctx, 1) == 0) {
+ 		ret = -1;
+ 		alarm(initial_ping_timeout);
+-		if (connect(fd, un, sizeof(struct sockaddr_un)) < 0)
++		if (connect(fd, (const struct sockaddr *)un, sizeof(struct sockaddr_un)) < 0)
+ 			goto cleanup;
+ 		if (write(fd, PAIR("ping\n")) < 0)
+ 			goto cleanup;
package/mcelog/0002-client.c-fix-build-w-musl-libc.patch new file +42 -0

42 lines not on this page · raw message

Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 package/mcelog: bump version to 210

https://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git/log/

Removed patches which are included in this release.

---
 ...orrect-prameter-type-for-connect-API.patch | 43 -------------------
 .../0002-client.c-fix-build-w-musl-libc.patch | 42 ------------------
 package/mcelog/mcelog.hash                    |  2 +-
 package/mcelog/mcelog.mk                      |  2 +-
 4 files changed, 2 insertions(+), 87 deletions(-)
 delete mode 100644 package/mcelog/0001-server-Correct-prameter-type-for-connect-API.patch
 delete mode 100644 package/mcelog/0002-client.c-fix-build-w-musl-libc.patch
package/mcelog/0001-server-Correct-prameter-type-for-connect-API.patch deleted +0 -43
deleted file mode 100644
index cc9d0e84c6..0000000000
@@ -1,43 +0,0 @@
-From c17897deb52daab300c585a6a6c2456d062d80cf Mon Sep 17 00:00:00 2001
-From: Khem Raj <[email protected]>
-Date: Sat, 11 May 2024 22:50:19 -0700
-Subject: [PATCH] server: Correct prameter type for connect() API
-
-connect() function expects the second argument to be point to sockaddr
-as per man sockaddr
-
-int connect (int, const struct sockaddr *, socklen_t);
-
-Fixes build failures with -Wincompatible-pointer-types when using GCC-14
-and musl
-
-Fixes
-| server.c: In function 'server_ping':
-| server.c:308:33: error: passing argument 2 of 'connect' from incompatible pointer type [-Wincompatible-pointer-types]
-|   308 |                 if (connect(fd, un, sizeof(struct sockaddr_un)) < 0)
-|       |                                 ^~
-|       |                                 |
-|       |                                 struct sockaddr_un *
-
-Signed-off-by: Andi Kleen <[email protected]>
-
-Upstream: https://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git/commit/?id=c17897deb52daab300c585a6a6c2456d062d80cf
-
-Signed-off-by: Bernd Kuhls <[email protected]>
----
- server.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/server.c b/server.c
-index 54c7d57..51b7d3a 100644
---- a/server.c
-+++ b/server.c
-@@ -305,7 +305,7 @@ static int server_ping(struct sockaddr_un *un)
- 	if (sigsetjmp(ping_timeout_ctx, 1) == 0) {
- 		ret = -1;
- 		alarm(initial_ping_timeout);
--		if (connect(fd, un, sizeof(struct sockaddr_un)) < 0)
-+		if (connect(fd, (const struct sockaddr *)un, sizeof(struct sockaddr_un)) < 0)
- 			goto cleanup;
- 		if (write(fd, PAIR("ping\n")) < 0)
- 			goto cleanup;
package/mcelog/0002-client.c-fix-build-w-musl-libc.patch deleted +0 -42

42 lines not on this page · raw message

package/mcelog/mcelog.hash +1 -1
index a82d6f2ed2..309a0fa197 100644
@@ -1,3 +1,3 @@
 # Locally computed
-sha256  52ad2771a8dc8e30b44a52864620cf1be1fce81f9ae83c4652a9e2d010b1a533  mcelog-194.tar.gz
+sha256  5760c1b433ca4caccf140d51490e2565d117a684942d9f6b4d79b6209465e11e  mcelog-210.tar.gz
 sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  LICENSE
package/mcelog/mcelog.mk +1 -1
index 5cd00cc354..62bd492e0f 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-MCELOG_VERSION = 194
+MCELOG_VERSION = 210
 MCELOG_SITE = $(call github,andikleen,mcelog,v$(MCELOG_VERSION))
 MCELOG_LICENSE = GPL-2.0
 MCELOG_LICENSE_FILES = LICENSE
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
In reply to Bernd Kuhls

In reply of:

Quoted 6 lines

Fixes:
https://autobuild.buildroot.net/results/902/9020e4fda8cbc4f9886d5e8725f6df8d99716241/

The build error does not occur with gcc-13.

Applied to 2025.02.x & 2025.11.x. Thanks

Quoted 111 lines
---
 ...orrect-prameter-type-for-connect-API.patch | 43 +++++++++++++++++++
 .../0002-client.c-fix-build-w-musl-libc.patch | 42 ++++++++++++++++++
 2 files changed, 85 insertions(+)
 create mode 100644 package/mcelog/0001-server-Correct-prameter-type-for-connect-API.patch
 create mode 100644 package/mcelog/0002-client.c-fix-build-w-musl-libc.patch
package/mcelog/0001-server-Correct-prameter-type-for-connect-API.patch new file +43 -0
new file mode 100644
index 0000000000..cc9d0e84c6
@@ -0,0 +1,43 @@
+From c17897deb52daab300c585a6a6c2456d062d80cf Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 11 May 2024 22:50:19 -0700
+Subject: [PATCH] server: Correct prameter type for connect() API
+
+connect() function expects the second argument to be point to sockaddr
+as per man sockaddr
+
+int connect (int, const struct sockaddr *, socklen_t);
+
+Fixes build failures with -Wincompatible-pointer-types when using GCC-14
+and musl
+
+Fixes
+| server.c: In function 'server_ping':
+| server.c:308:33: error: passing argument 2 of 'connect' from incompatible pointer type [-Wincompatible-pointer-types]
+|   308 |                 if (connect(fd, un, sizeof(struct sockaddr_un)) < 0)
+|       |                                 ^~
+|       |                                 |
+|       |                                 struct sockaddr_un *
+
+Signed-off-by: Andi Kleen <[email protected]>
+
+Upstream: https://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git/commit/?id=c17897deb52daab300c585a6a6c2456d062d80cf
+
+Signed-off-by: Bernd Kuhls <[email protected]>
+---
+ server.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/server.c b/server.c
+index 54c7d57..51b7d3a 100644
+--- a/server.c
++++ b/server.c
+@@ -305,7 +305,7 @@ static int server_ping(struct sockaddr_un *un)
+ 	if (sigsetjmp(ping_timeout_ctx, 1) == 0) {
+ 		ret = -1;
+ 		alarm(initial_ping_timeout);
+-		if (connect(fd, un, sizeof(struct sockaddr_un)) < 0)
++		if (connect(fd, (const struct sockaddr *)un, sizeof(struct sockaddr_un)) < 0)
+ 			goto cleanup;
+ 		if (write(fd, PAIR("ping\n")) < 0)
+ 			goto cleanup;
package/mcelog/0002-client.c-fix-build-w-musl-libc.patch new file +42 -0
new file mode 100644
index 0000000000..f7334c8c6f
@@ -0,0 +1,42 @@
+From a90e39f896a2f1b76ad3c304b69c451ec92a687a Mon Sep 17 00:00:00 2001
+From: Brahmajit Das <[email protected]>
+Date: Mon, 12 Jun 2023 10:55:28 +0000
+Subject: [PATCH] client.c: fix build w/ musl libc
+
+Without the patch, I'm getting the following error:
+
+client.c:47:2: error: call to undeclared library function 'strncpy' with type
+      'char *(char *, const char *, unsigned long)'; ISO C99 and later do not support implicit function declarations
+      [-Wimplicit-function-declaration]
+        strncpy(sun.sun_path, path, sizeof(sun.sun_path)-1);
+        ^
+client.c:47:2: note: include the header <string.h> or explicitly provide a declaration for 'strncpy'
+client.c:60:19: error: call to undeclared library function 'memcmp' with type 'int
+      (const void *, const void *, unsigned long)'; ISO C99 and later do not support implicit function declarations
+      [-Wimplicit-function-declaration]
+                        if (n >= 5 && !memcmp(buf + n - 5, "done\n", 5)) {
+                                       ^
+client.c:60:19: note: include the header <string.h> or explicitly provide a declaration for 'memcmp'
+2 errors generated.
+
+Signed-off-by: Brahmajit Das <[email protected]>
+
+Upstream: https://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git/commit/?id=a90e39f896a2f1b76ad3c304b69c451ec92a687a
+
+Signed-off-by: Bernd Kuhls <[email protected]>
+---
+ client.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/client.c b/client.c
+index 883b1de..7119ed9 100644
+--- a/client.c
++++ b/client.c
+@@ -19,6 +19,7 @@
+ #include <sys/socket.h>
+ #include <sys/un.h>
+ #include <unistd.h>
++#include <string.h>
+ #include "mcelog.h"
+ #include "client.h"
+ #include "paths.h"
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot