问题
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