macOS Catalina下安装libx11失败的问题处理

问题起因

主要是因为穷,所以一直在用一台2015MBP丐版,128G硬盘早就不够用了,所以某次清理硬盘空间的时候把ffmpeg给删除了。

后来自己动手换了硬盘,加到1T以后,某天想要用ffmpeg时发现装不上。错误是安装一个依赖(libx11)时出错:

checking for sys/param.h... yes
checking for getpagesize... yes
checking for working mmap... yes
checking for nl_langinfo... yes
checking for X11... no
configure: error: Package requirements (xproto >= 7.0.25 xextproto xtrans xcb >= 1.11.1 kbproto inputproto) were not met:

Package 'pthread-stubs', required by 'xcb', not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables X11_CFLAGS
and X11_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

Do not report this issue to Homebrew/brew or Homebrew/homebrew-core!


Error: You are using macOS 10.15.
We (and Apple) do not provide support for this old version.
It is expected behaviour that some formulae will fail to build in this old version.
It is expected behaviour that Homebrew will be buggy and slow.
Do not create any issues about this on Homebrew's GitHub repositories.
Do not create any issues even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help from MacHomebrew on Twitter.
You may ask for help in Homebrew's discussions but are unlikely to receive a response.
Try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.

最后这个提示一直让我误以为是系统版本问题,但这是macOS 10的最后一个小版本,不想升到11以上,还是得想别的办法。

问题处理

尝试安装旧版的ffmpeg@4,也一样错误。

看了一下brew list,系统里已经存在了libx11,只是版本低一点而已,于是试图用brew pin libx11锁定版本,但是安装ffmpeg又必须依赖最新版。

搜到homebrew的一个讨论帖,加上了

env PKG_CONFIG_PATH=`pkg-config --variable pc_path pkg-config`

仍然不行。

最后是在一个回复里看到解决方案:强制重装libxcb:

brew reinstall libxcb

这样会把它的依赖一起重装一遍,再安装libx11就成功了,安装ffmpeg也没问题了。

推送到[go4pro.org]