Repository navigation
Closed
Description
Expected outcome
workerd should build fine using bazel.
Current outcome
When I try to compile workerd, it fails with the following error message:
jonas@jonas-asus:~/repos/clones/cloudflare/workerd$ bazel build -c opt //src/workerd/server:workerd
INFO: Analyzed target //src/workerd/server:workerd (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /home/jonas/.cache/bazel/_bazel_jonas/c86f39fb6ae3f61b12a0ae374033648e/external/capnp-cpp/src/kj/BUILD.bazel:5:11: Compiling src/kj/source-location.c++ failed: undeclared inclusion(s) in rule '@capnp-cpp//src/kj:kj':
this rule is missing dependency declarations for the following files included by 'src/kj/source-location.c++':
'/usr/lib/llvm-14/include/c++/v1/initializer_list'
'/usr/lib/llvm-14/include/c++/v1/__config'
'/usr/lib/llvm-14/include/c++/v1/__config_site'
'/usr/lib/llvm-14/include/c++/v1/cstddef'
'/usr/lib/llvm-14/include/c++/v1/version'
'/usr/lib/llvm-14/include/c++/v1/__nullptr'
'/usr/lib/llvm-14/include/c++/v1/stddef.h'
'/usr/lib/llvm-14/include/c++/v1/cstring'
'/usr/lib/llvm-14/include/c++/v1/string.h'
Target //src/workerd/server:workerd failed to build
INFO: Elapsed time: 1.298s, Critical Path: 0.52s
INFO: 18 processes: 17 internal, 1 linux-sandbox.
FAILED: Build did NOT complete successfullyTries
I have tried the following:
- Install
clang-14using apt - Install
libc++-devusing apt - Install
libc++abi-devusing apt
OS info
jonas@jonas-asus:~/repos/clones/cloudflare/workerd$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
Activity
[-]Unable to build workerd on Ubuntu 22.04[/-][+]Unable to build workerd on Ubuntu 22.04.1[/+][-]Unable to build workerd on Ubuntu 22.04.1[/-][+]Unable to build `workerd` on Ubuntu 22.04.1[/+]kentonv commentedon Sep 28, 2022
This is some sort of bazel bug where it gets confused about built-in headers. Can you try adding this flag to
bazel build:--action_env=CXX=$(which clang++)This tells Bazel the full path to clang, which seems to help it understand better where to expect built-in includes to live.
kentonv commentedon Sep 28, 2022
Hmm I'm also a little confused as the GitHub Action I defined in #8 uses Ubuntu 22.04 and the build managed to succeed there?
Erisa commentedon Sep 28, 2022
Wasn't me that opened this issue but I was having the same (or similar) issue on Ubuntu 22.04 and this doesn't help:
Though
clang++is a binary that exists, and the files it's referring to in the error also appear to exist, which is the confusing part.I also tried installing
libc++abi-dev(Which wasn't installed) alongside the other deps (Which were installed) as noted in #8 (comment), but that doesn't seem to have made a difference.The C++ file(s) that it cites in the error seem to change across runs, likely just whichever ones it gets to first.
jonasclaes commentedon Sep 29, 2022
I have just tried this, but to no avail. I have added the output below. Could this be an LLVM 14 version issue?
Showing the versions of the libraries:
dom96 commentedon Sep 29, 2022
I recall running into similar things, IIRC the answer in https://stackoverflow.com/questions/53527134/bazel-missing-dependency-declarations-for-stddef-h-and-others-ubuntu-18-04 helped, i.e. try running
bazel clean --expungeand see ifbazel build -c opt //src/workerd/server:workerdthen works.Erisa commentedon Sep 29, 2022
Thanks for this! Running the clean fixed it for me. It's now building.
kentonv commentedon Sep 30, 2022
OK, so what's the best way for us to help people avoid this going forward? Some README note or is there more we can do?
jonasclaes commentedon Sep 30, 2022
@kentonv I have created PR #59 which adds this little step to the documentation. It should resolve most of the cases of this specific issue.
jonasclaes commentedon Oct 3, 2022
This has been merged with PR #59. Thank all!
fix(server): facet channel UaF after alarm timeout
fix(server): facet channel UaF after alarm timeout
Pin how byte streams reject arguments that are not views
Pin how byte streams reject arguments that are not views