wabt icon indicating copy to clipboard operation
wabt copied to clipboard

MAP_ANONYMOUS undefined on OS X 10.10 and earlier (pre-2015)

Open jakirkham opened this issue 4 years ago • 8 comments

Seeing the following error when compiling macOS. It appears the MAP_ANONYMOUS flag may not be defined, but perhaps MAP_ANON would be a good substitute

../wasm2c/wasm-rt-impl.c:133:58: error: use of undeclared identifier 'MAP_ANONYMOUS'
      mmap(NULL, 0x200000000ul, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
                                                         ^
1 error generated.

jakirkham avatar Mar 03 '21 07:03 jakirkham

Any thoughts on this issue?

jakirkham avatar May 13 '21 23:05 jakirkham

Sorry to keep bumping this. We are unable to build on macOS ever since this issue surfaced. Any help here would be appreciated :)

jakirkham avatar Aug 30 '21 22:08 jakirkham

FWIW, a workaround used elsewhere: https://searchfox.org/mozilla-central/source/toolkit/crashreporter/google-breakpad/src/common/memory_allocator.h#45

lars-t-hansen avatar Sep 02 '21 09:09 lars-t-hansen

Looks like an easy fix. I'm confused why this isn't causing a built failure during CI. I will take a look.

sbc100 avatar Sep 02 '21 12:09 sbc100

Odd .. I can see wasm-rt-impl.c being compiled just fine by the github CI https://github.com/WebAssembly/wabt/runs/3257150141#step:10:18.

sbc100 avatar Sep 02 '21 12:09 sbc100

Closing as dormant and "works in CI." Please reopen or comment if somebody is still having trouble here.

keithw avatar Sep 18 '22 05:09 keithw

This issue is still present. Please reopen.

Here's a recent build log demonstrating the issue when our downstream patch is removed ( https://github.com/conda-forge/wabt-feedstock/pull/25/commits/65ee0ea7a631051f4e829c9dbb8c5578f5a63a82 ).

All it would take for one to fix it would be to define MAP_ANON with MAP_ANONYMOUS if only the latter is defined.

jakirkham avatar Sep 18 '22 15:09 jakirkham

Ok, reopening and did some Googling.

It looks like MacOS added MAP_ANONYMOUS in 2015 (with the release of El Capitan 10.11). The problem here looks to be that the linked build log is compiling with the SDK for Mac OS 10.9, released in 2013 and no longer supported.

If you'd like to submit a PR to add support for Mac OS <10.11, I'm happy to take a look, but it's going to be hard for us to get test coverage/CI there. Other options probably include (a) compiling on a more recent version of MacOS, (b) keeping a local patch, or (c) disabling the build of wasm-rt-impl. (It's an example runtime meant to show how to embed wasm2c output in a POSIX-like environment; wabt uses it for running the wasm2c tests but that's it. Arguably wabt should only build it when running the wasm2c tests...)

keithw avatar Sep 18 '22 18:09 keithw

Closing as dormant/unresponded-to. We would still take a PR on this.

keithw avatar Feb 13 '23 10:02 keithw