/usr/bin/ld: cannot find と怒られたときの対処

事の経緯。

Universalchardet – やる気向上作戦
おー、使ってみよう。
make && make install で入れられるようだがcディレクトリにあるMakefileのDESTDIRを/home/funaki/libに変更してからmake && make install。
無事、/home/funaki/lib, includeにファイルが登場。

で、wikiに載っているサンプルプログラムをコンパイルしようとした。
% gcc -Wall test.cpp -I/home/funaki/include -luchardet
/usr/bin/ld: cannot find -luchardet
collect2: ld returned 1 exit status

あれ、と思い
# ldconfig /home/funaki/lib
# ldconfig

等々やってみたがうまくいかず。

最終的には
% g++ -Wall test.cpp -I/home/funaki/include -luchardet -L/home/funaki/lib
でうまくいった。
うーん、ldconfig -pで該当ファイルが出力されてもld -lだとcannot findになるのか。。?

% gcc –version
gcc (GCC) 4.1.2 20070626 (Red Hat 4.1.2-14)
% uname -a
Linux localhost 2.6.18-53.1.14.el5 #1 SMP Wed Mar 5 11:37:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux

This entry was posted in いじる. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Page optimized by WP Minify WordPress Plugin