K2.6 patches and update.
[tomato.git] / release / src / router / snmp / README.solaris
blobb318e9ca54c7faeb862ac74fd57b43448815d54b
1 README.solaris
3 The following is a brief explanation of how to compile net-snmp
4 to work successfully on Sun Solaris 2.6, 2.7, and 8 machines.  This
5 should also work for Solaris 9.
7 First off, you need to disable Sun's SNMP daemons.
9 cd /etc/rc3.d
10 ./S76snmpd stop
11 ./S88dmi stop
12 mv S76snmpd s76snmpd  (lowercase s disables the script)
13 mv S77dmi s77dmi
15 You will need to have installed the development libraries.  If
16 you have installed the FORTE C compiler, these are included.
17 They are also installed if you have done a "full" or "full plus OEM" install.
19 To confirm, type:
21 which ld
23 It should return
25 /usr/ccs/bin/ld
27 If they are not present, they can be installed from the distribution cd.  If this
28 is not available, you may want to try downloading the binutils from http://www.sunfreeware.com.
30 You will also need to install a working compiler if you aren't using Sun's.
31 Download gcc from http://www.sunfreeware.com.  Version 2.95.3 works well
32 but the 3.0 stream should work as well.
34 You will also need a proper "make", which can also be downloaded from http://www.sunfreeware.com.
35 It installs in /usr/local/bin.
37 Because of this, you need to modify your path so it includes at least the following directories
38 in this order
40 /usr/bin:/usr/sbin:/usr/local/bin:/usr/ccs/bin:/usr/ucb
42 Use the following configure calling sequence.
44 ./configure --with-mib-modules="host disman/event-mib ucd-snmp/diskio smux agentx mibII/mta_sendmail" 
46 If you wish to have perl functionality, see my long note below.
48 Then do the following:
50 make
51 make install
53 snmpconf -g basic_setup  (choose a community string besides "public")
55 /usr/local/sbin/snmpd
57 snmpwalk -v 2c -m ALL -t 100 -c community_string localhost .1.3
59 This should return pages of information about your system.
61 Eventually you will need to make a new startup script for snmpd in /etc/rc3.d.
63 Addition notes below are from a variety of sources concerning
64 various technical matters.
66 ------------------------------------------------------
68 Solaris has a limitation on the number of file descriptors (255)
69 available in stdio, so that fopen() fails if more than
70 255 file descriptors (sockets) are open. This prevents mibs from 
71 being loaded after 250 sockets are open, since parse.c uses stdio.
73 SEan <burke_sp@pacbell.net> investigated this problem, and had this
74 report on using the SFIO package to solve this problem.
76  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
78 The SFIO package ( http://www.research.att.com/sw/tools/sfio/ ) 
79 is a buffered streams IO package that is much more more sophisticated 
80 than stdio, but it does support stdio API's for backward compatibility,
81 and that's the aspect that is important here.
83 To compile with SFIO, we simply add -I/usr/local/sfio/include to the
84 $CPPFLAGS before compiling net-snmp. This causes SFIO's stdio.h to
85 preempt Solaris stdio, mapping calls like fopen() and fprintf() to
86 the SFIO implementations. This produces a libnetsnmp that does not
87 have the fopen() limitation. Any application that links to this 
88 libnetsnmp must also be linked to libsfio. 
90 Here are the two caveats:
92 1. libsfio exports the functions 'getc' and 'putc', for reasons that
93 are not clear. These are the only symbols it exports that conflict
94 with stdio. While getc and putc are traditionally macros, Solaris
95 makes them functions in multithreaded code (compiled with -mt,
96 -pthread, or -D_REENTRANT). If your native stdio code links to the
97 libsfio versions, a crash will result.
99 There are two solutions to this problem. You may remove getc and putc 
100 from libsfio, since SFIO defines getc and putc as macros, by doing:
102         ar d libsfio.a getc.o
103         ar d libsfio.a putc.o
105 or link to SFIO's stdio compatibility library, libstdio, ahead of
106 libsfio. This library wraps all of the native stdio calls with 
107 versions that are safe for native or sfio streams, in case you
108 need to share streams between SFIO and native stdio codes.
110 2. libsfio provides 64-bit offsets in fseek(), ftell(). This is
111 a good thing, since SFIO is intened to avoid needless limitations,
112 but it means that SFIO's stdio.h defines off_t to be a 64-bit offset. 
113 Net-SNMP uses readdir(), which returns a struct dirent containing 
114 a 32-bit off_t, so the code compiled for SFIO doesn't access 
115 struct dirent's correctly.
117 There are two solutions to this problem, as well. The first is to
118 include <dirent.h> at the start of SFIO's stdio.h. Since SFIO 
119 defines a macro substitution for off_t, this leaves struct dirent's 
120 definition unchanged.
122 An alternative, which I haven't verified, is to define _FILE_OFFSET_BITS
123 to be 64 when compiling libnetsnmp. According to what I see in Solaris's 
124 /usr/include/sys/feature_tests.h, you can select a 64-bit off_t at 
125 compile time with this setting, which should make readdir()'s off_t 
126 compatible with SFIO's ftell(), fseek().
127  [[ We have received reports that this approach does not in fact work ]]
129 Finally, thanks to Phong Vo and AT&T Labs for a fast, robust and
130 portable package that solves this headache very neatly.
132 -SEan <burke_sp@pacbell.net>
134 ------------------------------------------------------------
136 Solaris 8 ships with a version of PERL compiled using sun's cc.  
138 This causes a problem when attempting to compile net-snmp with the
139 new PERL functionality ie.
141 ./configure --with-mib-modules="host disman/event-mib ucd-snmp/diskio smux agentx mibII/mta_sendmail" --enable-shared --enable-embedded-perl
143 because during the PERL section of the compile, it attempts to do so using the methodology used to
144 compile the original PERL, not what you're currently using.  This can be discovered by typing
146 perl -V
148 and it says (among other things)
150   Compiler:
151     cc='cc'
153 and you don't have the full version of Sun's C compiler on your system, it's going to break.
155 If you have downloaded the PERL on www.sunfreeware.com, it is compiled with some extra flags
156 that cause the net-snmp compile to break.  Given that the PERL provided with Solaris 8 (5.005_03)
157 is rather stale, upgrading may be to your advantage.
159 Download the current stable release of PERL
161 http://www.cpan.org/src/stable.tar.gz and gunzip and untar.  
163 When doing the PERL ./Configure, accept most of the defaults, except
164 for the following:
166 Use which C compiler? [cc]  gcc
168 (it tends to default to cc even if not installed)
170 Any additional gcc flags? [-fno-strict-aliasing -I/usr/local/include]
172 (if there are any additional flags, especially relating to 64 offsets, remove these)
174 What command should be used to create dynamic libraries? [cc] gcc
176 Any special flags to pass to gcc to create a dynamically loaded library?
177 [-G -L/usr/local/lib]
179 (There shouldn't be anything extra here (see above))
181 Any special flags to pass to gcc to use dynamic linking? [none] 
183 (There shouldn't be anything extra here either (see above))
185 What is your domain name? [.foo.com] 
187 (it may guess wrong)
189 What pager is used on your system? [/bin/less] /usr/bin/more
191 (It wants less even if it's not installed)
193 It will prompt you for make depend, then do:
195 make
196 make test
197 make install
198 perl -V
200 if everything looks all right, do the net-snmp ./configure (don't forget to make clean if necessary)
202  -- Bruce Shaw <Bruce.Shaw@gov.ab.ca>
204 ------------------------------------------------------------
206 The version of sed in /usr/ucb on Solaris 2.5.1 and 2.6 can't
207 cope with the size of the subsitution strings used in config.status.
209 Putting /usr/bin ahead of /usr/ucb in the search path fixes this.
211 /usr/xpg4/bin/sed is seen to segfault under Solaris 8 when running configure.
212 Putting /usr/bin ahead of /usr/xpg4/bin fixes this.
213 Thanks to zach dot metzinger at removeme microtune dot com.