Project

General

Profile

Actions

Bug #18556

closed

error: use of undeclared identifier 'MAP_ANONYMOUS'

Added by ryandesign (Ryan Schmidt) 5 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:107336]

Description

ruby 3.1.0 fails to build on older versions of macOS such as OS X 10.10.5:

gc.c:11141:88: error: use of undeclared identifier 'MAP_ANONYMOUS'
        char *ptr = mmap(NULL, alignment + size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
                                                                                       ^
1 error generated.

MAP_ANONYMOUS used to be called MAP_ANON on older systems; I suggest either using MAP_ANON everywhere you're using MAP_ANONYMOUS, or else add a block like this somewhere central that each of those files uses:

#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif

or

#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
#define MAP_ANONYMOUS MAP_ANON
#endif

(Such blocks already occur in multiple places under ext/fiddle/libffi-3.2.1 in the ruby 3.1.0 source code.)

Actions

Also available in: Atom PDF