Typo
[linux_from_scratch_hints.git] / OLD / strace-4.2.txt
blob611a346b06d35f0cc047e9b0e92202cbf08e0a17
1 TITLE:          Installation of strace-4.2      
2 LFS VERSION:    any
3 AUTHOR:         Philipp Niemann <lfshints@azagtoth.de>
4  
5 SYNOPSIS:
6         Installing Strace on a LFS system with glibc-2.2.1 and gcc-2.95.3-test2 (might apply to other, too)
7  
8 HINT:      
9 Strace is a program useful for debugging or tutorial purposes.
10 You can trace systemcalls and signals of programs.
12 From the manpage:
14     In the simplest case strace runs the specified command until 
15         it exits.  It intercepts and records the system calls
16         which are called by a process and the signals which are 
17         received by a process. The name of each system call, 
18         its arguments and its return value are printed on standard 
19         error or to the file specified with the -o option.
21 So this is a useful program.
23 You can get the source from
24     
25         http://www.wi.leidenuniv.nl/~wichert/strace/strace-4.2.tar.gz
26         Homepage is: http://www.wi.leidenuniv.nl/~wichert/strace/
28 If you want to use that stuff you have to untar it first:
30     tar xzvf strace-4.2.tar.gz
32 Now for the compile-thingie:
33     cd strace-4.2.tar.gz
34     configure --prefix=/usr/local   
35         # One could add more --options but
36     # the Makefile doesn't honor that
37     make
38     make install
40 Not to much. But in my case there occured some errors. 
41 So I have made a patch to circumvent those pits. 
42 Here it comes:
44 --------------------------------------------------------
45 Snip just below the next line of dashes
46 --------------------------------------------------------
47 diff -Naur strace-4.2/file.c strace-4.2-done2/file.c
48 --- strace-4.2/file.c   Tue Jan 11 14:41:10 2000
49 +++ strace-4.2-done2/file.c Fri Jan 19 10:03:22 2001
50 @@ -34,9 +34,11 @@
52  #include <dirent.h>
53  #ifdef linux
54 -#define dirent kernel_dirent
55  #include <linux/types.h>
56 +#define dirent kernel_dirent
57 +#define dirent64 kernel_dirent64
58  #include <linux/dirent.h>
59 +#undef dirent64
60  #undef dirent
61  #else
62  #define kernel_dirent dirent
63 @@ -611,7 +613,7 @@
64     realprintstat(tcp, &statbuf);
65  }
67 -#ifdef STAT64
68 +#ifdef HAVE_STAT64
69  static void
70  printstat64(tcp, addr)
71  struct tcb *tcp;
72 diff -Naur strace-4.2/stream.c strace-4.2-done2/stream.c
73 --- strace-4.2/stream.c Thu Dec 23 14:20:15 1999
74 +++ strace-4.2-done2/stream.c   Fri Jan 19 10:06:29 2001
75 @@ -34,13 +34,16 @@
77  #if defined(linux)
78  #include <sys/poll.h>
79 +#include <stropts.h>
81 +#ifdef linux2
82  #define RS_HIPRI 1
83  struct strbuf {
84          int     maxlen;                 /* no. of bytes in buffer */
85          int     len;                    /* no. of bytes returned */
86          char    *buf;                   /* pointer to data */
87  };
88 +#endif /* linux2 */
89  #define MORECTL 1
90  #define MOREDATA 2
91 --------------------------------------------------------
92 End of patch. Snip just above previous line of dashes
93 --------------------------------------------------------
95 With that patch strace did compile on my machine. 
96 You would cut and paste the above patch to a new file
97 which I call patchfile for now. Then issue the following command 
98 in the directory where the tar-command was executed:
99     patch -p0 < patchfile
100 And you should get output about two files being patches.
102 Beware, I am not a programmer. So it is absolutly possible that 
103 this patch only 'works' to get rid of the compile-errors and on 
104 the other side breaks the logic of the program. Use caution.
106 PS: You can find this patch and the hint on
107 http://www.azagtoth.de/lfs.html also. 
108 As well as some other nonsense ;-)