From: "naruse (Yui NARUSE)" <noreply@...>
Date: 2022-02-07T10:55:53+00:00
Subject: [ruby-core:107498] [Ruby master Bug#18556] error: use of undeclared identifier 'MAP_ANONYMOUS'

Issue #18556 has been updated by naruse (Yui NARUSE).

Backport changed from 2.6: DONTNEED, 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED to 2.6: DONTNEED, 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONE

ruby_3_1 e54289bb632047b750f9c9371410d1adff2a740a merged revision(s) 67f4729.

----------------------------------------
Bug #18556: error: use of undeclared identifier 'MAP_ANONYMOUS'
https://bugs.ruby-lang.org/issues/18556#change-96405

* Author: ryandesign (Ryan Schmidt)
* Status: Closed
* Priority: Normal
* ruby -v: 3.1.0
* Backport: 2.6: DONTNEED, 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONE
----------------------------------------
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.)



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>