dyld没有加载Ogre库

时间:2019-03-27 23:46:49

标签: c++ macos clion ogre dyld

我正在尝试设置一个环境来开发Ogre3D应用程序。我已将Ogre手动编译到文件夹driver.execute_script("arguments[0].click();",unit[i]) 中,并在CLion中使用以下内容创建了一个CMake项目:

/opt/Ogre3D/ogre-1.11.5/build

当我尝试运行它时,编译就可以了,但无法执行:

cmake_minimum_required(VERSION 3.13)
project(sample)

set(CMAKE_CXX_STANDARD 14)
set(OGRE_DIR /opt/Ogre3D/ogre-1.11.5/build/sdk/cmake)

# specify which version and components you need
find_package(OGRE 1.11 REQUIRED COMPONENTS Bites RTShaderSystem)

# copy resource.cfg next to our binaries where OGRE looks for it
file(COPY ${OGRE_CONFIG_DIR}/resources.cfg DESTINATION ${CMAKE_BINARY_DIR})

add_executable(sample main.cpp)
target_link_libraries(sample ${OGRE_LIBRARIES})

我看过/Users/diego/CLionProjects/ogre/sample/cmake-build-debug/sample dyld: Library not loaded: @executable_path/../Frameworks/OgreBites.framework/Versions/1.11.5/OgreBites Referenced from: /Users/diego/CLionProjects/ogre/sample/cmake-build-debug/sample Reason: image not found Process finished with exit code 6 ,有一个名为otool -l /opt/Ogre3D/ogre-1.11.5/build/lib/macosx/OgreBites.framework/Versions/1.11.5/OgreBites的命令LC_ID_DYLIB,它与运行时错误中给出的路径匹配。但是我不知道现在应该采取什么步骤,因为我对macOS上的本机库解析经验很少。

更新

执行命令@executable_path/../Frameworks/OgreBites.framework/Versions/1.11.5/OgreBites使链接程序找到该库,但随后的连接库失败。我想/希望CMake中有一个选项可以将其传递给编译器,以便在Ogre编译期间创建的二进制文件不使用install_name_tool指令?

0 个答案:

没有答案