3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

さくっとバイナリ配布できるmemcachedを作る

Last updated at Posted at 2016-12-13

バイナリ配布したい

CentOS6をminimal(最小構成)でインストールした状態で使える memcached 欲しいですよね。
さくっとバイナリ配布したい。

そのビルド方法です。(以下、2016/12/13現在の話です)

yumで入るmemcachedの依存関係

# ldd /usr/bin/memcached
	linux-vdso.so.1 =>  (0x00007fffab5ff000)
	libevent-1.4.so.2 => /usr/lib64/libevent-1.4.so.2 (0x00007f7ee6219000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f7ee5ffc000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f7ee5c67000)
	libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f7ee5a4e000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f7ee5846000)
	libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f7ee562b000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f7ee6441000)

libevent 以外は minimalに含まれますね。では libenvetだけ static linkしましょう。

libeventを disable-sharedでビルド

https://github.com/libevent/libevent/releases から v1.4.xの最新をとってきます。

wget -O- https://github.com/libevent/libevent/archive/release-1.4.15-stable.tar.gz|tar xvfz -

cd libevent-release-1.4.15-stable
./autogen.sh
./configure --disble-shared
make

memcachedをビルド

http://memcached.org/ からソースを取ってきます。

wget -O- http://www.memcached.org/files/memcached-1.4.33.tar.gz | tar xvfz -

cd memcached-1.4.33
./configure --with-libevent=../libevent-release-1.4.15-stable/.libs
make

できた!

# ldd ./memcached
	linux-vdso.so.1 =>  (0x00007fffc33ff000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f8e073b6000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f8e07198000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f8e06e04000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f8e075cb000)

minimalなサーバーにこのバイナリ1つだけ送って、さくっと動きます。便利ですね。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?