Closed panjea closed 5 months ago
What version of Bazel do you have? (bazel --version
or bazel info
should show)
My guess is that it is a (quite) old system installed Bazel. I suspect you'll want to use Bazelisk: https://bazel.build/install/bazelisk
We should probably update our docs to make this more clear...
The same occurred for me on ubuntu 22.04 LTS. I had to download bazel 7.1.2 to get it to work because ubuntu ships with bazel 3.5.X
i installed bazelisk, but now get this error:
~/carbon-lang$ /usr/local/bin/bazelisk-linux-amd64 run //explorer -- ./explorer/testdata/print/format_only.carbon
2024/05/26 12:43:59 Downloading https://releases.bazel.build/7.1.2/release/bazel-7.1.2-linux-x86_64...
Downloading: 66 MB out of 66 MB (100%)
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
INFO: Invocation ID: 0f57a49d-69c2-48b9-8d67-1247ec5dcd9d
INFO: Analyzed target //explorer:explorer (109 packages loaded, 2115 targets configured).
ERROR: /home/rap/.cache/bazel/_bazel_rap/6a55a3082644891e2316d6f8c5b0782d/external/_main~llvm_project~llvm-project/llvm/BUILD.bazel:188:11: Compiling llvm/lib/Demangle/DLangDemangle.cpp failed: (Exit 1): clang++ failed: error executing CppCompile command (from target @@_main~llvm_project~llvm-project//llvm:Demangle) /usr/lib/llvm-16/bin/clang++ -no-canonical-prefixes -fcolor-diagnostics -Werror -Wall -Wextra -Wthread-safety -Wself-assign -Wimplicit-fallthrough -Wctad-maybe-unsupported -Wdelete-non-virtual-dtor ... (remaining 69 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from external/_main~llvm_project~llvm-project/llvm/lib/Demangle/DLangDemangle.cpp:16:
external/_main~llvm_project~llvm-project/llvm/include/llvm/Demangle/Demangle.h:12:10: fatal error: 'cstddef' file not found
#include <cstddef>
^~~~~~~~~
1 error generated.
Target //explorer:explorer failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 72.347s, Critical Path: 0.71s
INFO: 209 processes: 154 internal, 55 linux-sandbox.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target
sudo apt install libstdc++-12-dev
fixes the previous error
next error is:
/usr/local/bin/bazelisk-linux-amd64 run //explorer -- ./explorer/testdata/print/format_only.carbon
INFO: Invocation ID: c47d5d74-d837-4f78-93ab-7b0c1eb44af4
INFO: Analyzed target //explorer:explorer (0 packages loaded, 0 targets configured).
ERROR: /home/rap/.cache/bazel/_bazel_rap/6a55a3082644891e2316d6f8c5b0782d/external/_main~llvm_project~llvm-project/llvm/BUILD.bazel:215:11: Compiling llvm/lib/Support/Hashing.cpp failed: (Exit 1): clang++ failed: error executing CppCompile command (from target @@_main~llvm_project~llvm-project//llvm:Support) /usr/lib/llvm-16/bin/clang++ -no-canonical-prefixes -fcolor-diagnostics -Werror -Wall -Wextra -Wthread-safety -Wself-assign -Wimplicit-fallthrough -Wctad-maybe-unsupported -Wdelete-non-virtual-dtor ... (remaining 86 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from external/_main~llvm_project~llvm-project/llvm/lib/Support/Hashing.cpp:15:
In file included from external/_main~llvm_project~llvm-project/llvm/include/llvm/ADT/Hashing.h:49:
In file included from external/_main~llvm_project~llvm-project/llvm/include/llvm/Support/SwapByteOrder.h:17:
external/_main~llvm_project~llvm-project/llvm/include/llvm/ADT/STLForwardCompat.h:20:10: fatal error: 'optional' file not found
#include <optional>
^~~~~~~~~~
1 error generated.
Target //explorer:explorer failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.881s, Critical Path: 0.43s
INFO: 34 processes: 34 internal.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target
All of these seem likely to be missing packages in the setup suggested here: https://github.com/carbon-language/carbon-lang/blob/trunk/docs/project/contribution_tools.md#debian-or-ubuntu
Can you confirm you've done all of those steps?
I can confirm build works using bazelisk and this apt-get:
sudo apt-get install libc++abi-dev clang gh lld pipx libc++-dev
It sure would make life easier for those of us using Ubuntu if Google had better support for bazel on Debian or Ubuntu, downloading bazelisk and installing it felt like a hack.
Glad that got you working!
FWIW, we're discussing whether we can do something to avoid the difficulty of installing bazelisk. =/
Description of the bug:
sudo apt install bazel-bootstrap
git clone --depth 1 https://github.com/carbon-language/carbon-lang
cd carbon-lang
What did you do, or what's a simple way to reproduce the bug?
No response
What did you expect to happen?
No response
What actually happened?
No response
Any other information, logs, or outputs that you want to share?
No response