iPhoneアプリにiStatがあるんだがリモートホストの状況をリアルタイムでモニター出来るから便利なので使っていたがサーバー機をDebian GNU/Linuxに変えたので使えないな〜と思いながらiStatのホームページを見ているとLinux用のソースがあるので入れてみた。
解凍して./configureを走らしたら、なんとかなるかなとか思っていたが上手くコンパイルすら出来なかったのでディスカッションを見てみると色々参考になった。
とりあえず
$wget http://istat.googlecode.com/files/istat-0.5.3.tar.gz
$tar -xvf ~/istat-0.5.3.tar.gz #cd ~/istat-0.5.3 # ./configure
checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for g++... no checking for c++... no checking for gpp... no checking for aCC... no checking for CC... no checking for cxx... no checking for cc++... no checking for cl.exe... no checking for FCC... no checking for KCC... no checking for RCC... no checking for xlC_r... no checking for xlC... no checking for C++ compiler default output file name... configure: error: in `/home/dev/istat-0.5.3': configure: error: C++ compiler cannot create executables See `config.log' for more details.
実行ファイルが作れないそうだ…gccのバージョンが古いのかと思って
# gcc --version
gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# apt-get update # apt-get install build-essential
build-essentialを入れるといいらしい。しかしこんなコマンド知らねーよ…
Reading package lists... Done Building dependency tree... Done The following extra packages will be installed: g++ g++-4.1 libstdc++6-4.1-dev Suggested packages: gcc-4.1-doc lib64stdc++6 libstdc++6-4.1-doc The following NEW packages will be installed: build-essential g++ g++-4.1 libstdc++6-4.1-dev 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 4595kB of archives. After unpacking 18.2MB of additional disk space will be used. Do you want to continue [Y/n]? y Get:1 http://ftp.jp.debian.org etch/main libstdc++6-4.1-dev 4.1.1-21 [1725kB] Get:2 http://ftp.jp.debian.org etch/main g++-4.1 4.1.1-21 [2862kB] Get:3 http://ftp.jp.debian.org etch/main g++ 4:4.1.1-15 [1362B] Get:4 http://ftp.jp.debian.org etch/main build-essential 11.3 [6986B] Fetched 4595kB in 3s (1527kB/s) Selecting previously deselected package libstdc++6-4.1-dev. (Reading database ... 90864 files and directories currently installed.) Unpacking libstdc++6-4.1-dev (from .../libstdc++6-4.1-dev_4.1.1-21_powerpc.deb) ... Selecting previously deselected package g++-4.1. Unpacking g++-4.1 (from .../g++-4.1_4.1.1-21_powerpc.deb) ... Selecting previously deselected package g++. Unpacking g++ (from .../g++_4%3a4.1.1-15_powerpc.deb) ... Selecting previously deselected package build-essential. Unpacking build-essential (from .../build-essential_11.3_powerpc.deb) ... Setting up libstdc++6-4.1-dev (4.1.1-21) ... Setting up g++-4.1 (4.1.1-21) ... Setting up g++ (4.1.1-15) ... Setting up build-essential (11.3) ...
もう一度
# ./configure
checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for g++... g++ checking for C++ compiler default output file name... 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 g++ accepts -g... yes checking for style of include used by make... GNU checking dependency style of g++... gcc3 checking for gcc... gcc checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking dependency style of gcc... gcc3 checking for a BSD-compatible install... /usr/bin/install -c checking if the compiler supports -Wall... yes checking if the linker supports -rdynamic... yes checking for dlopen in -ldl... yes checking for xml2-config... no configure: error: cannot find xml2-config: depending on your operating system you may need to install a '-dev' package for libxml2
libxml2-devが必要だそうだ。
# apt-get install libxml2-dev
Reading package lists... Done Building dependency tree... Done The following NEW packages will be installed: libxml2-dev 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 771kB of archives. After unpacking 2421kB of additional disk space will be used. Get:1 http://ftp.jp.debian.org etch/main libxml2-dev 2.6.27.dfsg-6 [771kB] Fetched 771kB in 0s (877kB/s) Selecting previously deselected package libxml2-dev. (Reading database ... 91396 files and directories currently installed.) Unpacking libxml2-dev (from .../libxml2-dev_2.6.27.dfsg-6_powerpc.deb) ... Setting up libxml2-dev (2.6.27.dfsg-6) ...
再度
# # ./configure --prefix=/usr --sysconfdir=/etc
checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for g++... g++ checking for C++ compiler default output file name... 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 g++ accepts -g... yes checking for style of include used by make... GNU checking dependency style of g++... gcc3 checking for gcc... gcc checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking dependency style of gcc... gcc3 checking for a BSD-compatible install... /usr/bin/install -c checking if the compiler supports -Wall... yes checking if the linker supports -rdynamic... yes checking for dlopen in -ldl... yes checking for xml2-config... xml2-config checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -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 libxml/parser.h usability... yes checking libxml/parser.h presence... yes checking for libxml/parser.h... yes checking for xmlFileOpen... yes checking for kstat_open in -lkstat... no checking arpa/inet.h usability... yes checking arpa/inet.h presence... yes checking for arpa/inet.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking mntent.h usability... yes checking mntent.h presence... yes checking for mntent.h... yes checking netdb.h usability... yes checking netdb.h presence... yes checking for netdb.h... yes checking for stdlib.h... (cached) yes checking for string.h... (cached) yes checking paths.h usability... yes checking paths.h presence... yes checking for paths.h... yes checking sys/socket.h usability... yes checking sys/socket.h presence... yes checking for sys/socket.h... yes checking sys/statfs.h usability... yes checking sys/statfs.h presence... yes checking for sys/statfs.h... yes checking sys/statvfs.h usability... yes checking sys/statvfs.h presence... yes checking for sys/statvfs.h... yes checking sys/mnttab.h usability... no checking sys/mnttab.h presence... no checking for sys/mnttab.h... no checking sys/loadavg.h usability... no checking sys/loadavg.h presence... no checking for sys/loadavg.h... no checking kstat.h usability... no checking kstat.h presence... no checking for kstat.h... no checking errno.h usability... yes checking errno.h presence... yes checking for errno.h... yes checking sys/sysinfo.h usability... yes checking sys/sysinfo.h presence... yes checking for sys/sysinfo.h... yes checking sys/processor.h usability... no checking sys/processor.h presence... no checking for sys/processor.h... no checking sys/swap.h usability... yes checking sys/swap.h presence... yes checking for sys/swap.h... yes checking for stdbool.h that conforms to C99... yes checking for _Bool... yes checking for pid_t... yes checking vfork.h usability... no checking vfork.h presence... no checking for vfork.h... no checking for fork... yes checking for vfork... yes checking for working fork... yes checking for working vfork... (cached) yes checking for library containing getmntent... none required checking for gethostbyname... yes checking for getmntent... (cached) yes checking for inet_ntoa... yes checking for memset... yes checking for mkdir... yes checking for select... yes checking for socket... yes checking for strerror... yes checking for statvfs... yes checking for setmntent... yes checking for getloadavg... yes checking for swapctl... no checking for struct mnttab.mnt_special... no checking for struct mntent.mnt_fsname... yes checking for struct statvfs.f_frsize... yes checking for default location of configuration file... /etc/istat.conf configure: creating ./config.status config.status: creating Makefile config.status: creating resource/Makefile config.status: creating config.h config.status: executing depfiles commands
config出来たようだ。
# make
make all-recursive make[1]: Entering directory `/home/debian/istat-0.5.3' Making all in resource make[2]: Entering directory `/home/debian/istat-0.5.3/resource' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/home/debian/istat-0.5.3/resource' make[2]: Entering directory `/home/debian/istat-0.5.3' g++ -DHAVE_CONFIG_H -I. -Wall -I/usr/include/libxml2 -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.cpp mv -f .deps/main.Tpo .deps/main.Po g++ -DHAVE_CONFIG_H -I. -Wall -I/usr/include/libxml2 -g -O2 -MT conf.o -MD -MP -MF .deps/conf.Tpo -c -o conf.o conf.cpp mv -f .deps/conf.Tpo .deps/conf.Po g++ -DHAVE_CONFIG_H -I. -Wall -I/usr/include/libxml2 -g -O2 -MT argument.o -MD -MP -MF .deps/argument.Tpo -c -o argument.o argument.cpp mv -f .deps/argument.Tpo .deps/argument.Po g++ -DHAVE_CONFIG_H -I. -Wall -I/usr/include/libxml2 -g -O2 -MT switchboard.o -MD -MP -MF .deps/switchboard.Tpo -c -o switchboard.o switchboard.cpp mv -f .deps/switchboard.Tpo .deps/switchboard.Po g++ -DHAVE_CONFIG_H -I. -Wall -I/usr/include/libxml2 -g -O2 -MT socket.o -MD -MP -MF .deps/socket.Tpo -c -o socket.o socket.cpp mv -f .deps/socket.Tpo .deps/socket.Po g++ -DHAVE_CONFIG_H -I. -Wall -I/usr/include/libxml2 -g -O2 -MT socketset.o -MD -MP -MF .deps/socketset.Tpo -c -o socketset.o socketset.cpp mv -f .deps/socketset.Tpo .deps/socketset.Po g++ -DHAVE_CONFIG_H -I. -Wall -I/usr/include/libxml2 -g -O2 -MT clientset.o -MD -MP -MF .deps/clientset.Tpo -c -o clientset.o clientset.cpp mv -f .deps/clientset.Tpo .deps/clientset.Po g++ -DHAVE_CONFIG_H -I. -Wall -I/usr/include/libxml2 -g -O2 -MT isr.o -MD -MP -MF .deps/isr.Tpo -c -o isr.o isr.cpp mv -f .deps/isr.Tpo .deps/isr.Po g++ -DHAVE_CONFIG_H -I. -Wall -I/usr/include/libxml2 -g -O2 -MT daemon.o -MD -MP -MF .deps/daemon.Tpo -c -o daemon.o daemon.cpp mv -f .deps/daemon.Tpo .deps/daemon.Po g++ -DHAVE_CONFIG_H -I. -Wall -I/usr/include/libxml2 -g -O2 -MT stats.o -MD -MP -MF .deps/stats.Tpo -c -o stats.o stats.cpp mv -f .deps/stats.Tpo .deps/stats.Po g++ -DHAVE_CONFIG_H -I. -Wall -I/usr/include/libxml2 -g -O2 -MT token.o -MD -MP -MF .deps/token.Tpo -c -o token.o token.cpp mv -f .deps/token.Tpo .deps/token.Po g++ -DHAVE_CONFIG_H -I. -Wall -I/usr/include/libxml2 -g -O2 -MT utility.o -MD -MP -MF .deps/utility.Tpo -c -o utility.o utility.cpp mv -f .deps/utility.Tpo .deps/utility.Po gcc -DHAVE_CONFIG_H -I. -Wall -I/usr/include/libxml2 -g -O2 -MT system.o -MD -MP -MF .deps/system.Tpo -c -o system.o system.c mv -f .deps/system.Tpo .deps/system.Po g++ -g -O2 -rdynamic -o istatd main.o conf.o argument.o switchboard.o socket.o socketset.o clientset.o isr.o daemon.o stats.o token.o utility.o system.o -ldl -L/usr/lib -lxml2 make[2]: Leaving directory `~/istat-0.5.3' make[1]: Leaving directory `~/istat-0.5.3'
# make install
Making install in resource
make[1]: Entering directory `/home/debian/istat-0.5.3/resource'
make[2]: Entering directory `/home/debian/istat-0.5.3/resource'
test -z "/etc" || /bin/mkdir -p "/etc"
/usr/bin/install -c -m 644 'istat.conf' '/etc/istat.conf'
test -z "/usr/share/man/man1" || /bin/mkdir -p "/usr/share/man/man1"
/usr/bin/install -c -m 644 'istatd.1' '/usr/share/man/man1/istatd.1'
test -z "/usr/share/man/man5" || /bin/mkdir -p "/usr/share/man/man5"
/usr/bin/install -c -m 644 'istat.conf.5' '/usr/share/man/man5/istat.conf.5'
make[2]: Leaving directory `/home/debian/istat-0.5.3/resource'
make[1]: Leaving directory `/home/debian/istat-0.5.3/resource'
make[1]: Entering directory `/home/debian/istat-0.5.3'
make[2]: Entering directory `/home/debian/istat-0.5.3'
test -z "/usr/bin" || /bin/mkdir -p "/usr/bin"
/usr/bin/install -c 'istatd' '/usr/bin/istatd'
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/debian/istat-0.5.3'
make[1]: Leaving directory `/home/debian/istat-0.5.3'
$ useradd istat -s /sbin/nologin $ mkdir -p /var/{cache,run}/istat $ chown istat /var/{cache,run}/istat
# /usr/bin/istatd -d
とりあえずこれでデーモンとして起動する。
Hey, thanks for this! Could you please tell me where I can find the security code needed when I connect to iStat via my iPhone?
you can find “istat.conf” then “server_code” via security code.
directory as /usr/local/etc/istat.conf