Mac Ventura 13环境下Homebrew安装poppler失败求助
无法通过Homebrew编译安装Poppler
尝试用Homebrew安装Poppler(作为其他软件包的依赖)时,编译阶段出现CMake错误,具体操作及错误日志如下:
$ brew install poppler ==> Fetching poppler Warning: Building poppler from source as the bottle needs: - HOMEBREW_CELLAR: /usr/local/Cellar (yours is /Users/user/Applications/homebrew/Cellar) - HOMEBREW_PREFIX: /usr/local (yours is /Users/user/Applications/homebrew) ==> Downloading https://poppler.freedesktop.org/poppler-data-0.4.11.tar.gz Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/d0ce5fea7a038ced91deafbd2d9d78074b6123ce1571c4ff59e3c4f2c9142e0f--poppler-data-0.4.11.tar.gz ==> Downloading https://poppler.freedesktop.org/poppler-23.02.0.tar.xz Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/ada65f4ad8ce97f96509088f1b1951148699a9b6cf54d9cbaafd3a0442d8436b--poppler-23.02.0.tar.xz ==> cmake -S . -B build_shared -DBUILD_GTK_TESTS=OFF -DENABLE_BOOST=OFF -DENABLE_CMS=lcms2 -DENABLE_GLIB=ON -DENABLE_QT5=OFF -DENABLE_QT6=OFF -DENABLE_UNSTABLE_API_ABI_HEADERS=ON -DWITH_GObjectIntrospection=ON -DCMAKE_INSTALL_RPATH=@loader_path/../lib Last 15 lines from /Users/user/Library/Logs/Homebrew/poppler/01.cmake: * An install or uninstall procedure did not complete successfully. * The installation package was faulty and references files it does not provide. -- Generating done CMake Warning: Manually-specified variables were not used by the project: BUILD_TESTING CMake Generate step failed. Build files cannot be regenerated correctly. Do not report this issue to Homebrew/brew or Homebrew/homebrew-core!
已尝试的操作:
- 清理Homebrew缓存及残留文件
- 卸载并重装Homebrew
- 在Poppler官方仓库提交工单,但工单已被关闭
可能的解决方法
1. 修复Homebrew路径配置
你的Homebrew安装路径非默认(默认是/usr/local),路径配置或权限可能导致编译失败:
- 运行
brew doctor检查所有潜在问题,严格按照提示修复权限错误或缺失依赖 - 验证环境变量是否正确:
echo $HOMEBREW_PREFIX echo $HOMEBREW_CELLAR - 若变量异常,手动设置后重试安装:
export HOMEBREW_PREFIX="/Users/user/Applications/homebrew" export HOMEBREW_CELLAR="/Users/user/Applications/homebrew/Cellar" brew install poppler
2. 彻底清理Poppler编译残留
编译缓存损坏可能导致错误,执行以下命令清理后重装:
# 强制卸载Poppler残留 brew uninstall --force poppler # 删除Poppler的下载缓存和编译日志 rm -rf /Users/user/Library/Caches/Homebrew/poppler* rm -rf /Users/user/Library/Logs/Homebrew/poppler # 带详细日志重新安装 brew install -v poppler
3. 简化编译参数
禁用部分非必需特性,降低编译复杂度:
brew install poppler --without-glib --without-gobject-introspection
4. 手动编译安装
如果Homebrew脚本存在问题,可手动编译源码:
# 下载解压源码 curl -O https://poppler.freedesktop.org/poppler-23.02.0.tar.xz tar -xf poppler-23.02.0.tar.xz cd poppler-23.02.0 # 配置CMake(适配你的Homebrew路径) cmake -DCMAKE_INSTALL_PREFIX="/Users/user/Applications/homebrew" -DBUILD_GTK_TESTS=OFF -DENABLE_BOOST=OFF -DENABLE_CMS=lcms2 -DENABLE_GLIB=OFF -DENABLE_QT5=OFF -DENABLE_QT6=OFF . # 并行编译并安装 make -j$(sysctl -n hw.ncpu) make install
内容的提问来源于stack exchange,提问作者user1472672
相关产品推荐
相关产品推荐

