链接被阻塞了.. -rpath是什么? MacOS X [英] Linking is jacked up.. what is -rpath? MacOS X

查看:138
本文介绍了链接被阻塞了.. -rpath是什么? MacOS X的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在构建一个项目,它使用编译库(.dylib或.so)中的函数.我在适当的位置具有头文件和库文件(这是QtRoot的所有部分),但是当我尝试在Xcode中构建项目时,出现调试器错误:

So, I'm building a project, and it uses functions from a compiled library (.dylib or .so). I have the headers and the library files (this is all part of QtRoot, btw) in appropriate locations, but when I try to build my project in Xcode, I get a debugger error:

dyld:库未加载:@ rpath/libRIO.so 引用自:/Users/paulthompson/Documents/Programming/Build Products/Debug/MacHeliosSim.app/Contents/MacOS/MacHeliosSim 原因:找不到图片 共享库Apply-load-rules全部 暂时不可用的数据格式化程序,将在继续"后重试. (目前无法调用加载程序,它已被锁定.)

dyld: Library not loaded: @rpath/libRIO.so Referenced from: /Users/paulthompson/Documents/Programming/Build Products/Debug/MacHeliosSim.app/Contents/MacOS/MacHeliosSim Reason: image not found sharedlibrary apply-load-rules all Data Formatters temporarily unavailable, will re-try after a 'continue'. (Cannot call into the loader at present, it is locked.)

现在,如果我从Finder中打开程序,则内置的程序本身将运行良好,但是每当尝试从Xcode运行时,它都会对我不利. rpath是什么,为什么调试器无法找到库,即使Xcode本身知道它们在哪里,并且显然从Finder运行时,程序也可以找到它们?

Now, the program itself which is built will run just fine if I open it from the Finder, but whenever I try to run it from Xcode, it barfs at me. What is this rpath thing, and why can't the debugger find the libraries, even though Xcode itself knows where they are, and apparently the program when run from the Finder can find them too?

推荐答案

http://en.wikipedia.org/wiki/Rpath_(链接)

这是存储在二进制文件中以查找共享库的路径. 当您从Finder启动应用程序时,可能是应用程序捆绑包?创建应用程序捆绑包后,共享库将被复制到应用程序捆绑包中,然后捆绑库的路径就成为相对路径. (@executable_path/../Frameworks/foobar).您是如何创建可在Finder上运行的版本的?

It's a path stored in the binary to find shared libs. When you start the app from Finder, it's probably an app bundle? When app bundles are created, shared libraries are copied into the app bundle, and the paths to the bundled libraries become relative then. (@executable_path/../Frameworks/foobar). How did you create the version that works from Finder?

以上错误是否在链接时或从xcode启动应用程序时发生? (在后一种情况下,请尝试使用DYLD_LIBRARY_PATH)

Does the error above occur at link-time or when starting the application from xcode? (In the latter case, try with DYLD_LIBRARY_PATH)

此外,libRIO的.so扩展名(而不是.dylib)看起来有点可疑.

Also, the .so extension for libRIO instead of .dylib looks a bit suspicious.

这篇关于链接被阻塞了.. -rpath是什么? MacOS X的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