Bazel 用巴泽尔造德雷克的麻烦

Bazel 用巴泽尔造德雷克的麻烦,bazel,drake,Bazel,Drake,我一直试图在Ubuntu18.04上用Bazel从源代码构建Drake,但在运行时出现了以下错误 bazel build ... 从Drake根目录: 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 baze

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

bazel build ...
从Drake根目录:

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
如安装说明中所述

<>我还为C和C++编译器设置了环境变量为$cc= /ur/bin /gcc和$cxx/ur/bin /gcc,因为我怀疑编译器问题是问题。为了与此进行比较,我还尝试使用$CC=/usr/bin/clang-9和$CXX=/usr/bin/clang++-9进行构建,结果出现了一个不同的错误:

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>
         ^~~~~~~~~
<代码>错误:/home /用户名/DR/DRAKE/Sys/Frase/Buffel.BaZel:213:17:C++规则/ /系统/框架编译:CaseEy和SyAdvsixyTrAkter失败(退出1)clang-9失败:执行命令/usr/bin/clang-9时出错-U_-FORTIFY_源-fstack protector-Wall-Wthread safety-Wself assign-fcolor diagnostics-fno省略帧指针-g0-O2'-D_-FORTIFY_源=1'-DNDEBUG-f函数部分。。。(跳过其余77个参数) 使用--sandbox_debug查看来自沙盒的详细消息 在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:致命错误:未找到“cstdint”文件 #包括 ^~~~~~~~~
我怀疑在构建过程中使用的include路径存在一些问题,因为两个编译器都无法找到标准文件,但我不确定下一步要尝试什么或如何修复。如有任何建议或建议,将不胜感激

您能否确认您可以运行
install\u prereqs.sh
,并且没有显示错误?看来你的STL安装有问题了?另一个尝试是完全隔离您的环境。你能试着使这个脚本适应你的目的吗您需要更新那里的步骤(例如,使用Bazel而不是CMake等)。install_prereqs似乎运行正常,唯一的错误是它无法获取Bazel:(不确定为什么,使用Bazel 3.5.0)。除此之外,似乎没有任何错误,并在完成后打印install_prereqs:success。我尝试使用您的脚本在一个隔离的环境中运行构建,用bazel构建替换cmake代码。。。从drake根目录开始,它失败了,出现了与原始帖子中的第一个类似的错误,只是这一次它无法找到iostream而不是new。我最终安装了g++-8并完全重建了它,这似乎解决了任何问题。谢谢你的帮助!嗯,奇怪。。。我想知道为什么
g++-8
解决了这个问题,因为
gcc
的可行版本应该通过
install\u prereqs
安装。也许您的
CC/CXX
,或者您的
更新替代方案中有一些奇怪的东西?您能否确认您可以运行
install\u prereqs.sh
,而不显示任何错误?看来你的STL安装有问题了?另一个尝试是完全隔离您的环境。你能试着使这个脚本适应你的目的吗您需要更新那里的步骤(例如,使用Bazel而不是CMake等)。install_prereqs似乎运行正常,唯一的错误是它无法获取Bazel:(不确定为什么,使用Bazel 3.5.0)。除此之外,似乎没有任何错误,并在完成后打印install_prereqs:success。我尝试使用您的脚本在一个隔离的环境中运行构建,用bazel构建替换cmake代码。。。从drake根目录开始,它失败了,出现了与原始帖子中的第一个类似的错误,只是这一次它无法找到iostream而不是new。我最终安装了g++-8并完全重建了它,这似乎解决了任何问题。谢谢你的帮助!嗯,奇怪。。。我想知道为什么
g++-8
解决了这个问题,因为
gcc
的可行版本应该通过
install\u prereqs
安装。也许您有什么可以覆盖的
CC/CXX
,或者您的
更新替代方案中有一些奇怪的东西?
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>
         ^~~~~~~~~