error: use of undeclared identifier 'MAP_ANONYMOUS'

Open
#245 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
38/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
cpp, macos

Research direction

Start with absl/debugging/internal/examine_stack.cc and absl/debugging/internal/stack_consumption.cc, then compare the existing portability handling in low_level_alloc.cc, failure_signal_handler.cc, and s2/base/port.h. Confirm the compatibility change covers OS X 10.10 and earlier, while preserving behavior on newer Darwin systems, and verify that s2 builds successfully.

Written by the indexing model from the issue text.

Description

s2 fails to build on OS X 10.10 and earlier:

https://trac.macports.org/ticket/67784

absl/debugging/internal/examine_stack.cc:58:34: error: use of undeclared identifier 'MAP_ANONYMOUS'
                   MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
                                 ^
1 error generated.

MAP_ANONYMOUS is equivalent to MAP_ANON which is available on older systems.

There are several places where you already have code to address this:

https://github.com/r-spatial/s2/blob/4fe0c97df91c98a24f379bfc3d8d4544f4835117/src/absl/base/internal/low_level_alloc.cc#L56-L63

https://github.com/r-spatial/s2/blob/4fe0c97df91c98a24f379bfc3d8d4544f4835117/src/absl/debugging/failure_signal_handler.cc#L154-L156

https://github.com/r-spatial/s2/blob/4fe0c97df91c98a24f379bfc3d8d4544f4835117/src/s2/base/port.h#L574-L581

Note that the comment is outdated: MAP_ANONYMOUS does exist on Darwin in OS X 10.11 (released 2015) and later.

There are two places where similar code needs to be added, or it needs to be moved into a more central include file:

https://github.com/r-spatial/s2/blob/4fe0c97df91c98a24f379bfc3d8d4544f4835117/src/absl/debugging/internal/examine_stack.cc#L57-L58

https://github.com/r-spatial/s2/blob/4fe0c97df91c98a24f379bfc3d8d4544f4835117/src/absl/debugging/internal/stack_consumption.cc#L113-L114

I see no reason to limit the fix to systems where __APPLE__ is defined.

Dominant language
C++
Stars
81
Forks
19
Avg merge
20h 25m
Merged PRs (30d)
3

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from r-spatial/s2

All issues in r-spatial/s2

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.