2022年1月1日 星期六

安裝linux-fincore 1.3.0到Debian 8.8

在Linux上面要檢查某個檔案有冇被快取在記憶體上,可以用linux-fincore這個指令。但這指令沒有被APT給收錄,也找不到.deb包可以用dpkg安裝。下面介紹安裝過程

Step 1:下載source code,安裝編譯環境需要的套件

Google Code Archive的linux-ftools,找到source後下載。

wget https://storage.googleapis.com/google-code-archive-source/v2/code.google.com/linux-ftools/source-archive.zip
mv source-archive.zip linux-ftools-1.3.0.zip
md5sum linux-ftools-1.3.0.zip

這邊算出來的md5 checksum是 ae142ebe7c1448d20ec42756d64adf08


上面的版本1.3.0,是執行下面的指令查詢到的:

unzip /usr/src/linux-ftools/linux-ftools-1.3.0.zip
cd linux-ftools && ./configure -V
linux-ftools configure 1.3.0
generated by GNU Autoconf 2.67

Copyright (C) 2010 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.

另外順手把編譯環境需要的套件都裝起來

sudo apt-get install autoconf automake fakeroot debhelper
sudo apt install eclipse-cdt-autotools


Step 2:Configure過了,但是make會出現問題

./configure --prefix=/opt/linux-ftools/1.3.0
make 
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /tmp/ttng/linux-ftools/missing --run aclocal-1.11
/tmp/ttng/linux-ftools/missing: line 54: aclocal-1.11: command not found
WARNING: `aclocal-1.11' is missing on your system.  You should only need it if
         you modified `acinclude.m4' or `configure.ac'.  You might want
         to install the `Automake' and `Perl' packages.  Grab them from
         any GNU archive site.
 cd . && /bin/bash /tmp/ttng/linux-ftools/missing --run automake-1.11 --gnu
/tmp/ttng/linux-ftools/missing: line 54: automake-1.11: command not found
WARNING: `automake-1.11' is missing on your system.  You should only need it if
         you modified `Makefile.am', `acinclude.m4' or `configure.ac'.
         You might want to install the `Automake' and `Perl' packages.
         Grab them from any GNU archive site.
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /tmp/ttng/linux-ftools/missing --run autoconf
configure.ac:7: error: possibly undefined macro: AM_INIT_AUTOMAKE
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
Makefile:211: recipe for target 'configure' failed
make: *** [configure] Error 1

上述錯誤訊息的解決方式為修改config.status,從將原本在六百多行的

S["AUTOMAKE"]="${SHELL} /tmp/ttng/linux-ftools/missing --run automake-1.11"
...
S["ACLOCAL"]="${SHELL} /tmp/ttng/linux-ftools/missing --run aclocal-1.11"

改成系統上automake與aclocal的版本1.14

S["AUTOMAKE"]="${SHELL} /tmp/ttng/linux-ftools/missing --run automake-1.14"
...
S["ACLOCAL"]="${SHELL} /tmp/ttng/linux-ftools/missing --run aclocal-1.14"


Step 3:編譯完成,順手放到 /usr/local/bin/裏面

make
ldd linux-fincore 
linux-fincore:
    linux-vdso.so.1 (0x00007ffd0d176000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007efe0038a000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efdfffdf000)
    /lib64/ld-linux-x86-64.so.2 (0x000055bf29e45000)
sudo make install
cd /usr/local/bin/
sudo ln -s /opt/linux-ftools/1.3.0/bin/linux-fincore ./

linux-fincore -L filename 就可以知道檔案有冇快取在記憶體上了


參考資料

_EOF_

沒有留言:

張貼留言