将 drake 集成到 OpenSUSE - drake/tools/workspace/pybind11/mkdoc.py 中出现错误

问题描述 投票:0回答:1

在我的 GitHub 存储库中将 drake 集成到 OpenSUSE 期间

cmake .. -DWITH_USER_FMT:BOOLEAN=ON -DWITH_USER_SPDLOG:BOOLEAN=ON
然后

make install

我收到以下构建错误:

dan@fe16060bd2e2:~/drake/cmake> cmake ..
CMake Warning at CMakeLists.txt:60 (message):
  Could NOT find the lsb_release executable


fatal: not a git repository: /home/dan/drake/../.git/modules/drake
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
INFO: Reading 'startup' options from /home/dan/drake/cmake/drake_build_cwd/.bazelrc: --output_base=/home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=0 --terminal_columns=80
INFO: Reading rc options for 'info' from /home/dan/drake/tools/bazel.rc:
  Inherited 'common' options: --enable_bzlmod=false
INFO: Reading rc options for 'info' from /home/dan/drake/cmake/drake_build_cwd/.bazelrc:
  Inherited 'common' options: --announce_rc=no --repo_env=CC=/usr/bin/gcc-10 --repo_env=CXX=/usr/bin/g++-10
INFO: Reading rc options for 'info' from /home/dan/drake/tools/bazel.rc:
  Inherited 'build' options: -c opt --strip=never --strict_system_includes --cxxopt=-std=c++20 --host_cxxopt=-std=c++20 --test_output=errors --test_summary=terse --test_tag_filters=-gurobi,-mosek,-snopt --test_env=DISPLAY --test_env=GRB_LICENSE_FILE --test_env=MOSEKLM_LICENSE_FILE --test_env=LCM_DEFAULT_URL=memq:// --test_env=MPLBACKEND=Template
INFO: Reading rc options for 'info' from /home/dan/drake/tools/ubuntu.bazelrc:
  Inherited 'build' options: --force_pic --fission=dbg --features=per_object_debug_info --action_env=PATH=/usr/bin:/bin --action_env=PYTHONNOUSERSITE=1 --test_env=PYTHONNOUSERSITE=1
INFO: Reading rc options for 'info' from /home/dan/drake/cmake/drake_build_cwd/.bazelrc:
  Inherited 'build' options: --symlink_prefix=/ --color=yes --subcommands=no --package_path=%workspace%:/home/dan/drake --notrim_test_configuration --action_env=CCACHE_DISABLE=1 --config=Release
