libevent をスタティックリンクでコンパイルする方法をメモ。

標準の configure オプションで shared, static ともに有効になってる。

なので configure オプションは変更なし。

./configure --prefix=/usr/local/libevent

shared が気になるときは

./configure --prefix=/usr/local/libevent --disable-shared

とすればOK。

make
make install

これでインストールまで完了。

続いてMakefile

main.o の後ろに /usr/local/libevent/lib/libevent.a をひっつける。

環境によっては make 時にエラーが出るっぽい。
CentOS5 で試したときは LIBS に -lrt を追加してあげないとエラーになった。

Makefile

一応 サンプル

関連エントリー:

libevent + 使い方

libevent + チャットサーバ

Mac + Subversion + インストール

autotools + 使い方

autotools + with-mysql

 Leave a Reply

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> <img localsrc="" alt=""> <pre lang="" line="" escaped="" highlight="">