我正在尝试用 Meson 编译一个使用 OpenImageIO 的 c++ 程序。我已经在我的 PopOS 机器上安装了 OpenImageIO:
$ sudo apt install libopenimageio-dev
它清楚地列在 pkg-config 列表中:
$ pkg-config --list-all
IlmBase IlmBase - Base math and exception libraries
OpenEXR OpenEXR - OpenEXR image library
OpenImageIO OpenImageIO - OpenImageIO is a library for reading and writing images.
Qt5Concurrent Qt5 Concurrent - Qt Concurrent module
Qt5Core Qt5 Core - Qt Core module
...
但是 Meson 找不到 OpenImageIO 作为依赖项:
meson.build:5:0: ERROR: Dependency "OpenImageIO" not found, tried pkgconfig and cmake
我的 meson.build 是:
project('liquid-resize', 'cpp')
src = ['main.cpp', 'liquid-resize.cpp']
incdir = include_directories('include')
oiio = dependency('OpenImageIO')
executable('liquid-resize',
sources : src,
include_directories : incdir,
dependencies : oiio)
完整的介子错误日志在这里:
Build started at 2022-02-11T21:42:27.998986
Main binary: /usr/bin/python3
Build Options:
Python system: Linux
The Meson build system
Version: 0.59.1
Source dir: /home/mitch/proj/liquid-resize
Build dir: /home/mitch/proj/liquid-resize/builddir
Build type: native build
Project name: liquid-resize
Project version: undefined
Sanity testing C++ compiler: ccache c++
Is cross compiler: False.
Sanity check compiler command line: ccache c++ sanitycheckcpp.cc -o sanitycheckcpp.exe -D_FILE_OFFSET_BITS=64
Sanity check compile stdout:
-----
Sanity check compile stderr:
-----
Running test binary command: /home/mitch/proj/liquid-resize/builddir/meson-private/sanitycheckcpp.exe
C++ compiler for the host machine: ccache c++ (gcc 11.2.0 "c++ (GCC) 11.2.0")
C++ linker for the host machine: c++ ld.bfd 2.37
Sanity testing C++ compiler: ccache c++
Is cross compiler: False.
Sanity check compiler command line: ccache c++ sanitycheckcpp.cc -o sanitycheckcpp.exe -D_FILE_OFFSET_BITS=64
Sanity check compile stdout:
-----
Sanity check compile stderr:
-----
Running test binary command: /home/mitch/proj/liquid-resize/builddir/meson-private/sanitycheckcpp.exe
C++ compiler for the build machine: ccache c++ (gcc 11.2.0 "c++ (GCC) 11.2.0")
C++ linker for the build machine: c++ ld.bfd 2.37
Build machine cpu family: x86_64
Build machine cpu: x86_64
Host machine cpu family: x86_64
Host machine cpu: x86_64
Target machine cpu family: x86_64
Target machine cpu: x86_64
Pkg-config binary for MachineChoice.HOST is not cached.
Pkg-config binary missing from cross or native file, or env var undefined.
Trying a default Pkg-config fallback at pkg-config
Found pkg-config: /usr/bin/pkg-config (1.8.0)
Determining dependency 'OpenImageIO' with pkg-config executable '/usr/bin/pkg-config'
env[PKG_CONFIG_PATH]:
Called `/usr/bin/pkg-config --modversion OpenImageIO` -> 1
CMake binary for 1 is not cached
CMake binary missing from cross or native file, or env var undefined.
Trying a default CMake fallback at cmake
Found CMake: /usr/bin/cmake (3.21.3)
Extracting basic cmake information
CMake Toolchain: Calling CMake once to generate the compiler state
Calling CMake (['/usr/bin/cmake']) in /home/mitch/proj/liquid-resize/builddir/meson-private/__CMake_compiler_info__ with:
- "--trace-expand"
- "--trace-format=json-v1"
- "--no-warn-unused-cli"
- "--trace-redirect=cmake_trace.txt"
- "-G"
- "Ninja"
- "-DCMAKE_TOOLCHAIN_FILE=/home/mitch/proj/liquid-resize/builddir/meson-private/__CMake_compiler_info__/CMakeMesonTempToolchainFile.cmake"
- "."
Try CMake generator: auto
Calling CMake (['/usr/bin/cmake']) in /home/mitch/proj/liquid-resize/builddir/meson-private/cmake_OpenImageIO with:
- "--trace-expand"
- "--trace-format=json-v1"
- "--no-warn-unused-cli"
- "--trace-redirect=cmake_trace.txt"
- "-DCMAKE_TOOLCHAIN_FILE=/home/mitch/proj/liquid-resize/builddir/meson-private/cmake_OpenImageIO/CMakeMesonToolchainFile.cmake"
- "."
-- Module search paths: ['/', '/opt', '/usr', '/usr/local']
-- CMake root: /usr/share/cmake-3.21
-- CMake architectures: ['aarch64-linux-gnu', 'arm-linux-gnueabihf', 'i386-linux-gnu', 'x86_64-linux-gnu']
-- CMake lib search paths: ['lib', 'lib32', 'lib64', 'libx32', 'share', 'lib/aarch64-linux-gnu', 'lib/arm-linux-gnueabihf', 'lib/i386-linux-gnu', 'lib/x86_64-linux-gnu']
Preliminary CMake check failed. Aborting.
Run-time dependency openimageio found: NO (tried pkgconfig and cmake)
meson.build:5:0: ERROR: Dependency "OpenImageIO" not found, tried pkgconfig and cmake
我也尝试过依赖“openimageio2”和“OpenImageIO-2.2.10.1”。