INFO: Found applicable config definition build:Release in file /home/dan/drake/cmake/drake_build_cwd/.bazelrc: --compilation_mode=opt
bazel-bin: /home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/execroot/drake/bazel-out/k8-opt/bin
bazel-genfiles: /home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/execroot/drake/bazel-out/k8-opt/bin
bazel-testlogs: /home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/execroot/drake/bazel-out/k8-opt/testlogs
character-encoding: file.encoding = ISO-8859-1, defaultCharset = ISO-8859-1
command_log: /home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/command.log
committed-heap-size: 520MB
execution_root: /home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/execroot/drake
gc-count: 4
gc-time: 36ms
install_base: /home/dan/.cache/bazel/_bazel_dan/install/117cee491f5c7d83be6e3c6d6b5b8ca4
java-home: /home/dan/.cache/bazel/_bazel_dan/install/117cee491f5c7d83be6e3c6d6b5b8ca4/embedded_tools/jdk
java-runtime: OpenJDK Runtime Environment (build 11.0.6+10-LTS) by Azul Systems, Inc.
java-vm: OpenJDK 64-Bit Server VM (build 11.0.6+10-LTS, mixed mode) by Azul Systems, Inc.
max-heap-size: 8304MB
output_base: /home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3
output_path: /home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/execroot/drake/bazel-out
package_path: %workspace%:/home/dan/drake
release: release 6.4.0
repository_cache: /home/dan/.cache/bazel/_bazel_dan/cache/repos/v1
server_log: /home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/java.log.fe16060bd2e2.dan.log.java.20240311-091355.684
server_pid: 684
used-heap-size: 89MB
workspace: /home/dan/drake/cmake/drake_build_cwd
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dan/drake/cmake
dan@fe16060bd2e2:~/drake/cmake> make install
DEBUG: /home/dan/drake/tools/workspace/pkg_config.bzl:240:18: pkg-config of fmt returned an include path that contains /usr/local/include that may contain unrelated headers
DEBUG: /home/dan/drake/tools/workspace/pkg_config.bzl:240:18: pkg-config of fmt returned an include path that contains /usr/local/include that may contain unrelated headers
DEBUG: /home/dan/drake/tools/workspace/pkg_config.bzl:240:18: pkg-config of spdlog returned an include path that contains /usr/local/include that may contain unrelated headers
INFO: Analyzed target //:install (326 packages loaded, 26841 targets configured).
INFO: Found 1 target...
ERROR: /home/dan/drake/bindings/pydrake/BUILD.bazel:55:37: Action bindings/pydrake/documentation_pybind.h failed: (Exit 1): mkdoc failed: error executing command (from target //bindings/pydrake:generate_pybind_documentation_header) bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc -DDRAKE_COMMON_SYMBOLIC_EXPRESSION_DETAIL_HEADER -DEIGEN_MPL2_ONLY -DSPDLOG_COMPILED_LIB -DHAVE_SPDLOG -isystemlcmtypes ... (remaining 877 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
Traceback (most recent call last):
  File "/home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/sandbox/processwrapper-sandbox/821/execroot/drake/bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc.runfiles/drake/tools/workspace/pybind11/mkdoc.py", line 816, in <module>
    main()
  File "/home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/sandbox/processwrapper-sandbox/821/execroot/drake/bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc.runfiles/drake/tools/workspace/pybind11/mkdoc.py", line 644, in main
    add_library_paths(parameters)
  File "/home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/sandbox/processwrapper-sandbox/821/execroot/drake/bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc.runfiles/drake/tools/workspace/pybind11/libclang_setup.py", line 45, in add_library_paths
    raise RuntimeError(f'Library file {library_file} does NOT exist')
RuntimeError: Library file /usr/lib/x86_64-linux-gnu/libclang-14.so does NOT exist
Target //:install failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 89.691s, Critical Path: 16.44s
INFO: 5278 processes: 4463 internal, 810 processwrapper-sandbox, 5 worker.
FAILED: Build did NOT complete successfully
make[2]: *** [CMakeFiles/drake_cxx_python.dir/build.make:70: CMakeFiles/drake_cxx_python] Error 1
make[1]: *** [CMakeFiles/Makefile2:839: CMakeFiles/drake_cxx_python.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

Dockerfile

这是我使用的dockerfile

# Use OpenSUSE Leap 15.4 as base
FROM opensuse/leap:15.4

# Install vim, sudo, and other necessary tools and libraries for drake
RUN zypper --non-interactive update && \
    zypper --non-interactive install -y vim sudo git cmake make java-1_8_0-openjdk-devel \
    glib2-devel lapack-devel libX11-devel ocl-icd-devel opencl-headers patch patchelf \
    pkg-config python3-devel python3-pygame zlib-devel pkg-config eigen3-devel \
    libmumps5 mumps-devel gcc-fortran nasm wget\  
    spdlog-devel  # spdlog-devel install spdlog-devel and fmt-devel
    # llvm-clang llvm-clang-devel not installed as there are too old

# Add the repository for GCC 10
RUN zypper addrepo -f http://download.opensuse.org/repositories/devel:/gcc/openSUSE_Leap_15.4/ devel_gcc && \
    zypper --non-interactive --gpg-auto-import-keys refresh && \
    zypper --non-interactive install -y gcc10 gcc10-c++

# Set GCC 10 as the default compiler
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 && \
    update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30 && \
    update-alternatives --set cc /usr/bin/gcc && \
    update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30 && \
    update-alternatives --set c++ /usr/bin/g++

# Install Bazelisk
RUN curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.7.5/bazelisk-linux-amd64 > /usr/local/bin/bazelisk && \
    chmod +x /usr/local/bin/bazelisk && \
    ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel

# Download and place jchart2d-3.3.2.jar in /usr/share/java/jchart2d.jar
RUN wget https://repo1.maven.org/maven2/net/sf/jchart2d/jchart2d/3.3.2/jchart2d-3.3.2.jar -O /usr/share/java/jchart2d.jar

# Create .pc files for LAPACK and BLAS
RUN echo -e "prefix=/usr\nexec_prefix=\${prefix}\nlibdir=\${exec_prefix}/lib64\nincludedir=\${prefix}/include\n\nName: LAPACK\nDescription: Linear Algebra Package\nVersion: 3.9.0\nLibs: -L\${libdir} -llapack\nCflags: -I\${includedir}" > /usr/share/pkgconfig/lapack.pc && \
    echo -e "prefix=/usr\nexec_prefix=\${prefix}\nlibdir=\${exec_prefix}/lib64\nincludedir=\${prefix}/include\n\nName: BLAS\nDescription: Basic Linear Algebra Subprograms\nVersion: 3.9.0\nLibs: -L\${libdir} -lblas\nCflags: -I\${includedir}" > /usr/share/pkgconfig/blas.pc

# Set up the environment for user 'dan'
RUN groupadd -r dan && \
    useradd -m -s /bin/bash -r -g dan dan && \
    mkdir -p /home/dan/drake && \
    chown -R dan:dan /home/dan/drake && \
    echo "dan ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

USER dan
ENV HOME /home/dan
WORKDIR $HOME

# Install dependencies for pyenv and Python build
RUN sudo zypper --non-interactive install -y git gcc make zlib-devel libbz2-devel libopenssl-devel readline-devel \
    sqlite3-devel tar gzip openmpi-devel python3-clang15 clang15-devel

# Install pyenv and Python 3.10
RUN git clone https://github.com/pyenv/pyenv.git $HOME/.pyenv && \
    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> $HOME/.bashrc && \
    echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> $HOME/.bashrc && \
    echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init --path)"\nfi' >> $HOME/.bashrc && \
    /bin/bash -c "source $HOME/.bashrc && pyenv install 3.10.0 && pyenv global 3.10.0"

# Ensure the selected Python version 3.10 is used and install PyYAML
RUN /bin/bash -c "source $HOME/.bashrc && pyenv rehash && pip install PyYAML"

# Set environment variables for GCC to ensure Bazel uses the correct version
ENV CC=/usr/bin/gcc-10
ENV CXX=/usr/bin/g++-10
ENV PYENV_ROOT $HOME/.pyenv
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
ENV LD_LIBRARY_PATH=/usr/lib/llvm-14/lib:$LD_LIBRARY_PATH

我尝试过的解决方案

我尝试做几个解决方法(我不知道我在这里做什么。我只是想让它工作无论如何。)

1) 软链接

