いけだ@練馬です。
From: 竹村不二夫 <fujio@xxxxxxxxxxxxxxxx>
Subject: [vine-users:060121] X11ライブラリ環境について
Date: Fri, 02 May 2003 21:17:30 +0900
> X11リンク環境について教えて下さい。 これはvine 2.6CR でPCATもPP
> Cも同じ状態です。
>
> 以前のvine2.1CR(PCAT) の環境でX11を使用したプログラムを書きました。
> (簡単なもの) これをvine 2.6CR でコンパイルすると環境が違うためかエラー
> になります。 どの様な関連になっているのか教えていただければありがたいです。
>
> 質問1 (redhat−>vine2.1)
> まずX11のリンク方法で以前にredhatでコンパイルしていたときは
> -lX11 の記述でlibX11がリンクされていました。 Vineになってから
> /usr/bin/ld に登録がない! とエラーになります。 X11のパスはどの様に記
> 述するのでしょうか? またどこかにエイリアスをおいておけば良いのでしょうか?
私 (VineSeed こわれかけ) では、/etc/ld.so.conf に次のようにかかれて
います。
/usr/X11R6/lib
/usr/lib
/usr/local/lib
/usr/lib/sane
/usr/lib/qt-3.0.5/lib
コマンドラインから明示的にライブラリを検索するパスを指定するので
あれば、
gcc -o foo foo.c -L/usr/X11R6/lib -lX11
となります。
> 質問2 (vine2.1->2.6)
> vine2.1CRのレベルで、ライブラリを直接リンクしてみました。 コマンドは cc
> -o r.... /usr/X11R6/lib/libX11.a -lm と言う感じです。 これでエラーはなく
> リンクが出来ました。 がしかし vine2.6に同じソースを移行してコンパイルする
> と
> cc -o r myatoms.c viewfunctions.c robotmatrix.c robotview.c
> /usr/X11R6/lib/libX11.a -lm
> /usr/X11R6/lib/libX11.a(XlcDL.o): In function `try_both_dlsym':
> XlcDL.o(.text+0x111): undefined reference to `dlsym'
> XlcDL.o(.text+0x136): undefined reference to `dlsym'
> /usr/X11R6/lib/libX11.a(XlcDL.o): In function `open_object':
> XlcDL.o(.text+0x635): undefined reference to `dlopen'
> /usr/X11R6/lib/libX11.a(XlcDL.o): In function `close_object':
> XlcDL.o(.text+0x6a4): undefined reference to `dlclose'
> collect2: ld returned 1 exit status
> make: *** [r] エラー 1
man dlclose すると、
If this program were in a file named "foo.c", you would
build the program with the following command:
gcc -rdynamic -o foo foo.c -ldl
などと書いているので、-ldl を追加してみてはいかがでしょうか。
お役に立ちますように。
--
IKEDA Katsumi <cork@xxxxxxxxxxxxx>