..

静态编译 strace

strace 是一个非常强大的工具,但是不是所有台服务都安装了这个命令,有时候受限制环境下需要用这个命令,所以我准备静态编译一个这个二进制文件,正好发现有人提了相关的 issue

git clone https://github.com/strace/strace
cd strace
./bootstrap
export LDFLAGS='-static -pthread'
./configure
make

Result:
% file strace
strace: ELF 64-bit LSB executable, x86-64, version 1 (GNU/linux), statically linked, BuildID[sha1]=d08a819c2abac4c8db9e6fcdcba8201cf1ba3406, for GNU/linux 3.2.0, with debug_info, not stripped