(@jwnimmer-tri 不鼓励在评论中这样做,但为了完整性我将其保留)

基本问题是它在

libclang-14.so
(
x86_64-linux-gnu
) 中找不到
RuntimeError: Library file /usr/lib/x86_64-linux-gnu/libclang-14.so does NOT exist
。我在其他文件夹中找到了几个
libclang-14.so
,但是如果我将它们软链接到
/usr/lib/x86_64-linux-gnu/libclang-14.so
,我会收到以下错误:

dan@8119dd3149a8:~/drake/cmake> make install
INFO: Analyzed target //:install (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /home/dan/drake/bindings/pydrake/BUILD.bazel:55:37: Action bindings/pydrake/documentation_pybind.h failed: (Exit 1): mkdoc failed: error executing command (from target //bindings/pydrake:generate_pybind_documentation_header) bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc -DDRAKE_COMMON_SYMBOLIC_EXPRESSION_DETAIL_HEADER -DEIGEN_MPL2_ONLY -DFMT_LOCALE -DFMT_SHARED -DSPDLOG_SHARED_LIB -DSPDLOG_COMPILED_LIB ... (remaining 880 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
Traceback (most recent call last):
File "/home/dan/.cache/bazel/bazel/7ea85213ca47cc67b02970ecea7788b3/sandbox/processwrapper-sandbox/4564/execroot/drake/bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc.runfiles/clang_cindex_python3_internal/clang/cindex.py", line 4071, in register_function
func = getattr(lib, item[0])
File "/home/dan/.pyenv/versions/3.10.0/lib/python3.10/ctypes/init.py", line 387, in getattr
func = self.getitem(name)
File "/home/dan/.pyenv/versions/3.10.0/lib/python3.10/ctypes/init.py", line 392, in getitem
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib/x86_64-linux-gnu/libclang-14.so: undefined symbol: clang_annotateTokens

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/dan/.cache/bazel/bazel/7ea85213ca47cc67b02970ecea7788b3/sandbox/processwrapper-sandbox/4564/execroot/drake/bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc.runfiles/drake/tools/workspace/pybind11/mkdoc.py", line 816, in
main()
File "/home/dan/.cache/bazel/bazel/7ea85213ca47cc67b02970ecea7788b3/sandbox/processwrapper-sandbox/4564/execroot/drake/bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc.runfiles/drake/tools/workspace/pybind11/mkdoc.py", line 754, in main
cindex.conf.lib.clang_createIndex(False, True))
File "/home/dan/.cache/bazel/bazel/7ea85213ca47cc67b02970ecea7788b3/sandbox/processwrapper-sandbox/4564/execroot/drake/bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc.runfiles/clang_cindex_python3_internal/clang/cindex.py", line 212, in get
value = self.wrapped(instance)
File "/home/dan/.cache/bazel/bazel/7ea85213ca47cc67b02970ecea7788b3/sandbox/processwrapper-sandbox/4564/execroot/drake/bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc.runfiles/clang_cindex_python3_internal/clang/cindex.py", line 4152, in lib
register_functions(lib, not Config.compatibility_check)
File "/home/dan/.cache/bazel/bazel/7ea85213ca47cc67b02970ecea7788b3/sandbox/processwrapper-sandbox/4564/execroot/drake/bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc.runfiles/clang_cindex_python3_internal/clang/cindex.py", line 4099, in register_functions
register(f)
File "/home/dan/.cache/bazel/bazel/7ea85213ca47cc67b02970ecea7788b3/sandbox/processwrapper-sandbox/4564/execroot/drake/bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc.runfiles/clang_cindex_python3_internal/clang/cindex.py", line 4096, in register
return register_function(lib, item, ignore_errors)
File "/home/dan/.cache/bazel/bazel/7ea85213ca47cc67b02970ecea7788b3/sandbox/processwrapper-sandbox/4564/execroot/drake/bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc.runfiles/clang_cindex_python3_internal/clang/cindex.py", line 4077, in register_function
raise LibclangError(msg)
clang.cindex.LibclangError: /usr/lib/x86_64-linux-gnu/libclang-14.so: undefined symbol: clang_annotateTokens. Please ensure that your python bindings are compatible with your libclang.so version.
Target //:install failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 12.084s, Critical Path: 9.08s
INFO: 538 processes: 18 internal, 517 processwrapper-sandbox, 3 worker.
FAILED: Build did NOT complete successfully
make[2]: *** [CMakeFiles/drake_cxx_python.dir/build.make:70: CMakeFiles/drake_cxx_python] Error 1
make[1]: *** [CMakeFiles/Makefile2:839: CMakeFiles/drake_cxx_python.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
2)尝试修补 libclang_setup.py 中的 drake

