在 FreeBSD 11.2 中找不到 clang 格式

Cannot find clang-format in FreeBSD 11.2

我安装了一个FreeBSD虚拟机然后我运行sudo pkg install clang-devel.

clang-format 似乎不见了:

-sh: clang-format: not found

如何在 FreeBSD 11.2 中安装 clang-format

您可以查看 clang-devel 软件包安装的文件(例如 FreshPorts)。

我可以看到一些文件,它们可能就是您要查找的文件:

  • bin/clang-format-devel
  • llvm-devel/bin/clang-format

它们默认安装在 /usr/local 下。

或者,您可以使用 advanced search feature on FreshPorts. Here's the link to the search result for clang-format in pkg-plists (pkg-plist is a file with a list of files installed by a package): https://www.freshports.org/search.php?stype=pkg-plist&method=match&query=clang-format&num=100&orderby=category&orderbyupdown=asc&search=Search&format=html&branch=head

值得注意的是,使用 FreeBSD ports 树中可用的 pkg(8) or ports(7) as some packages generate their pkg-plists dynamically. This is why the easiest solution is to use external services like FreshPorts. There is also a plugin for pkg(8) called pkg-provides 没有简单的方法,这可能是您正在寻找的。但是我从来没有尝试过。