face_detect 0.0.1をインストールする
0.改訂履歴
- 2007.10.23 新規作成
1.はじめに
このドキュメントでは,OpenCV1.0.0で提供される顔認識用の関数?のface_detectを,PHPから呼び出す事ができる様にするPHP拡張機能のface_detect 0.0.1をインストールする手順を説明する.
なお,使用しているOSは,RedHat Linux ES上で稼働している.
2.モジュールの入手
- モジュールを入手する.
[root@uranos open]# curl -O http://www.netflowers.co.jp/face_detect/face_detect-0.0.1.tar.gz % Total % Received % Xferd Average Speed Time Curr. Dload Upload Total Current Left Speed 100 7168 100 7168 0 0 58754 0 0:00:00 0:00:00 0:00:00 137k [root@uranos open]# |
- ファイルを確認する.
[root@uranos open]# ls -la face_detect-0.0.1.tar.gz -rw-r--r-- 1 root root 7168 Oct 23 19:36 face_detect-0.0.1.tar.gz [root@uranos open]# |
- 圧縮ファイルを展開する.
[root@uranos open]# gzip -d face_detect-0.0.1.tar.gz [root@uranos open]# ls -la total 48 drwxr-xr-x 2 root root 4096 Oct 23 19:37 . drwxr-xr-x 19 root root 4096 Oct 23 19:36 .. -rw-r--r-- 1 root root 40960 Oct 23 19:36 face_detect-0.0.1.tar [root@uranos open]# |
- アーカイブを展開する.
[root@uranos open]# tar xf face_detect-0.0.1.tar [root@uranos open]# ls -la total 52 drwxr-xr-x 3 root root 4096 Oct 23 19:37 . drwxr-xr-x 19 root root 4096 Oct 23 19:36 .. drwxr-xr-x 4 root root 4096 Mar 13 2007 face_detect-0.0.1 -rw-r--r-- 1 root root 40960 Oct 23 19:36 face_detect-0.0.1.tar [root@uranos open]# |
- ディレクトリを移動してファイルを見る.
[root@uranos open]# cd face_detect-0.0.1 [root@uranos face_detect-0.0.1]# ls -1 EXPERIMENTAL README config.m4 config.w32 face_detect.c face_detect.dsp face_detect.xml manual package.xml package2.xml php_face_detect.h tests [root@uranos face_detect-0.0.1]# |
- PHO拡張モジュールの準備をするために,phpizeコマンドを実行する.
[root@uranos face_detect-0.0.1]# phpize Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20060613 Zend Extension Api No: 220060519 [root@uranos face_detect-0.0.1]# |
- configtureを実行する.
[root@uranos face_detect-0.0.1]# ./configure checking for egrep... grep -E checking for a sed that does not truncate output... /bin/sed checking for gcc... gcc checking for C compiler default output... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking whether gcc and cc understand -c and -o together... yes checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu checking for PHP prefix... /usr/local checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/ main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/ include/php/ext -I/usr/local/include/php/ext/date/lib checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug- non-zts-20060613 checking for PHP installed headers prefix... /usr/local/include/php checking for re2c... no configure: WARNING: You will need re2c 0.9.11 or later if you want to regenerate PHP parsers. checking for gawk... gawk checking whether face_detect is available... yes, shared checking for face_detect in default path... found in /usr/local checking how to run the C preprocessor... gcc -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking opencv/cv.h usability... yes checking opencv/cv.h presence... yes checking for opencv/cv.h... yes checking opencv/highgui.h usability... yes checking opencv/highgui.h presence... yes checking for opencv/highgui.h... yes checking for ld used by gcc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for /usr/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -B checking whether ln -s works... yes checking how to recognise dependent libraries... pass_all checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking how to run the C++ preprocessor... g++ -E checking the maximum length of command line arguments... 32768 checking command to parse /usr/bin/nm -B output from gcc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if gcc static flag works... yes checking if gcc supports -fno-rtti -fno-exceptions... yes checking for gcc option to produce PIC... -fPIC checking if gcc PIC flag -fPIC works... yes checking if gcc supports -c -o file.o... yes checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no creating libtool appending configuration tag "CXX" to libtool checking for ld used by g++... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes checking for g++ option to produce PIC... -fPIC checking if g++ PIC flag -fPIC works... yes checking if g++ supports -c -o file.o... yes checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes configure: creating ./config.status config.status: creating config.h [root@uranos face_detect-0.0.1]# |
- 問題なく完了.
- makeを実行.
[root@uranos face_detect-0.0.1]# make /bin/sh /www/system/InstallBin/open/face_detect-0.0.1/libtool --mode=compile gcc -I. -I/www/system/InstallBin/open/face_detect-0.0.1 -DPHP_ATOM_INC -I/www/system /InstallBin/open/face_detect-0.0.1/include -I/www/system/InstallBin/open/face_ detect-0.0.1/main -I/www/system/InstallBin/open/face_detect-0.0.1 -I/usr/local/ include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/ local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext /date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /www/system/ InstallBin/open/face_detect-0.0.1/face_detect.c -o face_detect.lo mkdir .libs gcc -I. -I/www/system/InstallBin/open/face_detect-0.0.1 -DPHP_ATOM_INC -I/www/ system/InstallBin/open/face_detect-0.0.1/include -I/www/system/InstallBin/open/ face_detect-0.0.1/main -I/www/system/InstallBin/open/face_detect-0.0.1 -I/usr/ local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I /usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/ php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /www/system/ InstallBin/open/face_detect-0.0.1/face_detect.c -fPIC -DPIC -o .libs/face_ detect.o /bin/sh /www/system/InstallBin/open/face_detect-0.0.1/libtool --mode=link gcc - DPHP_ATOM_INC -I/www/system/InstallBin/open/face_detect-0.0.1/include -I/www/ system/InstallBin/open/face_detect-0.0.1/main -I/www/system/InstallBin/open/face _detect-0.0.1 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/ local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -o face_detect.la -export-dynamic -avoid-version -prefer-pic -module - rpath /www/system/InstallBin/open/face_detect-0.0.1/modules face_detect.lo -Wl, -rpath,/usr/local/lib -L/usr/local/lib -lml -Wl,-rpath,/usr/local/lib -L/usr/ local/lib -lcxcore -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lhighgui -Wl,- rpath,/usr/local/lib -L/usr/local/lib -lcvaux -Wl,-rpath,/usr/local/lib -L/usr/ local/lib -lcv gcc -shared .libs/face_detect.o -L/usr/local/lib /usr/local/lib/libml.so /usr/ local/lib/libcxcore.so /usr/local/lib/libhighgui.so -L/usr/lib /usr/local/lib/ libcvaux.so /usr/local/lib/libcv.so -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath - Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib - Wl,-rpath -Wl,/usr/local/lib -Wl,-soname -Wl,face_detect.so -o .libs/face_detect. so creating face_detect.la (cd .libs && rm -f face_detect.la && ln -s ../face_detect.la face_detect.la) /bin/sh /www/system/InstallBin/open/face_detect-0.0.1/libtool --mode=install cp . /face_detect.la /www/system/InstallBin/open/face_detect-0.0.1/modules cp ./.libs/face_detect.so /www/system/InstallBin/open/face_detect-0.0.1/modules/ face_detect.so cp ./.libs/face_detect.lai /www/system/InstallBin/open/face_detect-0.0.1/modules /face_detect.la PATH="$PATH:/sbin" ldconfig -n /www/system/InstallBin/open/face_detect-0.0.1/ modules ---------------------------------------------------------------------- Libraries have been installed in: /www/system/InstallBin/open/face_detect-0.0.1/modules If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,--rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- Build complete. (It is safe to ignore warnings about tempnam and tmpnam). [root@uranos face_detect-0.0.1]# |
- これまた問題なく.
- installを実行.
[root@uranos face_detect-0.0.1]# make install Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ [root@uranos face_detect-0.0.1]# |
- インストールされたファイルを確認する.
[root@uranos face_detect-0.0.1]# ls -la /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ total 168 drwxr-xr-x 2 root root 4096 Oct 23 19:42 . drwxr-xr-x 4 root root 4096 Apr 26 21:28 .. -rwxr-xr-x 1 root root 70265 Oct 23 19:42 face_detect.so -rwxr-xr-x 1 root root 77854 Apr 27 18:18 mecab.so [root@uranos face_detect-0.0.1]# |
- 次は,PHP.INIに以下の項目を追加する.
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613/" extension=face_detect.so |
- Apacheを利用している場合は,Apacheを再起動する.