在Mac OS X上链接库的默认搜索目录是什么? [英] What are the default search directories to link a library on Mac OS X

查看:135
本文介绍了在Mac OS X上链接库的默认搜索目录是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Mac OS X上使用CMake构建了 Google Test ,并获得了两个共享库: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上一样。

解决方案

查看 dyld 链接器:



< blockquote>

DYLD_FALLBACK_LIBRARY_PATH

    ...

默认情况下,它设置为
$(HOME)/ lib:/ usr / local / lib:/ lib:/ usr / lib


这篇关于在Mac上部署应用程序的文章OS X和其他有关Mac OS X安装程序的文章也可能有帮助。 p>

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.

解决方案

Take a look at the default values for environment variables used by the dyld linker:

DYLD_FALLBACK_LIBRARY_PATH
   ...
By default, it is set to $(HOME)/lib:/usr/local/lib:/lib:/usr/lib

This article about "Deploying an Application on Mac OS X" and other article about "Mac OS X installers" may also help.

这篇关于在Mac OS X上链接库的默认搜索目录是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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