当我更改代码时

elif platform.system() == 'Linux':
        # Original code
        '''# We expect Clang 14 to be installed.
        version = 14
        arch = platform.machine()
        library_file = f'/usr/lib/{arch}-linux-gnu/libclang-{version}.so'''

        # Drake OpenSUSE integration code
        library_file = '/usr/lib64/libclang.so'

这是这里我收到以下错误:

dan@1513460702f8:~/drake/cmake> make install
INFO: Analyzed target //:install (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /home/dan/drake/bindings/pydrake/BUILD.bazel:55:37: Action bindings/pydrake/documentation_pybind.h failed: (Exit 1): mkdoc failed: error executing command (from target //bindings/pydrake:generate_pybind_documentation_header) bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc -DDRAKE_COMMON_SYMBOLIC_EXPRESSION_DETAIL_HEADER -DEIGEN_MPL2_ONLY -DFMT_LOCALE -DFMT_SHARED -DSPDLOG_SHARED_LIB -DSPDLOG_COMPILED_LIB ... (remaining 880 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../include/c++/10/bits/cxxabi_init_exception.h:38:10: fatal error: 'stddef.h' file not found
Traceback (most recent call last):
  File "/home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/sandbox/processwrapper-sandbox/946/execroot/drake/bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc.runfiles/drake/tools/workspace/pybind11/mkdoc.py", line 816, in <module>
    main()
  File "/home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/sandbox/processwrapper-sandbox/946/execroot/drake/bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc.runfiles/drake/tools/workspace/pybind11/mkdoc.py", line 782, in main
    raise RuntimeError(
RuntimeError: Parsing headers using the clang library failed with 0 error(s) and 1 fatal error(s)
Target //:install failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 6.748s, Critical Path: 5.59s
INFO: 31 processes: 14 internal, 17 processwrapper-sandbox.
FAILED: Build did NOT complete successfully
make[2]: *** [CMakeFiles/drake_cxx_python.dir/build.make:70: CMakeFiles/drake_cxx_python] Error 1
make[1]: *** [CMakeFiles/Makefile2:839: CMakeFiles/drake_cxx_python.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

我还尝试了以下可用的替代版本

dan@1513460702f8:~/drake/cmake> find /usr -name "libclang.so*"
/usr/lib64/libclang.so.13
/usr/lib64/libclang.so.15.0.7
/usr/lib64/libclang.so

并使用以下编译版本:

2.1)尝试使用自己编译的 clang-14.0.0

我还尝试在 OpenSUSE Leap 15.4 上使用编译版本的 clang-14.0.0 来执行此操作,但没有成功(我自己编译了版本 14,因为没有官方的 clang-14 预构建二进制文件)。我也在这里得到

fatal error: 'stddef.h' file not found

2.2) 尝试解决
fatal error: 'stddef.h' file not found

