首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用Bazel制造德雷克的麻烦

用Bazel制造德雷克的麻烦
EN

Stack Overflow用户
提问于 2020-09-25 23:03:41
回答 1查看 520关注 0票数 1

我一直试图在Ubuntu18.04上使用Bazel从源代码构建Drake,但在运行时发生了以下错误

代码语言:javascript
复制
bazel build ...

在Drake根目录中:

代码语言:javascript
复制
ERROR: /home/username/dir/drake/bindings/pydrake/BUILD.bazel:56:37: Action bindings/pydrake/documentation_pybind.h failed (Exit 1) mkdoc failed: error executing command bazel-out/host/bin/tools/workspace/pybind11/mkdoc -DDRAKE_COMMON_SYMBOLIC_DETAIL_HEADER -DEIGEN_MPL2_ONLY -DHAVE_CSTDDEF '-DFMT_HEADER_ONLY=1' '-DFMT_NO_FMT_STRING_ALIAS=1' -DHAVE_SPDLOG ... (remaining 1096 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
external/eigen/include/_usr_include_eigen3/Eigen/Core:66:12: fatal error: 'new' file not found
Traceback (most recent call last):
  File "/home/username/.cache/bazel/_bazel_username/6e98757561df7a931d098ab985a3e673/sandbox/linux-sandbox/1371/execroot/drake/bazel-out/host/bin/tools/workspace/pybind11/mkdoc.runfiles/drake/tools/workspace/pybind11/mkdoc.py", line 841, in <module>
    main()
  File "/home/username/.cache/bazel/_bazel_username/6e98757561df7a931d098ab985a3e673/sandbox/linux-sandbox/1371/execroot/drake/bazel-out/host/bin/tools/workspace/pybind11/mkdoc.runfiles/drake/tools/workspace/pybind11/mkdoc.py", line 805, in main
    severities.count(cindex.Diagnostic.Fatal)))
RuntimeError: Parsing headers using the clang library failed with 0 error(s) and 1 fatal error(s)
----------------
Note: The failure of target //tools/workspace/pybind11:mkdoc (with exit code 1) may have been caused by the fact that it is running under Python 3 instead of Python 2. Examine the error to determine if that appears to be the problem. Since this target is built in the host configuration, the only way to change its version is to set --host_force_python=PY2, which affects the entire build.

If this error started occurring in Bazel 0.27 and later, it may be because the Python toolchain now enforces that targets analyzed as PY2 and PY3 run under a Python 2 and Python 3 interpreter, respectively. See https://github.com/bazelbuild/bazel/issues/7899 for more information.
----------------
INFO: Elapsed time: 2345.311s, Critical Path: 321.76s
INFO: 1378 processes: 1378 linux-sandbox.
FAILED: Build did NOT complete successfully

在建造之前,我跑了:

代码语言:javascript
复制
sudo ./setup/ubuntu/install_prereqs.sh

正如安装说明中提到的那样。

我还将c和c++编译器的环境变量设置为$CC=/usr/bin/gcc和$CXX=/usr/bin/gcc,因为我怀疑编译器问题是问题所在。为了与此进行比较,我还尝试使用$CC=/usr/bin/clang-9和$CXX=/usr/bin/clang++-9进行构建,但产生了不同的错误:

代码语言:javascript
复制
ERROR: /home/username/dir/drake/systems/framework/BUILD.bazel:213:17: C++ compilation of rule '//systems/framework:cache_and_dependency_tracker' failed (Exit 1) clang-9 failed: error executing command /usr/bin/clang-9 -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 77 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
In file included from systems/framework/cache.cc:1:
bazel-out/k8-opt/bin/systems/framework/_virtual_includes/cache_and_dependency_tracker/drake/systems/framework/cache.h:7:10: fatal error: 'cstdint' file not found
#include <cstdint>
         ^~~~~~~~~

我怀疑构建过程中使用的包含路径存在一些问题,因为两个编译器都找不到标准文件,但是我不知道下一步要尝试什么,或者如何修复。如有任何建议或建议,将不胜感激!

EN

回答 1

Stack Overflow用户

发布于 2022-01-07 01:38:28

这似乎是我遇到的同样的问题。我的问题在这里,Encounter "RuntimeError: The operating system's C++ standard library is not installed correctly" when build drake from source using bazel和我解决了我的问题以下@jwnimmer的答案。

原来,Clang正在寻找GCC的标准库,它似乎在寻找GCC的更高版本(不确定)。我想问题是你安装了gcc-8,但没有安装g++-8,所以在安装g++-8之后,您可以解决这个问题。解决你的问题的另一种可能的方法是在我的问题中遵循@jwnimmer的回答,完全删除gcc-8。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64072308

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档