4

请原谅我对 Cmake 的无知。我正在尝试在 Centos 7 上安装 Poppler 0.86.1,但我遇到了一个错误,提示CMake Error at CMakeLists.txt:208 (message): Install libopenjpeg2 before trying to build poppler. 我已通过运行以下命令安装了包含 dev 包的 libopenjpeg2:

sudo yum install openjpeg2-devel

我正在采取以下步骤来安装 poppler:

wget https://poppler.freedesktop.org/poppler-0.86.1.tar.xz
tar xf poppler-0.86.1.tar.xz
cd poppler-0.86.1/
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..

导致以下错误

 CMake Error at CMakeLists.txt:208 (message):
 Install libopenjpeg2 before trying to build poppler.  You can also decide
 to use the internal unmaintained JPX decoder or none at all.


-- Configuring incomplete, errors occurred!

这是 CMakeLists.txt 中发生故障的地方

if(ENABLE_LIBOPENJPEG STREQUAL "openjpeg2")
  find_package(OpenJPEG)
  set(WITH_OPENJPEG ${OpenJPEG_FOUND})
  if(NOT OpenJPEG_FOUND OR OPENJPEG_MAJOR_VERSION VERSION_LESS 2)
      message(FATAL_ERROR "Install libopenjpeg2 before trying to build poppler. You can also decide to use the internal unmaintained JPX decoder or none at all.")
  endif()
  ...

谁能指出我正确的方向来弄清楚如何让 Poppler 0.86.1 成功安装在 Centos 7 上?

4

1 回答 1

3

如果我没记错的话,当我尝试在我的 Docker 映像中使用最新版本的 Poppler 时,我遇到了同样的问题。我通过安装修复它libopenjp2-7-dev。请检查我的答案,特别是我的 Dockerfile 的第二行,您可以在其中看到我在运行之前安装的内容cmake

于 2020-08-20T16:58:04.400 回答