Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Conversation

schoppmp
Copy link
Contributor

The current Bazel build configuration assumes that <sys/syscall.h> is present on non-windows targets, which is not the case when building with emscripten. This PR fixes the issue.

Since there is no config_setting for Linux
(bazelbuild/bazel#11107), Linux needs to be
the default case.
@ukai ukai added the LGTM label May 13, 2020
@ukai ukai merged commit 0a2e593 into google:master May 13, 2020
@tuankiet65
Copy link

Seems like this is only fixed for Bazel but not CMake. I have a CMake project and while compiling I got the error that syscall is not declared:

In file included from third_party/glog/src/raw_logging.cc:34:
In file included from third_party/glog/src/utilities.h:84:
build/emscripten-debug/third_party/glog/glog/logging.h:1438:68: warning: unused parameter 'usecs' [-Wunused-parameter]
                    const char* message, size_t message_len, int32 usecs) {
                                                                   ^
third_party/glog/src/raw_logging.cc:139:3: error: use of undeclared identifier 'syscall'
  safe_write(STDERR_FILENO, buffer, strlen(buffer));
  ^
third_party/glog/src/raw_logging.cc:63:34: note: expanded from macro 'safe_write'
# define safe_write(fd, s, len)  syscall(SYS_write, fd, s, len)
                                 ^
1 warning and 1 error generated.

# Config setting for WebAssembly target.
native.config_setting(
name = "wasm",
values = {"cpu": "wasm"},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shortly before this code was submitted, wasm32 and wasm64 were added in bazelbuild/platforms@966defd as standard WebAssembly CPU architectures: BUILD#L83-91.

Maybe this should be changed accordingly (i.e. split into two config settings, and list them both in the select below).

@sergiud sergiud added this to the 0.5 milestone Mar 30, 2021
@sergiud sergiud mentioned this pull request May 6, 2021
@drigz drigz mentioned this pull request Dec 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants