Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.0.1 build fails #988

Open
moubctez opened this issue Jan 13, 2025 · 1 comment
Open

v3.0.1 build fails #988

moubctez opened this issue Jan 13, 2025 · 1 comment

Comments

@moubctez
Copy link

Trying to build v3.0.1 on NetBSD gives:

In file included from /tmp/pkgsrc/devel/mimalloc/work/mimalloc-3.0.1/src/prim/prim.c:25,
                 from /tmp/pkgsrc/devel/mimalloc/work/mimalloc-3.0.1/src/static.c:38:
/tmp/pkgsrc/devel/mimalloc/work/mimalloc-3.0.1/src/prim/unix/prim.c: In function 'unix_mmap_prim':
/tmp/pkgsrc/devel/mimalloc/work/mimalloc-3.0.1/src/prim/unix/prim.c:204:16: error: too few arguments to function 'mi_bsr'
  204 |     size_t n = mi_bsr(try_alignment);
      |                ^~~~~~
In file included from /tmp/pkgsrc/devel/mimalloc/work/mimalloc-3.0.1/include/mimalloc/types.h:25,
                 from /tmp/pkgsrc/devel/mimalloc/work/mimalloc-3.0.1/include/mimalloc/internal.h:17,
                 from /tmp/pkgsrc/devel/mimalloc/work/mimalloc-3.0.1/src/static.c:17:
/tmp/pkgsrc/devel/mimalloc/work/mimalloc-3.0.1/include/mimalloc/bits.h:269:20: note: declared here
  269 | static inline bool mi_bsr(size_t x, size_t* idx) {
      |                    ^~~~~~

My fix:

--- src/prim/unix/prim.c.orig	2025-01-13 10:00:52.394506291 +0000
+++ src/prim/unix/prim.c
@@ -201,7 +201,8 @@ static void* unix_mmap_prim(void* addr, 
   void* p = NULL;
   #if defined(MAP_ALIGNED)  // BSD
   if (addr == NULL && try_alignment > 1 && (try_alignment % _mi_os_page_size()) == 0) {
-    size_t n = mi_bsr(try_alignment);
+    size_t idx;
+    size_t n = mi_bsr(try_alignment, &idx);
     if (((size_t)1 << n) == try_alignment && n >= 12 && n <= 30) {  // alignment is a power of 2 and 4096 <= alignment <= 1GiB
       p = mmap(addr, size, protect_flags, flags | MAP_ALIGNED(n), fd, 0);
       if (p==MAP_FAILED || !_mi_is_aligned(p,try_alignment)) {
freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Jan 13, 2025
Apply patch to fix build [1]

Obtained from:	microsoft/mimalloc#988 [1]
@daanx
Copy link
Collaborator

daanx commented Jan 13, 2025

Thanks! I'll push a fix soon

daanx added a commit that referenced this issue Jan 14, 2025
nanorkyo pushed a commit to nanorkyo/freebsd-ports that referenced this issue Jan 18, 2025
Apply patch to fix build [1]

Obtained from:	microsoft/mimalloc#988 [1]
nanorkyo pushed a commit to nanorkyo/freebsd-ports that referenced this issue Jan 18, 2025
Apply patch to fix build [1]

Obtained from:	microsoft/mimalloc#988 [1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants