source: trunk/essentials/dev-lang/perl/README.solaris@ 3310

Last change on this file since 3310 was 3181, checked in by bird, 19 years ago

perl 5.8.8

File size: 28.4 KB
Line 
1If you read this file _as_is_, just ignore the funny characters you
2see. It is written in the POD format (see pod/perlpod.pod) which is
3specifically designed to be readable as is.
4
5=head1 NAME
6
7README.solaris - Perl version 5 on Solaris systems
8
9=head1 DESCRIPTION
10
11This document describes various features of Sun's Solaris operating system
12that will affect how Perl version 5 (hereafter just perl) is
13compiled and/or runs. Some issues relating to the older SunOS 4.x are
14also discussed, though they may be out of date.
15
16For the most part, everything should just work.
17
18Starting with Solaris 8, perl5.00503 (or higher) is supplied with the
19operating system, so you might not even need to build a newer version
20of perl at all. The Sun-supplied version is installed in /usr/perl5
21with /usr/bin/perl pointing to /usr/perl5/bin/perl. Do not disturb
22that installation unless you really know what you are doing. If you
23remove the perl supplied with the OS, you will render some bits of
24your system inoperable. If you wish to install a newer version of perl,
25install it under a different prefix from /usr/perl5. Common prefixes
26to use are /usr/local and /opt/perl.
27
28You may wish to put your version of perl in the PATH of all users by
29changing the link /usr/bin/perl. This is probably OK, as most perl
30scripts shipped with Solaris use an explicit path. (There are a few
31exceptions, such as /usr/bin/rpm2cpio and /etc/rcm/scripts/README, but
32these are also sufficiently generic that the actual version of perl
33probably doesn't matter too much.)
34
35Solaris ships with a range of Solaris-specific modules. If you choose
36to install your own version of perl you will find the source of many of
37these modules is available on CPAN under the Sun::Solaris:: namespace.
38
39Solaris may include two versions of perl, e.g. Solaris 9 includes
40both 5.005_03 and 5.6.1. This is to provide stability across Solaris
41releases, in cases where a later perl version has incompatibilities
42with the version included in the preceeding Solaris release. The
43default perl version will always be the most recent, and in general
44the old version will only be retained for one Solaris release. Note
45also that the default perl will NOT be configured to search for modules
46in the older version, again due to compatibility/stability concerns.
47As a consequence if you upgrade Solaris, you will have to
48rebuild/reinstall any additional CPAN modules that you installed for
49the previous Solaris version. See the CPAN manpage under 'autobundle'
50for a quick way of doing this.
51
52As an interim measure, you may either change the #! line of your
53scripts to specifically refer to the old perl version, e.g. on
54Solaris 9 use #!/usr/perl5/5.00503/bin/perl to use the perl version
55that was the default for Solaris 8, or if you have a large number of
56scripts it may be more convenient to make the old version of perl the
57default on your system. You can do this by changing the appropriate
58symlinks under /usr/perl5 as follows (example for Solaris 9):
59
60 # cd /usr/perl5
61 # rm bin man pod
62 # ln -s ./5.00503/bin
63 # ln -s ./5.00503/man
64 # ln -s ./5.00503/lib/pod
65 # rm /usr/bin/perl
66 # ln -s ../perl5/5.00503/bin/perl /usr/bin/perl
67
68In both cases this should only be considered to be a temporary
69measure - you should upgrade to the later version of perl as soon as
70is practicable.
71
72Note also that the perl command-line utilities (e.g. perldoc) and any
73that are added by modules that you install will be under
74/usr/perl5/bin, so that directory should be added to your PATH.
75
76=head2 Solaris Version Numbers.
77
78For consistency with common usage, perl's Configure script performs
79some minor manipulations on the operating system name and version
80number as reported by uname. Here's a partial translation table:
81
82 Sun: perl's Configure:
83 uname uname -r Name osname osvers
84 SunOS 4.1.3 Solaris 1.1 sunos 4.1.3
85 SunOS 5.6 Solaris 2.6 solaris 2.6
86 SunOS 5.8 Solaris 8 solaris 2.8
87 SunOS 5.9 Solaris 9 solaris 2.9
88 SunOS 5.10 Solaris 10 solaris 2.10
89
90The complete table can be found in the Sun Managers' FAQ
91L<ftp://ftp.cs.toronto.edu/pub/jdd/sunmanagers/faq> under
92"9.1) Which Sun models run which versions of SunOS?".
93
94=head1 RESOURCES
95
96There are many, many sources for Solaris information. A few of the
97important ones for perl:
98
99=over 4
100
101=item Solaris FAQ
102
103The Solaris FAQ is available at
104L<http://www.science.uva.nl/pub/solaris/solaris2.html>.
105
106The Sun Managers' FAQ is available at
107L<ftp://ftp.cs.toronto.edu/pub/jdd/sunmanagers/faq>
108
109=item Precompiled Binaries
110
111Precompiled binaries, links to many sites, and much, much more are
112available at L<http://www.sunfreeware.com/> and
113L<http://www.blastwave.org/>.
114
115=item Solaris Documentation
116
117All Solaris documentation is available on-line at L<http://docs.sun.com/>.
118
119=back
120
121=head1 SETTING UP
122
123=head2 File Extraction Problems on Solaris.
124
125Be sure to use a tar program compiled under Solaris (not SunOS 4.x)
126to extract the perl-5.x.x.tar.gz file. Do not use GNU tar compiled
127for SunOS4 on Solaris. (GNU tar compiled for Solaris should be fine.)
128When you run SunOS4 binaries on Solaris, the run-time system magically
129alters pathnames matching m#lib/locale# so that when tar tries to create
130lib/locale.pm, a file named lib/oldlocale.pm gets created instead.
131If you found this advice too late and used a SunOS4-compiled tar
132anyway, you must find the incorrectly renamed file and move it back
133to lib/locale.pm.
134
135=head2 Compiler and Related Tools on Solaris.
136
137You must use an ANSI C compiler to build perl. Perl can be compiled
138with either Sun's add-on C compiler or with gcc. The C compiler that
139shipped with SunOS4 will not do.
140
141=head3 Include /usr/ccs/bin/ in your PATH.
142
143Several tools needed to build perl are located in /usr/ccs/bin/: ar,
144as, ld, and make. Make sure that /usr/ccs/bin/ is in your PATH.
145
146You need to make sure the following packages are installed
147(this info is extracted from the Solaris FAQ):
148
149for tools (sccs, lex, yacc, make, nm, truss, ld, as): SUNWbtool,
150SUNWsprot, SUNWtoo
151
152for libraries & headers: SUNWhea, SUNWarc, SUNWlibm, SUNWlibms, SUNWdfbh,
153SUNWcg6h, SUNWxwinc, SUNWolinc
154
155for 64 bit development: SUNWarcx, SUNWbtoox, SUNWdplx, SUNWscpux,
156SUNWsprox, SUNWtoox, SUNWlmsx, SUNWlmx, SUNWlibCx
157
158If you are in doubt which package contains a file you are missing,
159try to find an installation that has that file. Then do a
160
161 $ grep /my/missing/file /var/sadm/install/contents
162
163This will display a line like this:
164
165/usr/include/sys/errno.h f none 0644 root bin 7471 37605 956241356 SUNWhea
166
167The last item listed (SUNWhea in this example) is the package you need.
168
169=head3 Avoid /usr/ucb/cc.
170
171You don't need to have /usr/ucb/ in your PATH to build perl. If you
172want /usr/ucb/ in your PATH anyway, make sure that /usr/ucb/ is NOT
173in your PATH before the directory containing the right C compiler.
174
175=head3 Sun's C Compiler
176
177If you use Sun's C compiler, make sure the correct directory
178(usually /opt/SUNWspro/bin/) is in your PATH (before /usr/ucb/).
179
180=head3 GCC
181
182If you use gcc, make sure your installation is recent and complete.
183perl versions since 5.6.0 build fine with gcc > 2.8.1 on Solaris >=
1842.6.
185
186You must Configure perl with
187
188 $ sh Configure -Dcc=gcc
189
190If you don't, you may experience strange build errors.
191
192If you have updated your Solaris version, you may also have to update
193your gcc. For example, if you are running Solaris 2.6 and your gcc is
194installed under /usr/local, check in /usr/local/lib/gcc-lib and make
195sure you have the appropriate directory, sparc-sun-solaris2.6/ or
196i386-pc-solaris2.6/. If gcc's directory is for a different version of
197Solaris than you are running, then you will need to rebuild gcc for
198your new version of Solaris.
199
200You can get a precompiled version of gcc from
201L<http://www.sunfreeware.com/> or L<http://www.blastwave.org/>. Make
202sure you pick up the package for your Solaris release.
203
204If you wish to use gcc to build add-on modules for use with the perl
205shipped with Solaris, you should use the Solaris::PerlGcc module
206which is available from CPAN. The perl shipped with Solaris
207is configured and built with the Sun compilers, and the compiler
208configuration information stored in Config.pm is therefore only
209relevant to the Sun compilers. The Solaris:PerlGcc module contains a
210replacement Config.pm that is correct for gcc - see the module for
211details.
212
213=head3 GNU as and GNU ld
214
215The following information applies to gcc version 2. Volunteers to
216update it as appropropriate for gcc version 3 would be appreciated.
217
218The versions of as and ld supplied with Solaris work fine for building
219perl. There is normally no need to install the GNU versions to
220compile perl.
221
222If you decide to ignore this advice and use the GNU versions anyway,
223then be sure that they are relatively recent. Versions newer than 2.7
224are apparently new enough. Older versions may have trouble with
225dynamic loading.
226
227If you wish to use GNU ld, then you need to pass it the -Wl,-E flag.
228The hints/solaris_2.sh file tries to do this automatically by setting
229the following Configure variables:
230
231 ccdlflags="$ccdlflags -Wl,-E"
232 lddlflags="$lddlflags -Wl,-E -G"
233
234However, over the years, changes in gcc, GNU ld, and Solaris ld have made
235it difficult to automatically detect which ld ultimately gets called.
236You may have to manually edit config.sh and add the -Wl,-E flags
237yourself, or else run Configure interactively and add the flags at the
238appropriate prompts.
239
240If your gcc is configured to use GNU as and ld but you want to use the
241Solaris ones instead to build perl, then you'll need to add
242-B/usr/ccs/bin/ to the gcc command line. One convenient way to do
243that is with
244
245 $ sh Configure -Dcc='gcc -B/usr/ccs/bin/'
246
247Note that the trailing slash is required. This will result in some
248harmless warnings as Configure is run:
249
250 gcc: file path prefix `/usr/ccs/bin/' never used
251
252These messages may safely be ignored.
253(Note that for a SunOS4 system, you must use -B/bin/ instead.)
254
255Alternatively, you can use the GCC_EXEC_PREFIX environment variable to
256ensure that Sun's as and ld are used. Consult your gcc documentation
257for further information on the -B option and the GCC_EXEC_PREFIX variable.
258
259=head3 Sun and GNU make
260
261The make under /usr/ccs/bin works fine for building perl. If you
262have the Sun C compilers, you will also have a parallel version of
263make (dmake). This works fine to build perl, but can sometimes cause
264problems when running 'make test' due to underspecified dependencies
265between the different test harness files. The same problem can also
266affect the building of some add-on modules, so in those cases either
267specify '-m serial' on the dmake command line, or use
268/usr/ccs/bin/make instead. If you wish to use GNU make, be sure that
269the set-group-id bit is not set. If it is, then arrange your PATH so
270that /usr/ccs/bin/make is before GNU make or else have the system
271administrator disable the set-group-id bit on GNU make.
272
273=head3 Avoid libucb.
274
275Solaris provides some BSD-compatibility functions in /usr/ucblib/libucb.a.
276Perl will not build and run correctly if linked against -lucb since it
277contains routines that are incompatible with the standard Solaris libc.
278Normally this is not a problem since the solaris hints file prevents
279Configure from even looking in /usr/ucblib for libraries, and also
280explicitly omits -lucb.
281
282=head2 Environment for Compiling perl on Solaris
283
284=head3 PATH
285
286Make sure your PATH includes the compiler (/opt/SUNWspro/bin/ if you're
287using Sun's compiler) as well as /usr/ccs/bin/ to pick up the other
288development tools (such as make, ar, as, and ld). Make sure your path
289either doesn't include /usr/ucb or that it includes it after the
290compiler and compiler tools and other standard Solaris directories.
291You definitely don't want /usr/ucb/cc.
292
293=head3 LD_LIBRARY_PATH
294
295If you have the LD_LIBRARY_PATH environment variable set, be sure that
296it does NOT include /lib or /usr/lib. If you will be building
297extensions that call third-party shared libraries (e.g. Berkeley DB)
298then make sure that your LD_LIBRARY_PATH environment variable includes
299the directory with that library (e.g. /usr/local/lib).
300
301If you get an error message
302
303 dlopen: stub interception failed
304
305it is probably because your LD_LIBRARY_PATH environment variable
306includes a directory which is a symlink to /usr/lib (such as /lib).
307The reason this causes a problem is quite subtle. The file
308libdl.so.1.0 actually *only* contains functions which generate 'stub
309interception failed' errors! The runtime linker intercepts links to
310"/usr/lib/libdl.so.1.0" and links in internal implementations of those
311functions instead. [Thanks to Tim Bunce for this explanation.]
312
313=head1 RUN CONFIGURE.
314
315See the INSTALL file for general information regarding Configure.
316Only Solaris-specific issues are discussed here. Usually, the
317defaults should be fine.
318
319=head2 64-bit perl on Solaris.
320
321See the INSTALL file for general information regarding 64-bit compiles.
322In general, the defaults should be fine for most people.
323
324By default, perl-5.6.0 (or later) is compiled as a 32-bit application
325with largefile and long-long support.
326
327=head3 General 32-bit vs. 64-bit issues.
328
329Solaris 7 and above will run in either 32 bit or 64 bit mode on SPARC
330CPUs, via a reboot. You can build 64 bit apps whilst running 32 bit
331mode and vice-versa. 32 bit apps will run under Solaris running in
332either 32 or 64 bit mode. 64 bit apps require Solaris to be running
33364 bit mode.
334
335Existing 32 bit apps are properly known as LP32, i.e. Longs and
336Pointers are 32 bit. 64-bit apps are more properly known as LP64.
337The discriminating feature of a LP64 bit app is its ability to utilise a
33864-bit address space. It is perfectly possible to have a LP32 bit app
339that supports both 64-bit integers (long long) and largefiles (> 2GB),
340and this is the default for perl-5.6.0.
341
342For a more complete explanation of 64-bit issues, see the
343"Solaris 64-bit Developer's Guide" at L<http://docs.sun.com/>
344
345You can detect the OS mode using "isainfo -v", e.g.
346
347 $ isainfo -v # Ultra 30 in 64 bit mode
348 64-bit sparcv9 applications
349 32-bit sparc applications
350
351By default, perl will be compiled as a 32-bit application. Unless
352you want to allocate more than ~ 4GB of memory inside perl, or unless
353you need more than 255 open file descriptors, you probably don't need
354perl to be a 64-bit app.
355
356=head3 Large File Support
357
358For Solaris 2.6 and onwards, there are two different ways for 32-bit
359applications to manipulate large files (files whose size is > 2GByte).
360(A 64-bit application automatically has largefile support built in
361by default.)
362
363First is the "transitional compilation environment", described in
364lfcompile64(5). According to the man page,
365
366 The transitional compilation environment exports all the
367 explicit 64-bit functions (xxx64()) and types in addition to
368 all the regular functions (xxx()) and types. Both xxx() and
369 xxx64() functions are available to the program source. A
370 32-bit application must use the xxx64() functions in order
371 to access large files. See the lf64(5) manual page for a
372 complete listing of the 64-bit transitional interfaces.
373
374The transitional compilation environment is obtained with the
375following compiler and linker flags:
376
377 getconf LFS64_CFLAGS -D_LARGEFILE64_SOURCE
378 getconf LFS64_LDFLAG # nothing special needed
379 getconf LFS64_LIBS # nothing special needed
380
381Second is the "large file compilation environment", described in
382lfcompile(5). According to the man page,
383
384 Each interface named xxx() that needs to access 64-bit entities
385 to access large files maps to a xxx64() call in the
386 resulting binary. All relevant data types are defined to be
387 of correct size (for example, off_t has a typedef definition
388 for a 64-bit entity).
389
390 An application compiled in this environment is able to use
391 the xxx() source interfaces to access both large and small
392 files, rather than having to explicitly utilize the transitional
393 xxx64() interface calls to access large files.
394
395Two exceptions are fseek() and ftell(). 32-bit applications should
396use fseeko(3C) and ftello(3C). These will get automatically mapped
397to fseeko64() and ftello64().
398
399The large file compilation environment is obtained with
400
401 getconf LFS_CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
402 getconf LFS_LDFLAGS # nothing special needed
403 getconf LFS_LIBS # nothing special needed
404
405By default, perl uses the large file compilation environment and
406relies on Solaris to do the underlying mapping of interfaces.
407
408=head3 Building an LP64 perl
409
410To compile a 64-bit application on an UltraSparc with a recent Sun Compiler,
411you need to use the flag "-xarch=v9". getconf(1) will tell you this, e.g.
412
413 $ getconf -a | grep v9
414 XBS5_LP64_OFF64_CFLAGS: -xarch=v9
415 XBS5_LP64_OFF64_LDFLAGS: -xarch=v9
416 XBS5_LP64_OFF64_LINTFLAGS: -xarch=v9
417 XBS5_LPBIG_OFFBIG_CFLAGS: -xarch=v9
418 XBS5_LPBIG_OFFBIG_LDFLAGS: -xarch=v9
419 XBS5_LPBIG_OFFBIG_LINTFLAGS: -xarch=v9
420 _XBS5_LP64_OFF64_CFLAGS: -xarch=v9
421 _XBS5_LP64_OFF64_LDFLAGS: -xarch=v9
422 _XBS5_LP64_OFF64_LINTFLAGS: -xarch=v9
423 _XBS5_LPBIG_OFFBIG_CFLAGS: -xarch=v9
424 _XBS5_LPBIG_OFFBIG_LDFLAGS: -xarch=v9
425 _XBS5_LPBIG_OFFBIG_LINTFLAGS: -xarch=v9
426
427This flag is supported in Sun WorkShop Compilers 5.0 and onwards
428(now marketed under the name Forte) when used on Solaris 7 or later on
429UltraSparc systems.
430
431If you are using gcc, you would need to use -mcpu=v9 -m64 instead. This
432option is not yet supported as of gcc 2.95.2; from install/SPECIFIC
433in that release:
434
435 GCC version 2.95 is not able to compile code correctly for sparc64
436 targets. Users of the Linux kernel, at least, can use the sparc32
437 program to start up a new shell invocation with an environment that
438 causes configure to recognize (via uname -a) the system as sparc-*-*