Linux HOWTOs

About | Home | Search

HOWTO: strace
Description: Prints a trace of system calls made by a another process/program
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything

# strace 4.7
# ==========
# Slackware 12.0, 12.1, 12.2: strace 4.5.15
# Slackware 13.0, 13.1: strace 4.5.18
# Slackware 13.37: strace 4.5.20

# If you ever want to uninstall strace, or just clean up files from an
# old version before installing the new one, skip down to the bottom for
# instructions.

# Prerequisites:
# Perl (configure looks for it, not sure if strace needs it or not)

# FYI: I was not able to build this on an old Slackware 12.2-based machine
# with gcc 4.2.4, but no problem with a Slackware 13.37-based one with
# GCC 4.5.2  I did not dig in to the reason, I don't particularly need a
# newer strace on the older one ATM.

# Get it
test -f installed/strace-4.7.tar.xz &&
 mv installed/strace-4.7.tar.xz .
test ! -f strace-4.7.tar.xz &&

# Extract it
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "strace-*" -exec rm -r {} \;
tar xJvf ~/strace-4.7.tar.xz
cd strace-4.7
test $UID = 0 && chown -R root:root .

# Configure and build it
./configure --prefix=/usr --mandir=/usr/man

# Become root to install it

# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg strace

# Install it, stripping binaries
make install-strip

# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .

# Become yourself again

mkdir -p -m 0700 installed
rm -f installed/strace-*.tar.*
mv strace-4.7.tar.xz installed/

# If you ever want to uninstall strace, this should do it:
test -d src/strace-* && ( cd src/strace-* ; make uninstall )
( cd /usr/bin ; rm -f strace strace-graph strace-log-merge )
rm -f /usr/man/man1/strace.1
find ~/src -maxdepth 1 -type d -name "strace-*" -exec rm -r {} \;
rm -f ~/installed/strace-*.tar.*

Back to the list

Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>