源码下载地址:
strace - Browse /strace at SourceForge.net
当前选择 strace-4.5.16.tar.bz2
编译如下:
tar -xvf ../../strace-4.5.16.tar.bz2
cd strace-4.5.16
CC=mips-linux-gnu-gcc LDFLAGS="-static" ./configure --host=mips-linux
make
此时报错,
file.c:41:10: fatal error: linux/dirent.h: No such file or directory
#include <linux/dirent.h>
^~~~~~~~~~~~~~~~
compilation terminated.
查阅发现,交叉编译器没有linux/dirent.h 但是存在include/bits/dirent.h 与 include/dirent.h,这是个目录项相关的头文件,查阅pc主机的头文件也是这样,
先临时把file.c文件 37行的#ifdef LINUX 配置为 #if 0,走另一个分支。
然后make 编译出静态的strace,但是这种修改方式有点粗暴,我使用后看情况再来更新。