Small fixes for macos

98 views
Skip to first unread message

Edoardo Cipriano

unread,
Oct 18, 2025, 3:46:46 PMOct 18
to basilisk-fr
Hi Stephane,

I would like to propose a couple of small fixes for compatibility with MacOS.

After pulling the latest patches I got a compilation error in the virtual memory functions:

/Users/ecipriano/basilisk/basilisk/src/grid/memindex/virtual.h:103:79: error: use of undeclared identifier 'MAP_ANONYMOUS'

  103 |     m->b = mmap (NULL, len*sizeof (char *), PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);

      |                                                                               ^

/Users/ecipriano/basilisk/basilisk/src/grid/memindex/virtual.h:107:82: error: use of undeclared identifier 'MAP_ANONYMOUS'

  107 |     m->b[i] = mmap (NULL, len*sizeof (char *), PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);

      |                                                                                  ^

/Users/ecipriano/basilisk/basilisk/src/grid/memindex/virtual.h:135:7: error: call to undeclared function 'madvise'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

  135 |   if (madvise (start, 4096, MADV_DONTNEED))

      |       ^

/Users/ecipriano/basilisk/basilisk/src/grid/memindex/virtual.h:135:29: error: use of undeclared identifier 'MADV_DONTNEED'

  135 |   if (madvise (start, 4096, MADV_DONTNEED))

      |                             ^


These were fixed by adding:

CFLAGS += -D_DARWIN_C_SOURCE

to config.osx.

Additionally, my compiler reports an unused variable 'len' at line 939 of src/grid/cartesian-common.h, for which NOT_UNUSED is not applied.

Finally, at the end of a 'make file.tst' command, macos throws the error:

/Users/ecipriano/basilisk/basilisk/src/runtest: line 88: kill: (11142) - No such process


I couldn't find a better solution than commenting out line 88. :D

Best,
Edoardo
Reply all
Reply to author
Forward
0 new messages