Skip to contentSkip to conversation

package/jemalloc: fix build on m68k/uClibc

PATCH Applied Bernd Kuhls 2 participants 6 messages Apr 18 – Jun 5

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 package/jemalloc: fix build on m68k/uClibc

include/jemalloc/internal/jemalloc_internal_inlines_a.h:16:32: error:
implicit declaration of function 'sched_getcpu'; did you mean 'SYS_getcpu'? [-Wimplicit-function-declaration]
16 | return (malloc_cpuid_t)sched_getcpu();

Added -D_GNU_SOURCE to CFLAGS because

extern int sched_getcpu

is wrapped with __USE_GNU:
https://github.com/wbx-github/uclibc-ng/blob/v1.0.57/libc/sysdeps/linux/common/bits/sched.h#L80C1-L80C17

Fixes:
https://autobuild.buildroot.net/results/57c/57c68aad9abcce7621fbff52081da041485e8830/

---
 package/jemalloc/jemalloc.mk | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
package/jemalloc/jemalloc.mk +5 -1
index bd8a2d7654..0c46f65029 100644
@@ -12,11 +12,15 @@ JEMALLOC_LICENSE_FILES = COPYING
 JEMALLOC_INSTALL_STAGING = YES
 JEMALLOC_CONFIG_SCRIPTS = jemalloc-config
 
+JEMALLOC_CFLAGS = $(TARGET_CFLAGS) -D_GNU_SOURCE
+
 # gcc bug internal compiler error: in merge_overlapping_regs, at
 # regrename.c:304. This bug is fixed since gcc 6.
 ifeq ($(BR2_or1k):$(BR2_TOOLCHAIN_GCC_AT_LEAST_6),y:)
-JEMALLOC_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -O0"
+JEMALLOC_CFLAGS += -O0
 endif
 
+JEMALLOC_CONF_ENV += CFLAGS="$(JEMALLOC_CFLAGS)"
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
Signature · 6 lines
2.47.3

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

PATCH 2/3 package/jemalloc: needs MMU

src/pages.c:79:33: error: 'MADV_DONTNEED' undeclared (first use in this
function)
79 | if (madvise(addr, size, MADV_DONTNEED) == 0) {

The oldest build error found in the autobuilder logs dates back to 2024:
https://autobuild.buildroot.net/results/adf/adf52f767c92ab1db7b817094a3929f3cf918e82/
so a backport to LTS branches should be considered.

Fixes:
https://autobuild.buildroot.net/results/d6a/d6a9f7ff9d29eee9d9280364f872ffaa1544f192/

---
 package/jemalloc/Config.in | 2 ++
 1 file changed, 2 insertions(+)
package/jemalloc/Config.in +2 -0
index a128b8b376..ace3dccd1e 100644
@@ -16,6 +16,7 @@ config BR2_PACKAGE_JEMALLOC
 	bool "jemalloc"
 	depends on BR2_PACKAGE_JEMALLOC_ARCH_SUPPORTS
 	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_USE_MMU # madvise()
 	help
 	  This library providing a malloc(3) implementation that
 	  emphasizes fragmentation avoidance and scalable concurrency
@@ -25,4 +26,5 @@ config BR2_PACKAGE_JEMALLOC
 
 comment "jemalloc needs a toolchain w/ threads"
 	depends on BR2_PACKAGE_JEMALLOC_ARCH_SUPPORTS
+	depends on BR2_USE_MMU
 	depends on !BR2_TOOLCHAIN_HAS_THREADS
Signature · 6 lines
2.47.3

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

Re: [Buildroot] [PATCH 2/3] package/jemalloc: needs MMU

In reply of:

Quoted 4 lines

src/pages.c:79:33: error: 'MADV_DONTNEED' undeclared (first use in this
function)
79 | if (madvise(addr, size, MADV_DONTNEED) == 0) {

Quoted 8 lines

The oldest build error found in the autobuilder logs dates back to 2024:
https://autobuild.buildroot.net/results/adf/adf52f767c92ab1db7b817094a3929f3cf918e82/
so a backport to LTS branches should be considered.

Fixes:
https://autobuild.buildroot.net/results/d6a/d6a9f7ff9d29eee9d9280364f872ffaa1544f192/

Applied to 2025.02.x & 2026.02.x. Thanks

Quoted 29 lines
---
 package/jemalloc/Config.in | 2 ++
 1 file changed, 2 insertions(+)
package/jemalloc/Config.in +2 -0
index a128b8b376..ace3dccd1e 100644
@@ -16,6 +16,7 @@ config BR2_PACKAGE_JEMALLOC
 	bool "jemalloc"
 	depends on BR2_PACKAGE_JEMALLOC_ARCH_SUPPORTS
 	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_USE_MMU # madvise()
 	help
 	  This library providing a malloc(3) implementation that
 	  emphasizes fragmentation avoidance and scalable concurrency
@@ -25,4 +26,5 @@ config BR2_PACKAGE_JEMALLOC
 
 comment "jemalloc needs a toolchain w/ threads"
 	depends on BR2_PACKAGE_JEMALLOC_ARCH_SUPPORTS
+	depends on BR2_USE_MMU
 	depends on !BR2_TOOLCHAIN_HAS_THREADS
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

#3 lore raw

PATCH 3/3 package/jemalloc: bump version to 5.3.1

In reply to Bernd Kuhls

https://github.com/jemalloc/jemalloc/blob/5.3.1/ChangeLog

Switched to sha256 tarball hash provided by upstream.

---
 package/jemalloc/jemalloc.hash | 3 ++-
 package/jemalloc/jemalloc.mk   | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
package/jemalloc/jemalloc.hash +2 -1
index 214fe8062b..7abaccd6b3 100644
@@ -1,3 +1,4 @@
+# From https://github.com/jemalloc/jemalloc/releases/tag/5.3.1
+sha256  3826bc80232f22ed5c4662f3034f799ca316e819103bdc7bb99018a421706f92  jemalloc-5.3.1.tar.bz2
 # Locally calculated
-sha256  2db82d1e7119df3e71b7640219b6dfe84789bc0537983c3b7ac4f7189aecfeaa  jemalloc-5.3.0.tar.bz2
 sha256  94aa2caa98c25d942f58b956c71dba6a99ff98fc3a31cbc669fe2a4cd0268b53  COPYING
package/jemalloc/jemalloc.mk +1 -1
index 0c46f65029..61045c50d5 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-JEMALLOC_VERSION = 5.3.0
+JEMALLOC_VERSION = 5.3.1
 JEMALLOC_SOURCE = jemalloc-$(JEMALLOC_VERSION).tar.bz2
 JEMALLOC_SITE = https://github.com/jemalloc/jemalloc/releases/download/$(JEMALLOC_VERSION)
 JEMALLOC_LICENSE = BSD-2-Clause
Signature · 6 lines
2.47.3

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

include/jemalloc/internal/jemalloc_internal_inlines_a.h:16:32: error:
implicit declaration of function 'sched_getcpu'; did you mean 'SYS_getcpu'? [-Wimplicit-function-declaration]

    16 |         return (malloc_cpuid_t)sched_getcpu();

Added -D_GNU_SOURCE to CFLAGS because

extern int sched_getcpu

Quoted 7 lines

is wrapped with __USE_GNU:
https://github.com/wbx-github/uclibc-ng/blob/v1.0.57/libc/sysdeps/linux/common/bits/sched.h#L80C1-L80C17

Fixes:
https://autobuild.buildroot.net/results/57c/57c68aad9abcce7621fbff52081da041485e8830/

Applied 1 and 2 to master and 3 to next.

Regards,
ARnout

Quoted 15 lines
---
  package/jemalloc/jemalloc.mk | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
package/jemalloc/jemalloc.mk +2 -0
index bd8a2d7654..0c46f65029 100644
@@ -12,11 +12,15 @@ JEMALLOC_LICENSE_FILES = COPYING
  JEMALLOC_INSTALL_STAGING = YES
  JEMALLOC_CONFIG_SCRIPTS = jemalloc-config
 
+JEMALLOC_CFLAGS = $(TARGET_CFLAGS) -D_GNU_SOURCE
+
  # gcc bug internal compiler error: in merge_overlapping_regs, at

package/jemalloc/jemalloc.mk JEMALLOC_LICENSE_FILES = COPYING · line 26

Quoted 10 lines
package/jemalloc/jemalloc.mk +3 -1
  # regrename.c:304. This bug is fixed since gcc 6.
  ifeq ($(BR2_or1k):$(BR2_TOOLCHAIN_GCC_AT_LEAST_6),y:)
-JEMALLOC_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -O0"
+JEMALLOC_CFLAGS += -O0
  endif
 
+JEMALLOC_CONF_ENV += CFLAGS="$(JEMALLOC_CFLAGS)"
+
  $(eval $(autotools-package))
  $(eval $(host-autotools-package))

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

#5 lore raw
In reply to Bernd Kuhls

In reply of:

Quoted 9 lines

include/jemalloc/internal/jemalloc_internal_inlines_a.h:16:32: error:
implicit declaration of function 'sched_getcpu'; did you mean 'SYS_getcpu'? [-Wimplicit-function-declaration]
16 | return (malloc_cpuid_t)sched_getcpu();

Added -D_GNU_SOURCE to CFLAGS because

extern int sched_getcpu

Quoted 7 lines

is wrapped with __USE_GNU:
https://github.com/wbx-github/uclibc-ng/blob/v1.0.57/libc/sysdeps/linux/common/bits/sched.h#L80C1-L80C17

Fixes:
https://autobuild.buildroot.net/results/57c/57c68aad9abcce7621fbff52081da041485e8830/

Applied to 2025.02.x & 2026.02.x. Thanks

Quoted 32 lines
---
 package/jemalloc/jemalloc.mk | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
package/jemalloc/jemalloc.mk +5 -1
index bd8a2d7654..0c46f65029 100644
@@ -12,11 +12,15 @@ JEMALLOC_LICENSE_FILES = COPYING
 JEMALLOC_INSTALL_STAGING = YES
 JEMALLOC_CONFIG_SCRIPTS = jemalloc-config
 
+JEMALLOC_CFLAGS = $(TARGET_CFLAGS) -D_GNU_SOURCE
+
 # gcc bug internal compiler error: in merge_overlapping_regs, at
 # regrename.c:304. This bug is fixed since gcc 6.
 ifeq ($(BR2_or1k):$(BR2_TOOLCHAIN_GCC_AT_LEAST_6),y:)
-JEMALLOC_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -O0"
+JEMALLOC_CFLAGS += -O0
 endif
 
+JEMALLOC_CONF_ENV += CFLAGS="$(JEMALLOC_CFLAGS)"
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
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