How to link to libc++ on /usr/local/lib?

孤街浪徒 提交于 2019-12-22 18:28:32

问题


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)

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

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


回答1:


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

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.



来源:https://stackoverflow.com/questions/16205714/how-to-link-to-libc-on-usr-local-lib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!