如何链接到/usr/local/lib上的libc ++? [英] How to link to libc++ on /usr/local/lib?

查看:249
本文介绍了如何链接到/usr/local/lib上的libc ++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试提供-L /usr/local/lib,尝试-nostdinc++,尝试设置DYLD_LIBRARY_PATHDYLD_FALLBACK_LIBRARY_PATH,但是otool离开给了我:

I've tried to provide -L /usr/local/lib, tried -nostdinc++, tried to set DYLD_LIBRARY_PATH and DYLD_FALLBACK_LIBRARY_PATH but otool aways gives me:

otool -L sample
sample:
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)

如何链接到我在OS X上自定义编译的/usr/local/lib/libc++.dylib?

How to link to my custom compiled /usr/local/lib/libc++.dylib on OS X?

编译的变化基于基本的clang++ -std=c++11 -stdlib=libc++.

Variations of compilation were upon basic clang++ -std=c++11 -stdlib=libc++.

推荐答案

正如您所指出的,带有-L的oTool告诉您正在/usr/lib中使用libc ++.1.dylib.

As you've pointed out, oTool with -L is telling you that the libc++.1.dylib is being used from /usr/lib.

OSX开发为您提供了* install_name_tool *命令,该命令使您可以设置所需路径的位置.

OSX development provides you with the command *install_name_tool*, which allows you to set the location of the required paths.

作为示例,您将使用如下所示的内容:-

As an example, you'd use it something like this: -

install_name_tool -change /usr/lib/libc++.1.dylib /usr/local/lib/libc++.dylib <target file>

第一个路径是当前路径,第二个是您要将其更改为的路径,第三个是您要为其更改路径的文件.

where the first path is the current path, the second is the one you want to change it to and the third is the file you're changing the paths for.

这篇关于如何链接到/usr/local/lib上的libc ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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