-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow building when targeting WASI #1509
Conversation
@@ -395,7 +395,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || | |||
// Windows _WIN32 | |||
// NaCL __native_client__ | |||
// AsmJS __asmjs__ | |||
// WebAssembly __wasm__ | |||
// WebAssembly (Emscripten) __EMSCRIPTEN__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WebAssembly is an architecture, such as x86, not an operating system, which is a syscall layer so in its case, either Emscripten or WASI currently. I have changed this to clarify, as Emscripten is a WebAssembly "OS" which supports mmap while WASI does not.
I can add wasi to this list if it makes sense, but I suspect that would be a bigger decision on whether the project officially supports the OS now or not. But it would be great if we can at least add smaller fixes like this PR on a best-effort basis to allow compilation to pass to encourage the use of abseil within the server-side WebAssembly community
@@ -54,7 +54,7 @@ | |||
#include "absl/debugging/internal/examine_stack.h" | |||
#include "absl/debugging/stacktrace.h" | |||
|
|||
#ifndef _WIN32 | |||
#if !defined(_WIN32) && !defined(__wasi__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that Emscripten does support this codepath while wasi doesn't so I added a wasi-specific option here
To build, I did
|
/cc @sbc100 @abrown in case any questions about wasi-sdk come up I'm not familiar with Also, just in case it helps to have a use case in mind, I compile RE2 to WASI for loading in Go apps. https://github.com/wasilibs/go-re2 But RE2 has migrated to using |
In ec9fa08 I went ahead and added a wasi guard for the signal header file in thread_identity to at least allow that file to compile without the stubbed header file enabled via |
I'm testing this now. WASI won't receive official support, but this PR is simple enough that if it works, we can take it. |
Imported from GitHub PR abseil#1509 WASI is similar to emscripten, providing a syscall layer to WebAssembly focused on server side applications. There are some config knobs that are in place to allow building the repo for emscripten which also need to support wasi (as built with LLVM). Aside from that, there are still some features it supports less than escripten, for example related to signals, causing the build to be even more limited for it. Merge ec9fa08 into 861e53c Merging this change closes abseil#1509 COPYBARA_INTEGRATE_REVIEW=abseil#1509 from anuraaga:wasi-sdk-build ec9fa08 PiperOrigin-RevId: 557166498 Change-Id: Ic51149d8b092fd888c9a5c383275257fc8ff4232
WASI is similar to emscripten, providing a syscall layer to WebAssembly focused on server side applications. There are some config knobs that are in place to allow building the repo for emscripten which also need to support wasi (as built with LLVM). Aside from that, there are still some features it supports less than escripten, for example related to signals, causing the build to be even more limited for it.