2013年1月27日 星期日

ld: library not found for -lxxxxxx

這是gcc linker找不到可用的lib出現的錯誤訊息,只要找到該lib在你主機上的位置(前提是你已經有正確安裝完成),把位置丟進LIBRARY_PATH就可以了,不過通常還要加上C_INCLUDE_PATH
export LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/lib
export C_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/include
比如說我現在在mac上要裝ns2,在編譯tk8.5的時候需要X11,X11的東西都放在
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/lib
這個又臭又長的地方,也是可以建立軟連結到 /usr/lib 裡面去,就省去這篇說的使用ldconfig的方式加入新的library位置

沒有留言:

張貼留言