run-clang-tidy 是 Ubuntu 21.10 中的一个损坏的符号链接

run-clang-tidy 是 Ubuntu 21.10 中的一个损坏的符号链接

我发现该run-clang-tidy脚本在 Ubuntu 21.10 中是一个损坏的符号链接:

$ run-clang-tidy
bash: run-clang-tidy: command not found

$ cd /usr/bin

$ ls -l *tidy*
lrwxrwxrwx 1 root root 29 Sep 28 10:13 clang-tidy -> ../lib/llvm-13/bin/clang-tidy
lrwxrwxrwx 1 root root 29 Oct  3 20:38 clang-tidy-13 -> ../lib/llvm-13/bin/clang-tidy
lrwxrwxrwx 1 root root 21 Sep 28 10:13 clang-tidy-diff -> clang-tidy-diff-13.py
lrwxrwxrwx 1 root root 45 Oct  3 20:38 clang-tidy-diff-13.py -> ../lib/llvm-13/share/clang/clang-tidy-diff.py
lrwxrwxrwx 1 root root 20 Sep 28 10:13 run-clang-tidy -> run-clang-tidy-13.py
lrwxrwxrwx 1 root root 33 Oct  3 20:38 run-clang-tidy-13 -> ../lib/llvm-13/bin/run-clang-tidy
lrwxrwxrwx 1 root root 41 Oct  3 20:38 run-clang-tidy-13.py -> ../lib/llvm-13/share/clang/run-clang-tidy

$ ls -l run-clang-tidy
lrwxrwxrwx 1 root root 20 Sep 28 10:13 run-clang-tidy -> run-clang-tidy-13.py

$ ls -l run-clang-tidy-13.py
lrwxrwxrwx 1 root root 41 Oct  3 20:38 run-clang-tidy-13.py -> ../lib/llvm-13/share/clang/run-clang-tidy

$ ls -l ../lib/llvm-13/share/clang/run-clang-tidy
ls: cannot access '../lib/llvm-13/share/clang/run-clang-tidy': No such file or directory

这是在 docker 容器中发生的,但我认为在常规安装中也是一样的。从我的 Dockerfile 中:

FROM ubuntu:21.10
...
RUN \
    apt-get update; \
    DEBIAN_FRONTEND=noninteractive apt-get -y install \
        afl++ \
        busybox \
        clang-tidy \
...

我不能直接使用run-clang-tidy-13它,因为它是从 makefile 运行的,而该 makefile 也用于没有run-clang-tidy-13(但run-clang-tidy-12或更早)的较旧 Ubuntu 版本。

我可以使用 Dockerfile 中的以下行(或通过在容器中运行相同的命令)来修复它:

RUN rm /usr/bin/run-clang-tidy
RUN ln -s /usr/bin/run-clang-tidy-13 /usr/bin/run-clang-tidy

但这当然只是一个丑陋的解决方法。

有人遇到同样的问题吗?除了希望在 21.10.1 中修复之外,还有更优雅的解决方案吗?

记录一下(在容器中执行):

$ lsb_release -a
LSB Version:    core-11.1.0ubuntu3-noarch:security-11.1.0ubuntu3-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 21.10
Release:    21.10
Codename:   impish

$ clang-tidy --version
LLVM (http://llvm.org/):
  LLVM version 13.0.0
  
  Optimized build.
  Default target: x86_64-pc-linux-gnu
  Host CPU: skylake

相关内容