Skip to contentSkip to conversation

package/mbpfan: fix build on musl / uclibc-ng

PATCH Applied Peter Korsgaard 2 participants 6 messages Aug 29, 2025 – Sep 11, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/mbpfan: fix build on musl / uclibc-ng

Fixes https://autobuild.buildroot.net/results/9526503fe8e756bd4444f1fb1e9cf1391c461901/

mbpfan uses vsyslog(), which is not in POSIX so only exposed by <syslog.h> on musl and uclibc-ng if we define _DEFAULT_SOURCE:

https://git.musl-libc.org/cgit/musl/tree/include/syslog.h#n64
https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/include/sys/syslog.h#n200

---
 package/mbpfan/mbpfan.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/mbpfan/mbpfan.mk +1 -1
index 0ac161b327..bccb3ffc16 100644
@@ -10,7 +10,7 @@ MBPFAN_LICENSE = GPL-3.0+
 MBPFAN_LICENSE_FILES = COPYING
 
 define MBPFAN_BUILD_CMDS
-	$(TARGET_MAKE_ENV) CFLAGS="$(TARGET_CFLAGS)" \
+	$(TARGET_MAKE_ENV) CFLAGS="$(TARGET_CFLAGS) -D_DEFAULT_SOURCE" \
 		LDFLAGS="$(TARGET_LDFLAGS)" \
 		$(MAKE) CC="$(TARGET_CC)" -C $(@D)
 endef
Signature · 6 lines
2.39.5

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

package/mbpfan/mbpfan.mk MBPFAN_LICENSE = GPL-3.0+ · line 13

Quoted 3 lines · On Fri, 29 Aug 2025 18:52:38 +0200 Peter Korsgaard <[email protected]> wrote:

define MBPFAN_BUILD_CMDS

package/mbpfan/mbpfan.mk +1 -1
-	$(TARGET_MAKE_ENV) CFLAGS="$(TARGET_CFLAGS)" \
+	$(TARGET_MAKE_ENV) CFLAGS="$(TARGET_CFLAGS) -D_DEFAULT_SOURCE" \

Upstream seems to still be active, so what about doing the "right" thing, which is adding #define _DEFAULT_SOURCE in the source file, and submitting an upstream patch?

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

On Fri, 29 Aug 2025 18:52:38 +0200
Peter Korsgaard <[email protected]> wrote:

Quoted 7 lines

package/mbpfan/mbpfan.mk MBPFAN_LICENSE = GPL-3.0+ · line 13

Quoted 3 lines

define MBPFAN_BUILD_CMDS

package/mbpfan/mbpfan.mk +1 -1
-	$(TARGET_MAKE_ENV) CFLAGS="$(TARGET_CFLAGS)" \
+	$(TARGET_MAKE_ENV) CFLAGS="$(TARGET_CFLAGS) -D_DEFAULT_SOURCE" \

Upstream seems to still be active, so what about doing the "right" thing, which is adding #define _DEFAULT_SOURCE in the source file, and submitting an upstream patch?

OK, I'll take a look.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
In reply to Thomas Petazzoni via buildroot
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

On Fri, 29 Aug 2025 18:52:38 +0200
Peter Korsgaard <[email protected]> wrote:

Quoted 7 lines

package/mbpfan/mbpfan.mk MBPFAN_LICENSE = GPL-3.0+ · line 13

Quoted 3 lines

define MBPFAN_BUILD_CMDS

package/mbpfan/mbpfan.mk +1 -1
-	$(TARGET_MAKE_ENV) CFLAGS="$(TARGET_CFLAGS)" \
+	$(TARGET_MAKE_ENV) CFLAGS="$(TARGET_CFLAGS) -D_DEFAULT_SOURCE" \

Upstream seems to still be active, so what about doing the "right" thing, which is adding #define _DEFAULT_SOURCE in the source file, and submitting an upstream patch?

I did that:

https://github.com/linux-on-mac/mbpfan/pull/271

And committed this patch after updating it to use the patch.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw
In reply to Peter Korsgaard

In reply of:

Quoted 9 lines

Fixes https://autobuild.buildroot.net/results/9526503fe8e756bd4444f1fb1e9cf1391c461901/

mbpfan uses vsyslog(), which is not in POSIX so only exposed by <syslog.h> on musl and uclibc-ng if we define _DEFAULT_SOURCE:

https://git.musl-libc.org/cgit/musl/tree/include/syslog.h#n64
https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/include/sys/syslog.h#n200

Applied to 2025.02.x & 2025.05.x. Thanks

Quoted 24 lines
---
 package/mbpfan/mbpfan.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/mbpfan/mbpfan.mk +1 -1
index 0ac161b327..bccb3ffc16 100644
@@ -10,7 +10,7 @@ MBPFAN_LICENSE = GPL-3.0+
 MBPFAN_LICENSE_FILES = COPYING
 
 define MBPFAN_BUILD_CMDS
-	$(TARGET_MAKE_ENV) CFLAGS="$(TARGET_CFLAGS)" \
+	$(TARGET_MAKE_ENV) CFLAGS="$(TARGET_CFLAGS) -D_DEFAULT_SOURCE" \
 		LDFLAGS="$(TARGET_LDFLAGS)" \
 		$(MAKE) CC="$(TARGET_CC)" -C $(@D)
 endef
Signature · 6 lines
2.39.5

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

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

#5 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Perale <[email protected]> writes:

In reply of:

Quoted 5 lines

Fixes https://autobuild.buildroot.net/results/9526503fe8e756bd4444f1fb1e9cf1391c461901/

mbpfan uses vsyslog(), which is not in POSIX so only exposed by <syslog.h> on musl and uclibc-ng if we define _DEFAULT_SOURCE:

Quoted 6 lines
Quoted 4 lines

https://git.musl-libc.org/cgit/musl/tree/include/syslog.h#n64
https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/include/sys/syslog.h#n200

Applied to 2025.02.x & 2025.05.x. Thanks

Notice that you also need commit 717138c83c857 ("package/mbpfan: fix musl / uclibc-ng patch").

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot