2012年4月11日水曜日

ttyrecをCentOS6.2 32bitでコンパイル

とある事情があって、CUIの操作を記録して、後に再生をしたいと思った。
ふと思い出した、ttyrecをCentOS6.2 32bitでコンパイルしたが、エラーになった。

こんな環境で
[root@localhost ‾]# rpm -qa centos-release
centos-release-6-2.el6.centos.7.i686

[root@localhost ttyrec-1.0.8]# make CFLAGS=-DSVR4
gcc -DSVR4   -c -o ttyrec.o ttyrec.c
ttyrec.c:60:21: error: stropts.h: No such file or directory
ttyrec.c: In function 'getslave':
ttyrec.c:453: error: 'I_PUSH' undeclared (first use in this function)
ttyrec.c:453: error: (Each undeclared identifier is reported only once
ttyrec.c:453: error: for each function it appears in.)
make: *** [ttyrec.o] Error 1

まぁ stropts.hがないだけなんだ。
[root@localhost ttyrec-1.0.8]# find / -name stropts.h

rpmを探す。
参考

[root@localhost ttyrec-1.0.8]# yum provides */stropts.h
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: rsync.atworks.co.jp
 * extras: rsync.atworks.co.jp
 * updates: rsync.atworks.co.jp
base                                                                                                           | 3.7 kB     00:00   
extras                                                                                                         | 3.5 kB     00:00   
updates                                                                                                        | 3.5 kB     00:00   
updates/primary_db                                                                                             | 2.3 MB     00:07   
updates/filelists_db                                                                                           | 1.8 MB     00:06   
1:compat-glibc-headers-2.5-46.2.i686 : Header files for development using standard C libraries.
Repo        : base
Matched from:
Filename    : /usr/lib/i686-redhat-linux5E/include/sys/stropts.h
Filename    : /usr/lib/i686-redhat-linux5E/include/bits/stropts.h
Filename    : /usr/lib/i686-redhat-linux5E/include/stropts.h



1:compat-glibc-headers-2.5-46.2.i686 : Header files for development using standard C libraries.
Repo        : installed
Matched from:
Filename    : /usr/lib/i686-redhat-linux5E/include/sys/stropts.h
Filename    : /usr/lib/i686-redhat-linux5E/include/bits/stropts.h
Filename    : /usr/lib/i686-redhat-linux5E/include/stropts.h

目的のrpmがわかったのでインストール
[root@localhost ttyrec-1.0.8]# yum install compat-glibc-headers-2.5-46.2.i686
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: rsync.atworks.co.jp
 * extras: rsync.atworks.co.jp
 * updates: rsync.atworks.co.jp
Setting up Install Process
Package 1:compat-glibc-headers-2.5-46.2.i686 already installed and latest version
Nothing to do
(一度インストールしてしまったので。)

[root@localhost ttyrec-1.0.8]# make clean
rm -f *.o ttyrec ttyplay ttytime ttyrecord *‾
[root@localhost ttyrec-1.0.8]#make CFLAGS="-DSVR4 -v -I/usr/lib/i686-redhat-linux5E/include"

ちなみに、64bit版では動かなかった。
使い方は
記録
[root@localhost ttyrec-1.0.8]# ./ttyrec test
再生
[root@localhost ttyrec-1.0.8]# ./ttyplay test


0 件のコメント: