从10.8
移至10.9
会导致WFDB安装失败,找不到-lwfdb
的库。
这个程序
#include <wfdb/wfdb.h>
int main(void) { return 0; }
链接错误(因为必须包含Mavericks,-I/usr/include
,否则编译器错误):
567 ~/ clang -I/usr/include c.c -o c -lwfdb
ld: library not found for -lwfdb
我还尝试添加 -L/usr/lib
(libwfdb.10.5.20.dylib
,libwfdb.10.dylib
和libwfdb.dylib
所在的位置),但ld
仍然找不到-lwfdb
,
似乎小牛队完全删除了gcc
。 LD_LIBRARY_PATH
似乎只是运行时。一切都在Mountain Lion下运作。 我还应该尝试什么?
在仔细阅读clang
的{{1}}详细输出后(续下)......
-v
...我已将568 ~/ clang -v -I/usr/include c.c -o c -lwfdb
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name c.c -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 224.1 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -I /usr/include -fdebug-compilation-dir /Users/blaise/ -ferror-limit 19 -fmessage-length 170 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0 -fobjc-dispatch-method=mixed -fobjc-default-synthesize-properties -fencode-extended-block-signature -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/64/3l9hbm994q37l_bw79kf15bm0000gp/T/c-2iLIU4.o -x c c.c
clang -cc1 version 5.0 based upon LLVM 3.3svn default target x86_64-apple-darwin13.0.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.9.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -o c /var/folders/64/3l9hbm994q37l_bw79kf15bm0000gp/T/c-2iLIU4.o -lwfdb -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/lib/darwin/libclang_rt.osx.a
ld: library not found for -lwfdb
clang: error: linker command failed with exit code 1 (use -v to see invocation)
和libwfdb.10.5.20.dylib
libwfdb.dylib
添加到第一个文件中,从ln -s
内的/usr/lib
其< / em> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/
。
该程序现在链接正常。 但是,这肯定不是一个长期的解决方案?在10.9中进行的最佳方法是什么?例如。在当前usr/lib
内添加/usr/lib
的链接会在每次Xcode升级时中断...没有用。
答案 0 :(得分:2)
请尝试clang -v -I/usr/include c.c -o c -lwfdb
,了解clang
在搜索-lwfdb
时尝试执行的详细输出。然后,验证文件是否存在。
答案 1 :(得分:0)
尝试将
/usr/include
添加到$PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:
...
嗯,那个突然无法奏效。 $PATH
是可执行文件的搜索路径。
您应该将/usr/include
添加到包含路径。通过编译器调用 - 只需将-I/usr/include
添加到命令行 - 或者以clang
特定的方式我不知道。