» home

/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

By: funaki | 2008年3月13日 | いじる | Trackback | Comments [RSS 2.0]

コメントはまだありません。 »

RSS feed for comments on this post. TrackBack URI

コメントはお気軽にどうぞ

↑top