Mac OS X 上链接库的默认搜索目录是什么
我在 Mac OS X 上使用 CMake 构建了 Google Test 并获得了两个共享库:< em>libgtest.dylib 和 libgtest_main.dylib。现在我需要安装它们。我知道Linux上有一些默认的搜索目录,例如/usr/lib、/usr/local/lib等。但我不熟悉Mac OS X并且不知道将这些库放在哪里。
在 Mac OS X 目录结构中,我发现有三个库目录:~/Library、/Library和/usr/lib。我尝试将 gtest 库分别放入这些目录中,发现只有 /usr/lib 有效。
我想知道的是,Mac OS X 上的默认搜索目录是否有一些规则,就像 Linux 和 Windows 上一样。
I've build the Google Test with CMake on Mac OS X and get two shared libraries: libgtest.dylib and libgtest_main.dylib. And now I need install both them. I know there are some default search directories on Linux, such as /usr/lib, /usr/local/lib, etc.. But I am unfamiliar with Mac OS X and don't know where to place those libraries.
In Mac OS X Directory Structure, I find there are three directories of libraries: ~/Library, /Library and /usr/lib. And I've tried to place gtest libraries into these directories respectively and found out only /usr/lib works.
What I want to know is wether there are some rules about the default search directories on Mac OS X just like on Linux and Windows.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看 dyld 链接器:
这篇关于“在 Mac OS X 上部署应用程序”的文章和 其他有关“Mac OS X 安装程序”的文章也可能有所帮助。
Take a look at the default values for environment variables used by the dyld linker:
This article about "Deploying an Application on Mac OS X" and other article about "Mac OS X installers" may also help.
除了@linuxbuild的答案之外,我还找到了文章 "动态库Apple 开发者档案中的“编程主题 > 库搜索过程” 很有帮助。它解释了
libname.dylib
和path/to/libname.dylib
的搜索顺序不同。In addition to @linuxbuild's answer, I've found the article "Dynamic Library Programming Topics > The Library Search Process" from Apple's Developer archive helpful. It explains that the search order differs for
libname.dylib
andpath/to/libname.dylib
.