carbon-lang icon indicating copy to clipboard operation
carbon-lang copied to clipboard

Unable to build on Linux

Open ShauryaAg opened this issue 3 years ago • 3 comments

When I run the command

bazel run //explorer -- ./explorer/testdata/print/format_only.carbon

I see the following error message:

INFO: Invocation ID: a94222fa-f225-441f-b5e5-0bf2f8269fb2
INFO: Analyzed target //explorer:explorer (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /mnt/d/Documents/Projects/carbon-lang/explorer/interpreter/BUILD:159:11: Compiling explorer/interpreter/resolve_names.cpp failed: (Exit 1): clang++ failed: error executing command /usr/lib/llvm-13/bin/clang++ -no-canonical-prefixes -fcolor-diagnostics -Werror -Wall -Wextra -Wthread-safety -Wself-assign -Wimplicit-fallthrough -Wctad-maybe-unsupported -Wno-unused-parameter -c -MD ... (remaining 86 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox
In file included from explorer/interpreter/resolve_names.cpp:5:
In file included from ./explorer/interpreter/resolve_names.h:8:
./explorer/ast/ast.h:8:10: fatal error: 'vector' file not found
#include <vector>
         ^~~~~~~~
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.468s, Critical Path: 0.37s
INFO: 13 processes: 13 internal.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

Ubuntu version: 22.04 Kernel: 5.15.0-41-generic

Installed bazelisk and llvm using linuxbrew

ShauryaAg avatar Jul 21 '22 11:07 ShauryaAg

I did not get the same error as you. However, please note that contribution_tools.md does state that export PATH="$(brew --prefix llvm)/bin:${PATH}" is only needed in MacOS and not Linux.

However, can you try to install lld and see if that works?

ShauryaAg avatar Jul 22 '22 15:07 ShauryaAg

However, can you try to install lld and see if that works?

That did solve my problem. Indeed i was using the wrong version for lld. I will delet my previous comments to clean up the conversation.

ghost avatar Jul 22 '22 16:07 ghost

Can you please update to head? As part of preparing the debug instructions (https://github.com/carbon-language/carbon-lang/blob/trunk/docs/project/contribution_tools.md#troubleshooting-build-issues) I removed some special casing of clang-13 that judging by paths here you're probably running into.

(sorry for the slow response)

jonmeow avatar Jul 23 '22 01:07 jonmeow