This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Some docs for the assertions.
[perl5.git] / README.solaris
CommitLineData
d420ca49
AD
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
2a5ccb22
LC
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, there is a good chance you will
24render some bits of your system inoperable. If you wish to install a
25newer version of perl, install it under a different prefix from
26/usr/perl5. Common prefixes to use are /usr/local and /opt/perl.
27
28You may wish to put your version of perl in the PATH of all users by
b29a8fb9 29changing the link /usr/bin/perl. This is OK, as all Perl scripts
2a5ccb22 30shipped with Solaris use /usr/perl5/bin/perl.
d420ca49
AD
31
32=head2 Solaris Version Numbers.
33
34For consistency with common usage, perl's Configure script performs
35some minor manipulations on the operating system name and version
36number as reported by uname. Here's a partial translation table:
37
38 Sun: perl's Configure:
39 uname uname -r Name osname osvers
2a5ccb22 40 SunOS 4.1.3 Solaris 1.1 sunos 4.1.3
d420ca49
AD
41 SunOS 5.6 Solaris 2.6 solaris 2.6
42 SunOS 5.8 Solaris 8 solaris 2.8
43
2a5ccb22 44The complete table can be found in the Sun Managers' FAQ
37a78d01 45L<ftp://ftp.cs.toronto.edu/pub/jdd/sunmanagers/faq> under
2a5ccb22
LC
46"9.1) Which Sun models run which versions of SunOS?".
47
d420ca49
AD
48=head1 RESOURCES
49
5511f325 50There are many, many sources for Solaris information. A few of the
d420ca49
AD
51important ones for perl:
52
53=over 4
54
55=item Solaris FAQ
56
57The Solaris FAQ is available at
58L<http://www.science.uva.nl/pub/solaris/solaris2.html>.
59
2a5ccb22 60The Sun Managers' FAQ is available at
37a78d01 61L<ftp://ftp.cs.toronto.edu/pub/jdd/sunmanagers/faq>
2a5ccb22 62
d420ca49
AD
63=item Precompiled Binaries
64
65Precompiled binaries, links to many sites, and much, much more is
5511f325 66available at L<http://www.sunfreeware.com/>.
d420ca49
AD
67
68=item Solaris Documentation
69
5511f325 70All Solaris documentation is available on-line at L<http://docs.sun.com/>.
d420ca49
AD
71
72=back
73
74=head1 SETTING UP
75
a83b6f46 76=head2 File Extraction Problems on Solaris.
d420ca49
AD
77
78Be sure to use a tar program compiled under Solaris (not SunOS 4.x)
79to extract the perl-5.x.x.tar.gz file. Do not use GNU tar compiled
80for SunOS4 on Solaris. (GNU tar compiled for Solaris should be fine.)
81When you run SunOS4 binaries on Solaris, the run-time system magically
82alters pathnames matching m#lib/locale# so that when tar tries to create
83lib/locale.pm, a file named lib/oldlocale.pm gets created instead.
5511f325 84If you found this advice too late and used a SunOS4-compiled tar
2a5ccb22
LC
85anyway, you must find the incorrectly renamed file and move it back
86to lib/locale.pm.
d420ca49 87
a83b6f46 88=head2 Compiler and Related Tools on Solaris.
d420ca49
AD
89
90You must use an ANSI C compiler to build perl. Perl can be compiled
91with either Sun's add-on C compiler or with gcc. The C compiler that
92shipped with SunOS4 will not do.
93
94=head3 Include /usr/ccs/bin/ in your PATH.
95
96Several tools needed to build perl are located in /usr/ccs/bin/: ar,
97as, ld, and make. Make sure that /usr/ccs/bin/ is in your PATH.
98
99You need to make sure the following packages are installed
100(this info is extracted from the Solaris FAQ):
101
102for tools (sccs, lex, yacc, make, nm, truss, ld, as): SUNWbtool,
103SUNWsprot, SUNWtoo
104
105for libraries & headers: SUNWhea, SUNWarc, SUNWlibm, SUNWlibms, SUNWdfbh,
106SUNWcg6h, SUNWxwinc, SUNWolinc
107
108for 64 bit development: SUNWarcx, SUNWbtoox, SUNWdplx, SUNWscpux,
109SUNWsprox, SUNWtoox, SUNWlmsx, SUNWlmx, SUNWlibCx
110
2a5ccb22
LC
111If you are in doubt which package contains a file you are missing,
112try to find an installation that has that file. Then do a
113
114 grep /my/missing/file /var/sadm/install/contents
115
116This will display a line like this:
117
118/usr/include/sys/errno.h f none 0644 root bin 7471 37605 956241356 SUNWhea
119
b29a8fb9 120The last item listed (SUNWhea in this example) is the package you need.
2a5ccb22 121
d420ca49
AD
122=head3 Avoid /usr/ucb/cc.
123
124You don't need to have /usr/ucb/ in your PATH to build perl. If you
2a5ccb22
LC
125want /usr/ucb/ in your PATH anyway, make sure that /usr/ucb/ is NOT
126in your PATH before the directory containing the right C compiler.
d420ca49
AD
127
128=head3 Sun's C Compiler
129
130If you use Sun's C compiler, make sure the correct directory
2a5ccb22 131(usually /opt/SUNWspro/bin/) is in your PATH (before /usr/ucb/).
d420ca49
AD
132
133=head3 GCC
134
9a04b58a
RS
135If you use gcc, make sure your installation is recent and complete.
136Perl versions since 5.6.0 build fine with gcc > 2.8.1 on Solaris >=
1372.6.
138
139You must Configure perl with
d420ca49
AD
140
141 sh Configure -Dcc=gcc
142
9a04b58a
RS
143If you don't, you may experience strange build errors.
144
d420ca49 145If you have updated your Solaris version, you may also have to update
9a04b58a 146your gcc. For example, if you are running Solaris 2.6 and your gcc is
d420ca49 147installed under /usr/local, check in /usr/local/lib/gcc-lib and make
2a5ccb22
LC
148sure you have the appropriate directory, sparc-sun-solaris2.6/ or
149i386-pc-solaris2.6/. If gcc's directory is for a different version of
150Solaris than you are running, then you will need to rebuild gcc for
151your new version of Solaris.
d420ca49
AD
152
153You can get a precompiled version of gcc from
2a5ccb22
LC
154L<http://www.sunfreeware.com/>. Make sure you pick up the package for
155your Solaris release.
d420ca49
AD
156
157=head3 GNU as and GNU ld
158
74144837
AD
159The following information applies to gcc version 2. Volunteers to
160update it as appropropriate for gcc version 3 would be appreciated.
161
d420ca49 162The versions of as and ld supplied with Solaris work fine for building
74144837
AD
163perl. There is normally no need to install the GNU versions to
164compile perl.
d420ca49
AD
165
166If you decide to ignore this advice and use the GNU versions anyway,
167then be sure that they are relatively recent. Versions newer than 2.7
168are apparently new enough. Older versions may have trouble with
169dynamic loading.
170
74144837
AD
171If you wish to use GNU ld, then you need to pass it the -Wl,-E flag.
172The hints/solaris_2.sh file tries to do this automatically by executing
173the following commands:
174
175 ccdlflags="$ccdlflags -Wl,-E"
176 lddlflags="$lddlflags -Wl,-E -G"
177
178However, over the years, changes in gcc, GNU ld, and Solaris ld have made
179it difficult to automatically detect which ld ultimately gets called.
180You may have to manually edit config.sh and add the -Wl,-E flags
181yourself, or else run Configure interactively and add the flags at the
182appropriate prompts.
183
d420ca49
AD
184If your gcc is configured to use GNU as and ld but you want to use the
185Solaris ones instead to build perl, then you'll need to add
186-B/usr/ccs/bin/ to the gcc command line. One convenient way to do
187that is with
188
189 sh Configure -Dcc='gcc -B/usr/ccs/bin/'
190
191Note that the trailing slash is required. This will result in some
2a5ccb22 192harmless warnings as Configure is run:
d420ca49
AD
193
194 gcc: file path prefix `/usr/ccs/bin/' never used
195
196These messages may safely be ignored.
197(Note that for a SunOS4 system, you must use -B/bin/ instead.)
198
199Alternatively, you can use the GCC_EXEC_PREFIX environment variable to
200ensure that Sun's as and ld are used. Consult your gcc documentation
201for further information on the -B option and the GCC_EXEC_PREFIX variable.
202
203=head3 GNU make
204
205Sun's make works fine for building perl.
206If you wish to use GNU make anyway, be sure that the set-group-id bit is not
207set. If it is, then arrange your PATH so that /usr/ccs/bin/make is
208before GNU make or else have the system administrator disable the
209set-group-id bit on GNU make.
210
211=head3 Avoid libucb.
212
213Solaris provides some BSD-compatibility functions in /usr/ucblib/libucb.a.
214Perl will not build and run correctly if linked against -lucb since it
215contains routines that are incompatible with the standard Solaris libc.
216Normally this is not a problem since the solaris hints file prevents
217Configure from even looking in /usr/ucblib for libraries, and also
218explicitly omits -lucb.
219
a83b6f46 220=head2 Environment for Compiling Perl on Solaris
d420ca49
AD
221
222=head3 PATH
223
224Make sure your PATH includes the compiler (/opt/SUNWspro/bin/ if you're
225using Sun's compiler) as well as /usr/ccs/bin/ to pick up the other
226development tools (such as make, ar, as, and ld). Make sure your path
227either doesn't include /usr/ucb or that it includes it after the
228compiler and compiler tools and other standard Solaris directories.
229You definitely don't want /usr/ucb/cc.
230
231=head3 LD_LIBRARY_PATH
232
233If you have the LD_LIBRARY_PATH environment variable set, be sure that
234it does NOT include /lib or /usr/lib. If you will be building
235extensions that call third-party shared libraries (e.g. Berkeley DB)
236then make sure that your LD_LIBRARY_PATH environment variable includes
237the directory with that library (e.g. /usr/local/lib).
238
239If you get an error message
240
241 dlopen: stub interception failed
242
243it is probably because your LD_LIBRARY_PATH environment variable
244includes a directory which is a symlink to /usr/lib (such as /lib).
245The reason this causes a problem is quite subtle. The file
246libdl.so.1.0 actually *only* contains functions which generate 'stub
247interception failed' errors! The runtime linker intercepts links to
248"/usr/lib/libdl.so.1.0" and links in internal implementations of those
249functions instead. [Thanks to Tim Bunce for this explanation.]
250
251=head1 RUN CONFIGURE.
252
253See the INSTALL file for general information regarding Configure.
254Only Solaris-specific issues are discussed here. Usually, the
255defaults should be fine.
256
a83b6f46 257=head2 64-bit Issues with Perl on Solaris.
d420ca49
AD
258
259See the INSTALL file for general information regarding 64-bit compiles.
260In general, the defaults should be fine for most people.
261
262By default, perl-5.6.0 (or later) is compiled as a 32-bit application
263with largefile and long-long support.
264
265=head3 General 32-bit vs. 64-bit issues.
266
2a5ccb22
LC
267Solaris 7 and above will run in either 32 bit or 64 bit mode on SPARC
268CPUs, via a reboot. You can build 64 bit apps whilst running 32 bit
269mode and vice-versa. 32 bit apps will run under Solaris running in
270either 32 or 64 bit mode. 64 bit apps require Solaris to be running
b29a8fb9 27164 bit mode.
d420ca49
AD
272
273Existing 32 bit apps are properly known as LP32, i.e. Longs and
274Pointers are 32 bit. 64-bit apps are more properly known as LP64.
275The discriminating feature of a LP64 bit app is its ability to utilise a
27664-bit address space. It is perfectly possible to have a LP32 bit app
2a5ccb22 277that supports both 64-bit integers (long long) and largefiles (> 2GB),
d420ca49
AD
278and this is the default for perl-5.6.0.
279
280For a more complete explanation of 64-bit issues, see the Solaris 64-bit
5511f325 281Developer's Guide at L<http://docs.sun.com:80/ab2/coll.45.13/SOL64TRANS/>
d420ca49
AD
282
283You can detect the OS mode using "isainfo -v", e.g.
284
285 fubar$ isainfo -v # Ultra 30 in 64 bit mode
286 64-bit sparcv9 applications
287 32-bit sparc applications
288
289By default, perl will be compiled as a 32-bit application. Unless you
2a5ccb22 290want to allocate more than ~ 4GB of memory inside Perl, you probably
d420ca49
AD
291don't need Perl to be a 64-bit app.
292
5511f325 293=head3 Large File Support
d420ca49
AD
294
295For Solaris 2.6 and onwards, there are two different ways for 32-bit
2a5ccb22 296applications to manipulate large files (files whose size is > 2GByte).
d420ca49
AD
297(A 64-bit application automatically has largefile support built in
298by default.)
299
300First is the "transitional compilation environment", described in
301lfcompile64(5). According to the man page,
302
303 The transitional compilation environment exports all the
304 explicit 64-bit functions (xxx64()) and types in addition to
305 all the regular functions (xxx()) and types. Both xxx() and
306 xxx64() functions are available to the program source. A
307 32-bit application must use the xxx64() functions in order
308 to access large files. See the lf64(5) manual page for a
309 complete listing of the 64-bit transitional interfaces.
310
311The transitional compilation environment is obtained with the
312following compiler and linker flags:
313
314 getconf LFS64_CFLAGS -D_LARGEFILE64_SOURCE
315 getconf LFS64_LDFLAG # nothing special needed
316 getconf LFS64_LIBS # nothing special needed
317
318Second is the "large file compilation environment", described in
319lfcompile(5). According to the man page,
320
321 Each interface named xxx() that needs to access 64-bit entities
322 to access large files maps to a xxx64() call in the
323 resulting binary. All relevant data types are defined to be
324 of correct size (for example, off_t has a typedef definition
325 for a 64-bit entity).
326
327 An application compiled in this environment is able to use
328 the xxx() source interfaces to access both large and small
329 files, rather than having to explicitly utilize the transitional
330 xxx64() interface calls to access large files.
331
332Two exceptions are fseek() and ftell(). 32-bit applications should
333use fseeko(3C) and ftello(3C). These will get automatically mapped
334to fseeko64() and ftello64().
335
336The large file compilation environment is obtained with
337
338 getconf LFS_CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
339 getconf LFS_LDFLAGS # nothing special needed
340 getconf LFS_LIBS # nothing special needed
341
342By default, perl uses the large file compilation environment and
343relies on Solaris to do the underlying mapping of interfaces.
344
345=head3 Building an LP64 Perl
346
b29a8fb9
JH
347To compile a 64-bit application on an UltraSparc with a recent Sun Compiler,
348you need to use the flag "-xarch=v9". getconf(1) will tell you this, e.g.
d420ca49
AD
349
350 fubar$ getconf -a | grep v9
351 XBS5_LP64_OFF64_CFLAGS: -xarch=v9
352 XBS5_LP64_OFF64_LDFLAGS: -xarch=v9
353 XBS5_LP64_OFF64_LINTFLAGS: -xarch=v9
354 XBS5_LPBIG_OFFBIG_CFLAGS: -xarch=v9
355 XBS5_LPBIG_OFFBIG_LDFLAGS: -xarch=v9
356 XBS5_LPBIG_OFFBIG_LINTFLAGS: -xarch=v9
357 _XBS5_LP64_OFF64_CFLAGS: -xarch=v9
358 _XBS5_LP64_OFF64_LDFLAGS: -xarch=v9
359 _XBS5_LP64_OFF64_LINTFLAGS: -xarch=v9
360 _XBS5_LPBIG_OFFBIG_CFLAGS: -xarch=v9
361 _XBS5_LPBIG_OFFBIG_LDFLAGS: -xarch=v9
362 _XBS5_LPBIG_OFFBIG_LINTFLAGS: -xarch=v9
363
b29a8fb9
JH
364This flag is supported in Sun WorkShop Compilers 5.0 and onwards
365(now marketed under the name Forte) when used on Solaris 7 or later on
366UltraSparc systems.
2a5ccb22
LC
367
368If you are using gcc, you would need to use -mcpu=v9 -m64 instead. This
369option is not yet supported as of gcc 2.95.2; from install/SPECIFIC
370in that release:
d420ca49 371
2a5ccb22
LC
372GCC version 2.95 is not able to compile code correctly for sparc64
373targets. Users of the Linux kernel, at least, can use the sparc32
374program to start up a new shell invocation with an environment that
375causes configure to recognize (via uname -a) the system as sparc-*-*
376instead.
d420ca49
AD
377
378All this should be handled automatically by the hints file, if
379requested.
380
d420ca49
AD
381=head3 Long Doubles.
382
383As of 5.6.0, long doubles are not working.
384
a83b6f46 385=head2 Threads in Perl on Solaris.
d420ca49
AD
386
387It is possible to build a threaded version of perl on Solaris. The entire
388perl thread implementation is still experimental, however, so beware.
389Perl uses the sched_yield(3RT) function. In versions of Solaris up
390to 2.6, that function is in -lposix4. Starting with Solaris 7, it is
391in -lrt. The hints file should handle adding this automatically.
392
a83b6f46 393=head2 Malloc Issues with Perl on Solaris.
d420ca49 394
83bd2f30
LC
395Starting from Perl 5.7.1 Perl uses the Solaris malloc, since the perl
396malloc breaks when dealing with more than 2GB of memory, and the Solaris
397malloc also seems to be faster.
398
399If you for some reason (such as binary backward compatibility) really
400need to use perl's malloc, you can rebuild Perl from the sources
401and Configure the build with
402
403 sh Configure -Dusemymalloc
210b36aa 404
d420ca49
AD
405You should not use perl's malloc if you are building with gcc. There
406are reports of core dumps, especially in the PDL module. The problem
407appears to go away under -DDEBUGGING, so it has been difficult to
5511f325 408track down. Sun's compiler appears to be okay with or without perl's
d420ca49
AD
409malloc. [XXX further investigation is needed here.]
410
d420ca49
AD
411=head1 MAKE PROBLEMS.
412
413=over 4
414
415=item Dynamic Loading Problems With GNU as and GNU ld
416
417If you have problems with dynamic loading using gcc on SunOS or
418Solaris, and you are using GNU as and GNU ld, see the section
419L<"GNU as and GNU ld"> above.
420
421=item ld.so.1: ./perl: fatal: relocation error:
422
423If you get this message on SunOS or Solaris, and you're using gcc,
424it's probably the GNU as or GNU ld problem in the previous item
425L<"GNU as and GNU ld">.
426
427=item dlopen: stub interception failed
428
429The primary cause of the 'dlopen: stub interception failed' message is
430that the LD_LIBRARY_PATH environment variable includes a directory
431which is a symlink to /usr/lib (such as /lib). See
432L<"LD_LIBRARY_PATH"> above.
433
434=item #error "No DATAMODEL_NATIVE specified"
435
436This is a common error when trying to build perl on Solaris 2.6 with a
437gcc installation from Solaris 2.5 or 2.5.1. The Solaris header files
438changed, so you need to update your gcc installation. You can either
439rerun the fixincludes script from gcc or take the opportunity to
440update your gcc installation.
441
442=item sh: ar: not found
443
444This is a message from your shell telling you that the command 'ar'
445was not found. You need to check your PATH environment variable to
446make sure that it includes the directory with the 'ar' command. This
447is a common problem on Solaris, where 'ar' is in the /usr/ccs/bin/
448directory.
449
450=back
451
452=head1 MAKE TEST
453
a83b6f46 454=head2 op/stat.t test 4 in Solaris
d420ca49
AD
455
456op/stat.t test 4 may fail if you are on a tmpfs of some sort.
457Building in /tmp sometimes shows this behavior. The
458test suite detects if you are building in /tmp, but it may not be able
459to catch all tmpfs situations.
460
1081c3b9
JH
461=head2 nss_delete core dump from op/pwent or op/grent
462
463See L<perlhpux/"nss_delete core dump from op/pwent or op/grent">.
464
a83b6f46 465=head1 PREBUILT BINARIES OF PERL FOR SOLARIS.
d420ca49
AD
466
467You can pick up prebuilt binaries for Solaris from
2a5ccb22
LC
468L<http://www.sunfreeware.com/>, ActiveState L<http://www.activestate.com/>,
469and L<http://www.perl.com/> under the Binaries list at the top of the page.
d420ca49
AD
470There are probably other sources as well. Please note that these sites
471are under the control of their respective owners, not the perl developers.
472
a83b6f46 473=head1 RUNTIME ISSUES FOR PERL ON SOLARIS.
d420ca49 474
a83b6f46 475=head2 Limits on Numbers of Open Files on Solaris.
d420ca49
AD
476
477The stdio(3C) manpage notes that only 255 files may be opened using
478fopen(), and only file descriptors 0 through 255 can be used in a
479stream. Since perl calls open() and then fdopen(3C) with the
480resulting file descriptor, perl is limited to 255 simultaneous open
481files.
482
483=head1 SOLARIS-SPECIFIC MODULES.
484
485See the modules under the Solaris:: namespace on CPAN,
486L<http://www.cpan.org/modules/by-module/Solaris/>.
487
488=head1 SOLARIS-SPECIFIC PROBLEMS WITH MODULES.
489
a83b6f46 490=head2 Proc::ProcessTable on Solaris
d420ca49
AD
491
492Proc::ProcessTable does not compile on Solaris with perl5.6.0 and higher
493if you have LARGEFILES defined. Since largefile support is the
494default in 5.6.0 and later, you have to take special steps to use this
495module.
496
497The problem is that various structures visible via procfs use off_t,
498and if you compile with largefile support these change from 32 bits to
49964 bits. Thus what you get back from procfs doesn't match up with
500the structures in perl, resulting in garbage. See proc(4) for further
501discussion.
502
503A fix for Proc::ProcessTable is to edit Makefile to
504explicitly remove the largefile flags from the ones MakeMaker picks up
505from Config.pm. This will result in Proc::ProcessTable being built
2a5ccb22 506under the correct environment. Everything should then be OK as long as
d420ca49
AD
507Proc::ProcessTable doesn't try to share off_t's with the rest of perl,
508or if it does they should be explicitly specified as off64_t.
509
5511f325 510=head2 BSD::Resource on Solaris
d420ca49
AD
511
512BSD::Resource versions earlier than 1.09 do not compile on Solaris
513with perl 5.6.0 and higher, for the same reasons as Proc::ProcessTable.
514BSD::Resource versions starting from 1.09 have a workaround for the problem.
515
5511f325 516=head2 Net::SSLeay on Solaris
2a5ccb22
LC
517
518Net::SSLeay requires a /dev/urandom to be present. This device is not
519part of Solaris. You can either get the package SUNWski (packaged with
520several Sun software products, for example the Sun WebServer, which is
521part of the Solaris Server Intranet Extension, or the Sun Directory
522Services, part of Solaris for ISPs) or download the ANDIrand package
523from L<http://www.cosy.sbg.ac.at/~andi/>. If you use SUNWski, make a
524symbolic link /dev/urandom pointing to /dev/random.
525
526It may be possible to use the Entropy Gathering Daemon (written in
527Perl!), available from L<http://www.lothar.com/tech/crypto/>.
528
d420ca49
AD
529=head1 AUTHOR
530
531The original was written by Andy Dougherty F<doughera@lafayette.edu>
532drawing heavily on advice from Alan Burlison, Nick Ing-Simmons, Tim Bunce,
533and many other Solaris users over the years.
534
535Please report any errors, updates, or suggestions to F<perlbug@perl.org>.
536
537=head1 LAST MODIFIED
538
b29a8fb9 539$Id: README.solaris,v 1.4 2000/11/11 20:29:58 doughera Exp $