我无法按照此处的说明编译OSL: https://github.com/imageworks/OpenShadingLanguage/blob/master/INSTALL.md
该错误抱怨缺少环境变量OPENIMAGEIO_LIBRARY_DIRS。我尝试自己构建OpenImageIO或使用vcpkg。因此,我设置了所有其他缺失的变量(例如OPENIMAGEIO_LIBRARIES) 如果要设置该OPENIMAGEIO_LIBRARY_DIRS,应该指向哪里? 也是为什么它说确实找到了变量,但又说“找到了” 合适的版本“ 2.1.0”,最低要求为“ 1.8.5””?
这是在构建OSL(我在Mac上)时遇到的错误:
-- Building OSL 1.11.0
-- CMake version is 3.13.3
CMake Deprecation Warning at CMakeLists.txt:20 (cmake_policy):
The OLD behavior for policy CMP0046 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- Project build dir = /Users/simionnacu/Desktop/TestingGrounds/osl/build/macosx
-- Project install dir = /Users/simionnacu/Desktop/TestingGrounds/osl/dist/macosx
-- platform = macosx
-- CMAKE_CXX_COMPILER is /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- CMAKE_CXX_COMPILER_ID is AppleClang
-- Building for C++11
-- Setting Namespace to: OSL_v1_11
CMake Error at /usr/local/Cellar/cmake/3.13.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find OpenImageIO (missing: OPENIMAGEIO_LIBRARY_DIRS) (found
suitable version "2.1.0", minimum required is "1.8.5")
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.13.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
src/cmake/modules/FindOpenImageIO.cmake:79 (find_package_handle_standard_args)
src/cmake/externalpackages.cmake:58 (find_package)
CMakeLists.txt:133 (include)
答案 0 :(得分:1)
因此脚本src/cmake/modules/FindOpenImageIO.cmake的行为以不寻常的方式出现:
如果第一次运行时失败,则它将失败所有cmake的调用都将进一步。
在第一次失败后使其成功的唯一方法是删除CMake缓存文件(构建目录中的cmake
)。
通常这样写CMakeCache.txt
,以便如果第一次 FindXXX.cmake
未运行找不到库,则可能调整环境设置并重新运行 cmake
,以尝试再次搜索该库。 CMake命令cmake
,find_library
和类似命令完全支持这种行为。
脚本find_path
使用
FindOpenImageIO.cmake
查找find_library(OPENIMAGEIO_LIBRARY ...)
库,然后将库文件的目录部分提取到另一个变量OpenImageIO
中:
OPENIMAGEIO_LIBRARY_DIRS
但是它缓存这样提取的结果(由于有get_filename_component (OPENIMAGEIO_LIBRARY_DIRS "${OPENIMAGEIO_LIBRARY}" DIRECTORY CACHE)
选项),因此,如果不是第一次找不到该库,则变量CACHE
变为空,并且再也不会被重写(因为它已被缓存)。变量的空性由“找不到库”脚本处理。
答案 1 :(得分:0)
错误消息
Could NOT find OpenImageIO (missing: OPENIMAGEIO_LIBRARY_DIRS) (found
suitable version "2.1.0", minimum required is "1.8.5")
表示CMake已找到OpenImageIO headers ,已从其中检测到版本(2.1.0),但无法找到库。
给出的错误消息告诉什么 环境变量设置,OPENIMAGEIO_LIBRARY_DIRS
是脚本使用的 CMake变量。>
但是,如果打开src/cmake/modules/FindOpenImageIO.cmake脚本(在CMake调用跟踪中列出),则可能会找到一种方法来提示有关OpenImageIO的安装:
# Special inputs:
# OPENIMAGEIO_ROOT_DIR - custom "prefix" location of OIIO installation
# (expecting bin, lib, include subdirectories)
也就是说,您可以将OPENIMAGEIO_ROOT_DIR
environment 变量设置为OpenImageIO库的安装路径。如注释中所述,此安装路径期望包含bin/
,lib/
和include/
子目录。在lib/
子目录中,它应该是OpenImageIO
库文件(带有适当的前缀和后缀)。