当我尝试用

解决上述问题时
fatal error: 'stddef.h' file not found

    parameters.extend([
        "-I/usr/lib64/gcc/x86_64-suse-linux/10/include" 
    ])

在此行之后

我得到以下信息:

dan@1513460702f8:~/drake/cmake> make install
INFO: Analyzed target //:install (137 packages loaded, 15304 targets configured).
INFO: Found 1 target...
ERROR: /home/dan/drake/bindings/pydrake/BUILD.bazel:55:37: Action bindings/pydrake/documentation_pybind.h failed: (Exit 1): mkdoc failed: error executing command (from target //bindings/pydrake:generate_pybind_documentation_header) bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc -DDRAKE_COMMON_SYMBOLIC_EXPRESSION_DETAIL_HEADER -DEIGEN_MPL2_ONLY -DFMT_LOCALE -DFMT_SHARED -DSPDLOG_SHARED_LIB -DSPDLOG_COMPILED_LIB ... (remaining 880 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:130:19: error: use of undeclared identifier '__builtin_ia32_addss'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:136:19: error: use of undeclared identifier '__builtin_ia32_subss'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:142:19: error: use of undeclared identifier '__builtin_ia32_mulss'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:148:19: error: use of undeclared identifier '__builtin_ia32_divss'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:242:10: error: use of undeclared identifier '__builtin_ia32_andps'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:248:10: error: use of undeclared identifier '__builtin_ia32_andnps'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:254:10: error: use of undeclared identifier '__builtin_ia32_orps'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:260:10: error: use of undeclared identifier '__builtin_ia32_xorps'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:288:19: error: use of undeclared identifier '__builtin_ia32_movss'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:298:19: error: use of undeclared identifier '__builtin_ia32_movss'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:326:19: error: use of undeclared identifier '__builtin_ia32_movss'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:336:19: error: use of undeclared identifier '__builtin_ia32_movss'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:380:19: error: use of undeclared identifier '__builtin_ia32_cmpgtps'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:386:19: error: use of undeclared identifier '__builtin_ia32_cmpgeps'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:410:19: error: use of undeclared identifier '__builtin_ia32_cmpngtps'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:416:19: error: use of undeclared identifier '__builtin_ia32_cmpngeps'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:602:19: error: use of undeclared identifier '__builtin_ia32_cvtsi2ss'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:618:19: error: use of undeclared identifier '__builtin_ia32_cvtsi642ss'
/usr/lib64/gcc/x86_64-suse-linux/10/include/xmmintrin.h:625:19: error: use of undeclared identifier '__builtin_ia32_cvtsi642ss'
fatal error: too many errors emitted, stopping now [-ferror-limit=]
Traceback (most recent call last):
  File "/home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/sandbox/processwrapper-sandbox/1054/execroot/drake/bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc.runfiles/drake/tools/workspace/pybind11/mkdoc.py", line 820, in <module>
    main()
  File "/home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/sandbox/processwrapper-sandbox/1054/execroot/drake/bazel-out/k8-opt-exec-2B5CBBC6/bin/tools/workspace/pybind11/mkdoc.runfiles/drake/tools/workspace/pybind11/mkdoc.py", line 786, in main
    raise RuntimeError(
RuntimeError: Parsing headers using the clang library failed with 19 error(s) and 1 fatal error(s)
Target //:install failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 18.263s, Critical Path: 10.30s
INFO: 42 processes: 9 internal, 33 processwrapper-sandbox.
FAILED: Build did NOT complete successfully
make[2]: *** [CMakeFiles/drake_cxx_python.dir/build.make:70: CMakeFiles/drake_cxx_python] Error 1
make[1]: *** [CMakeFiles/Makefile2:839: CMakeFiles/drake_cxx_python.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

2.3)尝试使用 libclang.so.15.0.7 并导出 CPLUS_INCLUDE_PATH - 我得到的最远

我观察到以下情况(我自己找到了

stddef.h
):

dan@8f4d4c55ba7e:~/drake/cmake> find /usr -name "libclang.so*"
/usr/lib64/libclang.so.13
/usr/lib64/libclang.so.15.0.7
/usr/lib64/libclang.so
dan@8f4d4c55ba7e:~/drake/cmake> find /usr -name "*stddef.h*"
/usr/lib64/clang/15.0.7/include/stddef.h
/usr/lib64/gcc/x86_64-suse-linux/7/include/stddef.h
/usr/lib64/gcc/x86_64-suse-linux/10/include/stddef.h
/usr/include/linux/stddef.h

所以我在

libclant_setup.py
中尝试了以下内容(如上)

 elif platform.system() == 'Linux':
        # Original code
        '''# We expect Clang 14 to be installed.
        version = 14
        arch = platform.machine()
        library_file = f'/usr/lib/{arch}-linux-gnu/libclang-{version}.so'''

        # Drake OpenSUSE integration code
        library_file = '/usr/lib64/libclang.so.15.0.7'

并另外出口

export CPLUS_INCLUDE_PATH=/usr/lib64/clang/15.0.7/include:$CPLUS_INCLUDE_PATH

结果是很长的输出: https://gist.github.com/hedaniel7/2c0c131c7fa6bea56f98258d9a8f119d

这里发布了一个小样本:

dan@8f4d4c55ba7e:~/drake/cmake> make install
INFO: Analyzed target //:install (1 packages loaded, 5980 targets configured).
INFO: Found 1 target...
ERROR: /home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/external/abseil_cpp_internal/absl/base/BUILD.bazel:60:11: Compiling absl/base/log_severity.cc failed: (Exit 1): gcc-10 failed: error executing command (from target @abseil_cpp_internal//absl/base:log_severity) /usr/bin/gcc-10 -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 40 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from /usr/include/c++/10/bits/cxxabi_init_exception.h:38,
                 from /usr/include/c++/10/bits/exception_ptr.h:38,
                 from /usr/include/c++/10/exception:147,
                 from /usr/include/c++/10/new:41,
                 from /usr/include/c++/10/bits/stl_iterator.h:82,
                 from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/array:40,
                 from external/abseil_cpp_internal/absl/base/log_severity.h:18,
                 from external/abseil_cpp_internal/absl/base/log_severity.cc:15:
/usr/lib64/clang/15.0.7/include/stddef.h:18:19: error: missing binary operator before token "("
   18 | #if !__has_feature(modules)
      |                   ^
/usr/lib64/clang/15.0.7/include/stddef.h:30:42: error: missing binary operator before token "("
   30 | #if !defined(_PTRDIFF_T) || __has_feature(modules)
      |                                          ^
/usr/lib64/clang/15.0.7/include/stddef.h:41:39: error: missing binary operator before token "("
   41 | #if !defined(_SIZE_T) || __has_feature(modules)
      |                                       ^
/usr/lib64/clang/15.0.7/include/stddef.h:55:42: error: missing binary operator before token "("
   55 |      !defined(_RSIZE_T)) || __has_feature(modules)
      |                                          ^
In file included from /usr/include/wchar.h:35,
                 from /usr/include/c++/10/cwchar:44,
                 from /usr/include/c++/10/bits/postypes.h:40,
                 from /usr/include/c++/10/iosfwd:40,
                 from /usr/include/c++/10/ios:38,
                 from /usr/include/c++/10/ostream:38,
                 from external/abseil_cpp_internal/absl/base/log_severity.h:19,
                 from external/abseil_cpp_internal/absl/base/log_severity.cc:15:
/usr/lib64/clang/15.0.7/include/stddef.h:41:39: error: missing binary operator before token "("
   41 | #if !defined(_SIZE_T) || __has_feature(modules)
      |                                       ^
In file included from /usr/include/sched.h:29,
                 from /usr/include/pthread.h:22,
                 from /usr/include/c++/10/x86_64-suse-linux/bits/gthr-default.h:35,
                 from /usr/include/c++/10/x86_64-suse-linux/bits/gthr.h:148,
                 from /usr/include/c++/10/ext/atomicity.h:35,
                 from /usr/include/c++/10/bits/ios_base.h:39,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from external/abseil_cpp_internal/absl/base/log_severity.h:19,
                 from external/abseil_cpp_internal/absl/base/log_severity.cc:15:
/usr/lib64/clang/15.0.7/include/stddef.h:41:39: error: missing binary operator before token "("
   41 | #if !defined(_SIZE_T) || __has_feature(modules)

[...]
n file included from /usr/include/c++/10/bits/exception_ptr.h:38,
                 from /usr/include/c++/10/exception:147,
                 from /usr/include/c++/10/new:41,
                 from /usr/include/c++/10/bits/stl_iterator.h:82,
                 from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/array:40,
                 from external/abseil_cpp_internal/absl/base/log_severity.h:18,
                 from external/abseil_cpp_internal/absl/base/log_severity.cc:15:
/usr/include/c++/10/bits/cxxabi_init_exception.h:63:32: error: 'size_t' was not declared in this scope; did you mean 'std::size_t'?
   63 |       __cxa_allocate_exception(size_t) _GLIBCXX_NOTHROW;
      |                                ^~~~~~
      |                                std::size_t
In file included from /usr/include/c++/10/utility:68,
                 from /usr/include/c++/10/array:38,
                 from external/abseil_cpp_internal/absl/base/log_severity.h:18,
                 from external/abseil_cpp_internal/absl/base/log_severity.cc:15:
/usr/include/c++/10/x86_64-suse-linux/bits/c++config.h:2306:26: note: 'std::size_t' declared here
 2306 |   typedef __SIZE_TYPE__  size_t;
      |                          ^~~~~~
                                                         
build clang bazel opensuse drake
1个回答
0
投票

如果让 libclang 工作很困难,最方便的解决方法可能是在受支持的平台上运行 Drake(相同版本)的构建,以在该平台上创建

bazel-bin/bindings/pydrake/documentation_pybind.h
头文件,然后复制该文件进入 SUSE 平台的 Drake 源代码树中的
drake/bindings/pydrake/documentation_pybind.h
。然后,通过删除
generate_pybind_documentation_header
中的
drake/bindings/pydrake/BUILD.bazel
规则,告诉 SUSE 构建不要尝试生成该标头。

© www.soinside.com 2019 - 2024. All rights reserved.