xref: /openbsd/gnu/usr.bin/perl/README.solaris (revision e0680481)
1*e0680481Safresh1# vim: syntax=pod
2*e0680481Safresh1
3c48bdce4SmillertIf you read this file _as_is_, just ignore the funny characters you
4c48bdce4Smillertsee.  It is written in the POD format (see pod/perlpod.pod) which is
5c48bdce4Smillertspecifically designed to be readable as is.
6c48bdce4Smillert
7c48bdce4Smillert=head1 NAME
8c48bdce4Smillert
948950c12Ssthenperlsolaris - Perl version 5 on Solaris systems
10c48bdce4Smillert
11c48bdce4Smillert=head1 DESCRIPTION
12c48bdce4Smillert
13c48bdce4SmillertThis document describes various features of Sun's Solaris operating system
14c48bdce4Smillertthat will affect how Perl version 5 (hereafter just perl) is
15c48bdce4Smillertcompiled and/or runs.  Some issues relating to the older SunOS 4.x are
16c48bdce4Smillertalso discussed, though they may be out of date.
17c48bdce4Smillert
18c48bdce4SmillertFor the most part, everything should just work.
19c48bdce4Smillert
20c48bdce4SmillertStarting with Solaris 8, perl5.00503 (or higher) is supplied with the
21c48bdce4Smillertoperating system, so you might not even need to build a newer version
22c48bdce4Smillertof perl at all.  The Sun-supplied version is installed in /usr/perl5
2348950c12Ssthenwith F</usr/bin/perl> pointing to F</usr/perl5/bin/perl>.  Do not disturb
24c48bdce4Smillertthat installation unless you really know what you are doing.  If you
25f64b279aSmillertremove the perl supplied with the OS, you will render some bits of
26f64b279aSmillertyour system inoperable.  If you wish to install a newer version of perl,
27f64b279aSmillertinstall it under a different prefix from /usr/perl5.  Common prefixes
28f64b279aSmillertto use are /usr/local and /opt/perl.
29c48bdce4Smillert
30c48bdce4SmillertYou may wish to put your version of perl in the PATH of all users by
3148950c12Ssthenchanging the link F</usr/bin/perl>.  This is probably OK, as most perl
32f3142520Smillertscripts shipped with Solaris use an explicit path.  (There are a few
3348950c12Ssthenexceptions, such as F</usr/bin/rpm2cpio> and F</etc/rcm/scripts/README>, but
34f3142520Smillertthese are also sufficiently generic that the actual version of perl
35f3142520Smillertprobably doesn't matter too much.)
36f3142520Smillert
37f3142520SmillertSolaris ships with a range of Solaris-specific modules.  If you choose
38f3142520Smillertto install your own version of perl you will find the source of many of
39f3142520Smillertthese modules is available on CPAN under the Sun::Solaris:: namespace.
40f64b279aSmillert
41f64b279aSmillertSolaris may include two versions of perl, e.g. Solaris 9 includes
42f64b279aSmillertboth 5.005_03 and 5.6.1.  This is to provide stability across Solaris
43f64b279aSmillertreleases, in cases where a later perl version has incompatibilities
4448950c12Ssthenwith the version included in the preceding Solaris release.  The
45f64b279aSmillertdefault perl version will always be the most recent, and in general
46f64b279aSmillertthe old version will only be retained for one Solaris release.  Note
47f64b279aSmillertalso that the default perl will NOT be configured to search for modules
48f64b279aSmillertin the older version, again due to compatibility/stability concerns.
49f64b279aSmillertAs a consequence if you upgrade Solaris, you will have to
50f64b279aSmillertrebuild/reinstall any additional CPAN modules that you installed for
51f64b279aSmillertthe previous Solaris version.  See the CPAN manpage under 'autobundle'
52f64b279aSmillertfor a quick way of doing this.
53f64b279aSmillert
54f64b279aSmillertAs an interim measure, you may either change the #! line of your
55f64b279aSmillertscripts to specifically refer to the old perl version, e.g. on
56f64b279aSmillertSolaris 9 use #!/usr/perl5/5.00503/bin/perl to use the perl version
57f64b279aSmillertthat was the default for Solaris 8, or if you have a large number of
58f64b279aSmillertscripts it may be more convenient to make the old version of perl the
59f64b279aSmillertdefault on your system.  You can do this by changing the appropriate
60f64b279aSmillertsymlinks under /usr/perl5 as follows (example for Solaris 9):
61f64b279aSmillert
62f64b279aSmillert # cd /usr/perl5
63f64b279aSmillert # rm bin man pod
64f64b279aSmillert # ln -s ./5.00503/bin
65f64b279aSmillert # ln -s ./5.00503/man
66f64b279aSmillert # ln -s ./5.00503/lib/pod
67f64b279aSmillert # rm /usr/bin/perl
68f64b279aSmillert # ln -s ../perl5/5.00503/bin/perl /usr/bin/perl
69f64b279aSmillert
70f64b279aSmillertIn both cases this should only be considered to be a temporary
71f64b279aSmillertmeasure - you should upgrade to the later version of perl as soon as
72f64b279aSmillertis practicable.
73f64b279aSmillert
74f64b279aSmillertNote also that the perl command-line utilities (e.g. perldoc) and any
75f64b279aSmillertthat are added by modules that you install will be under
76f64b279aSmillert/usr/perl5/bin, so that directory should be added to your PATH.
77c48bdce4Smillert
78c48bdce4Smillert=head2 Solaris Version Numbers.
79c48bdce4Smillert
80c48bdce4SmillertFor consistency with common usage, perl's Configure script performs
81c48bdce4Smillertsome minor manipulations on the operating system name and version
82c48bdce4Smillertnumber as reported by uname.  Here's a partial translation table:
83c48bdce4Smillert
84c48bdce4Smillert          Sun:                      perl's Configure:
85c48bdce4Smillert uname    uname -r   Name           osname     osvers
86c48bdce4Smillert SunOS    4.1.3     Solaris 1.1     sunos      4.1.3
87c48bdce4Smillert SunOS    5.6       Solaris 2.6     solaris    2.6
88c48bdce4Smillert SunOS    5.8       Solaris 8       solaris    2.8
89f64b279aSmillert SunOS    5.9       Solaris 9       solaris    2.9
90f64b279aSmillert SunOS    5.10      Solaris 10      solaris    2.10
91c48bdce4Smillert
92c48bdce4SmillertThe complete table can be found in the Sun Managers' FAQ
9379cd0b9aSmillertL<ftp://ftp.cs.toronto.edu/pub/jdd/sunmanagers/faq> under
94c48bdce4Smillert"9.1) Which Sun models run which versions of SunOS?".
95c48bdce4Smillert
96c48bdce4Smillert=head1 RESOURCES
97c48bdce4Smillert
9879cd0b9aSmillertThere are many, many sources for Solaris information.  A few of the
99c48bdce4Smillertimportant ones for perl:
100c48bdce4Smillert
101c48bdce4Smillert=over 4
102c48bdce4Smillert
103c48bdce4Smillert=item Solaris FAQ
104c48bdce4Smillert
105c48bdce4SmillertThe Solaris FAQ is available at
106c48bdce4SmillertL<http://www.science.uva.nl/pub/solaris/solaris2.html>.
107c48bdce4Smillert
108c48bdce4SmillertThe Sun Managers' FAQ is available at
10979cd0b9aSmillertL<ftp://ftp.cs.toronto.edu/pub/jdd/sunmanagers/faq>
110c48bdce4Smillert
111c48bdce4Smillert=item Precompiled Binaries
112c48bdce4Smillert
113f64b279aSmillertPrecompiled binaries, links to many sites, and much, much more are
114f64b279aSmillertavailable at L<http://www.sunfreeware.com/> and
115f64b279aSmillertL<http://www.blastwave.org/>.
116c48bdce4Smillert
117c48bdce4Smillert=item Solaris Documentation
118c48bdce4Smillert
11979cd0b9aSmillertAll Solaris documentation is available on-line at L<http://docs.sun.com/>.
120c48bdce4Smillert
121c48bdce4Smillert=back
122c48bdce4Smillert
123c48bdce4Smillert=head1 SETTING UP
124c48bdce4Smillert
12579cd0b9aSmillert=head2 File Extraction Problems on Solaris.
126c48bdce4Smillert
127c48bdce4SmillertBe sure to use a tar program compiled under Solaris (not SunOS 4.x)
128c48bdce4Smillertto extract the perl-5.x.x.tar.gz file.  Do not use GNU tar compiled
129c48bdce4Smillertfor SunOS4 on Solaris.  (GNU tar compiled for Solaris should be fine.)
130c48bdce4SmillertWhen you run SunOS4 binaries on Solaris, the run-time system magically
131c48bdce4Smillertalters pathnames matching m#lib/locale# so that when tar tries to create
132c48bdce4Smillertlib/locale.pm, a file named lib/oldlocale.pm gets created instead.
13379cd0b9aSmillertIf you found this advice too late and used a SunOS4-compiled tar
134c48bdce4Smillertanyway, you must find the incorrectly renamed file and move it back
135c48bdce4Smillertto lib/locale.pm.
136c48bdce4Smillert
13779cd0b9aSmillert=head2 Compiler and Related Tools on Solaris.
138c48bdce4Smillert
139c48bdce4SmillertYou must use an ANSI C compiler to build perl.  Perl can be compiled
140c48bdce4Smillertwith either Sun's add-on C compiler or with gcc.  The C compiler that
141c48bdce4Smillertshipped with SunOS4 will not do.
142c48bdce4Smillert
143c48bdce4Smillert=head3 Include /usr/ccs/bin/ in your PATH.
144c48bdce4Smillert
145c48bdce4SmillertSeveral tools needed to build perl are located in /usr/ccs/bin/:  ar,
146c48bdce4Smillertas, ld, and make.  Make sure that /usr/ccs/bin/ is in your PATH.
147c48bdce4Smillert
14848950c12Ssthen
14948950c12SsthenOn all the released versions of Solaris (8, 9 and 10) you need to make sure the following packages are installed (this info is extracted from the Solaris FAQ):
150c48bdce4Smillert
151c48bdce4Smillertfor tools (sccs, lex, yacc, make, nm, truss, ld, as): SUNWbtool,
152c48bdce4SmillertSUNWsprot, SUNWtoo
153c48bdce4Smillert
154c48bdce4Smillertfor libraries & headers: SUNWhea, SUNWarc, SUNWlibm, SUNWlibms, SUNWdfbh,
15548950c12SsthenSUNWcg6h, SUNWxwinc
15648950c12Ssthen
157b46d8ef2Safresh1Additionally, on Solaris 8 and 9 you also need:
158c48bdce4Smillert
159c48bdce4Smillertfor 64 bit development: SUNWarcx, SUNWbtoox, SUNWdplx, SUNWscpux,
160c48bdce4SmillertSUNWsprox, SUNWtoox, SUNWlmsx, SUNWlmx, SUNWlibCx
161c48bdce4Smillert
16248950c12SsthenAnd only on Solaris 8 you also need:
16348950c12Ssthen
16448950c12Ssthenfor libraries & headers: SUNWolinc
16548950c12Ssthen
16648950c12Ssthen
167c48bdce4SmillertIf you are in doubt which package contains a file you are missing,
168c48bdce4Smillerttry to find an installation that has that file. Then do a
169c48bdce4Smillert
170f64b279aSmillert $ grep /my/missing/file /var/sadm/install/contents
171c48bdce4Smillert
172c48bdce4SmillertThis will display a line like this:
173c48bdce4Smillert
174c48bdce4Smillert/usr/include/sys/errno.h f none 0644 root bin 7471 37605 956241356 SUNWhea
175c48bdce4Smillert
176c48bdce4SmillertThe last item listed (SUNWhea in this example) is the package you need.
177c48bdce4Smillert
178c48bdce4Smillert=head3 Avoid /usr/ucb/cc.
179c48bdce4Smillert
180c48bdce4SmillertYou don't need to have /usr/ucb/ in your PATH to build perl.  If you
181c48bdce4Smillertwant /usr/ucb/ in your PATH anyway, make sure that /usr/ucb/ is NOT
182c48bdce4Smillertin your PATH before the directory containing the right C compiler.
183c48bdce4Smillert
184c48bdce4Smillert=head3 Sun's C Compiler
185c48bdce4Smillert
186c48bdce4SmillertIf you use Sun's C compiler, make sure the correct directory
187c48bdce4Smillert(usually /opt/SUNWspro/bin/) is in your PATH (before /usr/ucb/).
188c48bdce4Smillert
189c48bdce4Smillert=head3 GCC
190c48bdce4Smillert
191f64b279aSmillertIf you use gcc, make sure your installation is recent and complete.
192f64b279aSmillertperl versions since 5.6.0 build fine with gcc > 2.8.1 on Solaris >=
193f64b279aSmillert2.6.
194c48bdce4Smillert
195f64b279aSmillertYou must Configure perl with
196f64b279aSmillert
197f64b279aSmillert $ sh Configure -Dcc=gcc
198f64b279aSmillert
199f64b279aSmillertIf you don't, you may experience strange build errors.
200c48bdce4Smillert
201c48bdce4SmillertIf you have updated your Solaris version, you may also have to update
202f64b279aSmillertyour gcc.  For example, if you are running Solaris 2.6 and your gcc is
203c48bdce4Smillertinstalled under /usr/local, check in /usr/local/lib/gcc-lib and make
204c48bdce4Smillertsure you have the appropriate directory, sparc-sun-solaris2.6/ or
205c48bdce4Smillerti386-pc-solaris2.6/.  If gcc's directory is for a different version of
206c48bdce4SmillertSolaris than you are running, then you will need to rebuild gcc for
207c48bdce4Smillertyour new version of Solaris.
208c48bdce4Smillert
209c48bdce4SmillertYou can get a precompiled version of gcc from
210f64b279aSmillertL<http://www.sunfreeware.com/> or L<http://www.blastwave.org/>. Make
211f64b279aSmillertsure you pick up the package for your Solaris release.
212f64b279aSmillert
213f64b279aSmillertIf you wish to use gcc to build add-on modules for use with the perl
214f64b279aSmillertshipped with Solaris, you should use the Solaris::PerlGcc module
215f64b279aSmillertwhich is available from CPAN.  The perl shipped with Solaris
216f64b279aSmillertis configured and built with the Sun compilers, and the compiler
217f64b279aSmillertconfiguration information stored in Config.pm is therefore only
218f64b279aSmillertrelevant to the Sun compilers.  The Solaris:PerlGcc module contains a
219f64b279aSmillertreplacement Config.pm that is correct for gcc - see the module for
220f64b279aSmillertdetails.
221c48bdce4Smillert
222c48bdce4Smillert=head3 GNU as and GNU ld
223c48bdce4Smillert
22479cd0b9aSmillertThe following information applies to gcc version 2.  Volunteers to
22548950c12Ssthenupdate it as appropriately for gcc version 3 would be appreciated.
22679cd0b9aSmillert
227c48bdce4SmillertThe versions of as and ld supplied with Solaris work fine for building
22879cd0b9aSmillertperl.  There is normally no need to install the GNU versions to
22979cd0b9aSmillertcompile perl.
230c48bdce4Smillert
231c48bdce4SmillertIf you decide to ignore this advice and use the GNU versions anyway,
232c48bdce4Smillertthen be sure that they are relatively recent.  Versions newer than 2.7
233c48bdce4Smillertare apparently new enough.  Older versions may have trouble with
234c48bdce4Smillertdynamic loading.
235c48bdce4Smillert
23679cd0b9aSmillertIf you wish to use GNU ld, then you need to pass it the -Wl,-E flag.
237f64b279aSmillertThe hints/solaris_2.sh file tries to do this automatically by setting
238f64b279aSmillertthe following Configure variables:
23979cd0b9aSmillert
24079cd0b9aSmillert ccdlflags="$ccdlflags -Wl,-E"
24179cd0b9aSmillert lddlflags="$lddlflags -Wl,-E -G"
24279cd0b9aSmillert
24379cd0b9aSmillertHowever, over the years, changes in gcc, GNU ld, and Solaris ld have made
24479cd0b9aSmillertit difficult to automatically detect which ld ultimately gets called.
24579cd0b9aSmillertYou may have to manually edit config.sh and add the -Wl,-E flags
24679cd0b9aSmillertyourself, or else run Configure interactively and add the flags at the
24779cd0b9aSmillertappropriate prompts.
24879cd0b9aSmillert
249c48bdce4SmillertIf your gcc is configured to use GNU as and ld but you want to use the
250c48bdce4SmillertSolaris ones instead to build perl, then you'll need to add
251c48bdce4Smillert-B/usr/ccs/bin/ to the gcc command line.  One convenient way to do
252c48bdce4Smillertthat is with
253c48bdce4Smillert
254f64b279aSmillert $ sh Configure -Dcc='gcc -B/usr/ccs/bin/'
255c48bdce4Smillert
256c48bdce4SmillertNote that the trailing slash is required.  This will result in some
257c48bdce4Smillertharmless warnings as Configure is run:
258c48bdce4Smillert
259c48bdce4Smillert gcc: file path prefix `/usr/ccs/bin/' never used
260c48bdce4Smillert
261c48bdce4SmillertThese messages may safely be ignored.
262c48bdce4Smillert(Note that for a SunOS4 system, you must use -B/bin/ instead.)
263c48bdce4Smillert
264c48bdce4SmillertAlternatively, you can use the GCC_EXEC_PREFIX environment variable to
265c48bdce4Smillertensure that Sun's as and ld are used.  Consult your gcc documentation
266c48bdce4Smillertfor further information on the -B option and the GCC_EXEC_PREFIX variable.
267c48bdce4Smillert
268f64b279aSmillert=head3 Sun and GNU make
269c48bdce4Smillert
270f64b279aSmillertThe make under /usr/ccs/bin works fine for building perl.  If you
271f64b279aSmillerthave the Sun C compilers, you will also have a parallel version of
272f64b279aSmillertmake (dmake).  This works fine to build perl, but can sometimes cause
273f64b279aSmillertproblems when running 'make test' due to underspecified dependencies
274f64b279aSmillertbetween the different test harness files.  The same problem can also
275f64b279aSmillertaffect the building of some add-on modules, so in those cases either
276f64b279aSmillertspecify '-m serial' on the dmake command line, or use
277f64b279aSmillert/usr/ccs/bin/make instead.  If you wish to use GNU make, be sure that
278f64b279aSmillertthe set-group-id bit is not set.  If it is, then arrange your PATH so
279f64b279aSmillertthat /usr/ccs/bin/make is before GNU make or else have the system
280f64b279aSmillertadministrator disable the set-group-id bit on GNU make.
281c48bdce4Smillert
282c48bdce4Smillert=head3 Avoid libucb.
283c48bdce4Smillert
284c48bdce4SmillertSolaris provides some BSD-compatibility functions in /usr/ucblib/libucb.a.
285c48bdce4SmillertPerl will not build and run correctly if linked against -lucb since it
286c48bdce4Smillertcontains routines that are incompatible with the standard Solaris libc.
287c48bdce4SmillertNormally this is not a problem since the solaris hints file prevents
288c48bdce4SmillertConfigure from even looking in /usr/ucblib for libraries, and also
289c48bdce4Smillertexplicitly omits -lucb.
290c48bdce4Smillert
291f64b279aSmillert=head2 Environment for Compiling perl on Solaris
292c48bdce4Smillert
293c48bdce4Smillert=head3 PATH
294c48bdce4Smillert
295c48bdce4SmillertMake sure your PATH includes the compiler (/opt/SUNWspro/bin/ if you're
296c48bdce4Smillertusing Sun's compiler) as well as /usr/ccs/bin/ to pick up the other
297c48bdce4Smillertdevelopment tools (such as make, ar, as, and ld).  Make sure your path
298c48bdce4Smillerteither doesn't include /usr/ucb or that it includes it after the
299c48bdce4Smillertcompiler and compiler tools and other standard Solaris directories.
300c48bdce4SmillertYou definitely don't want /usr/ucb/cc.
301c48bdce4Smillert
302c48bdce4Smillert=head3 LD_LIBRARY_PATH
303c48bdce4Smillert
304c48bdce4SmillertIf you have the LD_LIBRARY_PATH environment variable set, be sure that
305c48bdce4Smillertit does NOT include /lib or /usr/lib.  If you will be building
306c48bdce4Smillertextensions that call third-party shared libraries (e.g. Berkeley DB)
307c48bdce4Smillertthen make sure that your LD_LIBRARY_PATH environment variable includes
308c48bdce4Smillertthe directory with that library (e.g. /usr/local/lib).
309c48bdce4Smillert
310c48bdce4SmillertIf you get an error message
311c48bdce4Smillert
312c48bdce4Smillert dlopen: stub interception failed
313c48bdce4Smillert
314c48bdce4Smillertit is probably because your LD_LIBRARY_PATH environment variable
315c48bdce4Smillertincludes a directory which is a symlink to /usr/lib (such as /lib).
316c48bdce4SmillertThe reason this causes a problem is quite subtle.  The file
317c48bdce4Smillertlibdl.so.1.0 actually *only* contains functions which generate 'stub
318c48bdce4Smillertinterception failed' errors!  The runtime linker intercepts links to
319c48bdce4Smillert"/usr/lib/libdl.so.1.0" and links in internal implementations of those
320c48bdce4Smillertfunctions instead.  [Thanks to Tim Bunce for this explanation.]
321c48bdce4Smillert
322c48bdce4Smillert=head1 RUN CONFIGURE.
323c48bdce4Smillert
324c48bdce4SmillertSee the INSTALL file for general information regarding Configure.
325c48bdce4SmillertOnly Solaris-specific issues are discussed here.  Usually, the
326c48bdce4Smillertdefaults should be fine.
327c48bdce4Smillert
328f64b279aSmillert=head2 64-bit perl on Solaris.
329c48bdce4Smillert
330c48bdce4SmillertSee the INSTALL file for general information regarding 64-bit compiles.
331c48bdce4SmillertIn general, the defaults should be fine for most people.
332c48bdce4Smillert
333c48bdce4SmillertBy default, perl-5.6.0 (or later) is compiled as a 32-bit application
334c48bdce4Smillertwith largefile and long-long support.
335c48bdce4Smillert
336c48bdce4Smillert=head3 General 32-bit vs. 64-bit issues.
337c48bdce4Smillert
338c48bdce4SmillertSolaris 7 and above will run in either 32 bit or 64 bit mode on SPARC
339c48bdce4SmillertCPUs, via a reboot. You can build 64 bit apps whilst running 32 bit
340c48bdce4Smillertmode and vice-versa. 32 bit apps will run under Solaris running in
341c48bdce4Smillerteither 32 or 64 bit mode.  64 bit apps require Solaris to be running
342c48bdce4Smillert64 bit mode.
343c48bdce4Smillert
344c48bdce4SmillertExisting 32 bit apps are properly known as LP32, i.e. Longs and
345c48bdce4SmillertPointers are 32 bit.  64-bit apps are more properly known as LP64.
346c48bdce4SmillertThe discriminating feature of a LP64 bit app is its ability to utilise a
347c48bdce4Smillert64-bit address space.  It is perfectly possible to have a LP32 bit app
348c48bdce4Smillertthat supports both 64-bit integers (long long) and largefiles (> 2GB),
349c48bdce4Smillertand this is the default for perl-5.6.0.
350c48bdce4Smillert
351f64b279aSmillertFor a more complete explanation of 64-bit issues, see the
352f64b279aSmillert"Solaris 64-bit Developer's Guide" at L<http://docs.sun.com/>
353c48bdce4Smillert
354c48bdce4SmillertYou can detect the OS mode using "isainfo -v", e.g.
355c48bdce4Smillert
356f64b279aSmillert $ isainfo -v   # Ultra 30 in 64 bit mode
357c48bdce4Smillert 64-bit sparcv9 applications
358c48bdce4Smillert 32-bit sparc applications
359c48bdce4Smillert
360f64b279aSmillertBy default, perl will be compiled as a 32-bit application.  Unless
361f64b279aSmillertyou want to allocate more than ~ 4GB of memory inside perl, or unless
362f64b279aSmillertyou need more than 255 open file descriptors, you probably don't need
363f64b279aSmillertperl to be a 64-bit app.
364c48bdce4Smillert
36579cd0b9aSmillert=head3 Large File Support
366c48bdce4Smillert
367c48bdce4SmillertFor Solaris 2.6 and onwards, there are two different ways for 32-bit
368c48bdce4Smillertapplications to manipulate large files (files whose size is > 2GByte).
369c48bdce4Smillert(A 64-bit application automatically has largefile support built in
370c48bdce4Smillertby default.)
371c48bdce4Smillert
372c48bdce4SmillertFirst is the "transitional compilation environment", described in
373c48bdce4Smillertlfcompile64(5).  According to the man page,
374c48bdce4Smillert
375c48bdce4Smillert The transitional compilation  environment  exports  all  the
376c48bdce4Smillert explicit 64-bit functions (xxx64()) and types in addition to
377c48bdce4Smillert all the regular functions (xxx()) and types. Both xxx()  and
378c48bdce4Smillert xxx64()  functions  are  available to the program source.  A
379c48bdce4Smillert 32-bit application must use the xxx64() functions in  order
380c48bdce4Smillert to  access  large  files.  See the lf64(5) manual page for a
381c48bdce4Smillert complete listing of the 64-bit transitional interfaces.
382c48bdce4Smillert
383c48bdce4SmillertThe transitional compilation environment is obtained with the
384c48bdce4Smillertfollowing compiler and linker flags:
385c48bdce4Smillert
386c48bdce4Smillert getconf LFS64_CFLAGS        -D_LARGEFILE64_SOURCE
387c48bdce4Smillert getconf LFS64_LDFLAG        # nothing special needed
388c48bdce4Smillert getconf LFS64_LIBS          # nothing special needed
389c48bdce4Smillert
390c48bdce4SmillertSecond is the "large file compilation environment", described in
391c48bdce4Smillertlfcompile(5).  According to the man page,
392c48bdce4Smillert
393c48bdce4Smillert Each interface named xxx() that needs to access 64-bit entities
394c48bdce4Smillert to  access  large  files maps to a xxx64() call in the
395c48bdce4Smillert resulting binary. All relevant data types are defined to  be
396c48bdce4Smillert of correct size (for example, off_t has a typedef definition
397c48bdce4Smillert for a 64-bit entity).
398c48bdce4Smillert
399c48bdce4Smillert An application compiled in this environment is able  to  use
400c48bdce4Smillert the  xxx()  source interfaces to access both large and small
401c48bdce4Smillert files, rather than having to explicitly utilize the  transitional
402c48bdce4Smillert xxx64()  interface  calls to access large files.
403c48bdce4Smillert
404c48bdce4SmillertTwo exceptions are fseek() and ftell().  32-bit applications should
405c48bdce4Smillertuse fseeko(3C) and ftello(3C).  These will get automatically mapped
406c48bdce4Smillertto fseeko64() and ftello64().
407c48bdce4Smillert
408c48bdce4SmillertThe large file compilation environment is obtained with
409c48bdce4Smillert
410c48bdce4Smillert getconf LFS_CFLAGS      -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
411c48bdce4Smillert getconf LFS_LDFLAGS     # nothing special needed
412c48bdce4Smillert getconf LFS_LIBS        # nothing special needed
413c48bdce4Smillert
414c48bdce4SmillertBy default, perl uses the large file compilation environment and
415c48bdce4Smillertrelies on Solaris to do the underlying mapping of interfaces.
416c48bdce4Smillert
417f64b279aSmillert=head3 Building an LP64 perl
418c48bdce4Smillert
419c48bdce4SmillertTo compile a 64-bit application on an UltraSparc with a recent Sun Compiler,
420c48bdce4Smillertyou need to use the flag "-xarch=v9".  getconf(1) will tell you this, e.g.
421c48bdce4Smillert
422f64b279aSmillert $ getconf -a | grep v9
423c48bdce4Smillert XBS5_LP64_OFF64_CFLAGS:         -xarch=v9
424c48bdce4Smillert XBS5_LP64_OFF64_LDFLAGS:        -xarch=v9
425c48bdce4Smillert XBS5_LP64_OFF64_LINTFLAGS:      -xarch=v9
426c48bdce4Smillert XBS5_LPBIG_OFFBIG_CFLAGS:       -xarch=v9
427c48bdce4Smillert XBS5_LPBIG_OFFBIG_LDFLAGS:      -xarch=v9
428c48bdce4Smillert XBS5_LPBIG_OFFBIG_LINTFLAGS:    -xarch=v9
429c48bdce4Smillert _XBS5_LP64_OFF64_CFLAGS:        -xarch=v9
430c48bdce4Smillert _XBS5_LP64_OFF64_LDFLAGS:       -xarch=v9
431c48bdce4Smillert _XBS5_LP64_OFF64_LINTFLAGS:     -xarch=v9
432c48bdce4Smillert _XBS5_LPBIG_OFFBIG_CFLAGS:      -xarch=v9
433c48bdce4Smillert _XBS5_LPBIG_OFFBIG_LDFLAGS:     -xarch=v9
434c48bdce4Smillert _XBS5_LPBIG_OFFBIG_LINTFLAGS:   -xarch=v9
435c48bdce4Smillert
436c48bdce4SmillertThis flag is supported in Sun WorkShop Compilers 5.0 and onwards
437c48bdce4Smillert(now marketed under the name Forte) when used on Solaris 7 or later on
438c48bdce4SmillertUltraSparc systems.
439c48bdce4Smillert
440c48bdce4SmillertIf you are using gcc, you would need to use -mcpu=v9 -m64 instead.  This
441c48bdce4Smillertoption is not yet supported as of gcc 2.95.2; from install/SPECIFIC
442c48bdce4Smillertin that release:
443c48bdce4Smillert
444c48bdce4Smillert GCC version 2.95 is not able to compile code correctly for sparc64
445c48bdce4Smillert targets. Users of the Linux kernel, at least, can use the sparc32
446c48bdce4Smillert program to start up a new shell invocation with an environment that
447c48bdce4Smillert causes configure to recognize (via uname -a) the system as sparc-*-*
448c48bdce4Smillert instead.
449c48bdce4Smillert
450c48bdce4SmillertAll this should be handled automatically by the hints file, if
451c48bdce4Smillertrequested.
452c48bdce4Smillert
453c48bdce4Smillert=head3 Long Doubles.
454c48bdce4Smillert
455f64b279aSmillertAs of 5.8.1, long doubles are working if you use the Sun compilers
456f64b279aSmillert(needed for additional math routines not included in libm).
457c48bdce4Smillert
458f64b279aSmillert=head2 Threads in perl on Solaris.
459c48bdce4Smillert
460c48bdce4SmillertIt is possible to build a threaded version of perl on Solaris.  The entire
461c48bdce4Smillertperl thread implementation is still experimental, however, so beware.
462c48bdce4Smillert
463f64b279aSmillert=head2 Malloc Issues with perl on Solaris.
46479cd0b9aSmillert
465f64b279aSmillertStarting from perl 5.7.1 perl uses the Solaris malloc, since the perl
46679cd0b9aSmillertmalloc breaks when dealing with more than 2GB of memory, and the Solaris
46779cd0b9aSmillertmalloc also seems to be faster.
46879cd0b9aSmillert
46979cd0b9aSmillertIf you for some reason (such as binary backward compatibility) really
470f64b279aSmillertneed to use perl's malloc, you can rebuild perl from the sources
47179cd0b9aSmillertand Configure the build with
47279cd0b9aSmillert
473f64b279aSmillert $ sh Configure -Dusemymalloc
474c48bdce4Smillert
475c48bdce4SmillertYou should not use perl's malloc if you are building with gcc.  There
476c48bdce4Smillertare reports of core dumps, especially in the PDL module.  The problem
477c48bdce4Smillertappears to go away under -DDEBUGGING, so it has been difficult to
47879cd0b9aSmillerttrack down.  Sun's compiler appears to be okay with or without perl's
479c48bdce4Smillertmalloc. [XXX further investigation is needed here.]
480c48bdce4Smillert
481c48bdce4Smillert=head1 MAKE PROBLEMS.
482c48bdce4Smillert
483c48bdce4Smillert=over 4
484c48bdce4Smillert
485c48bdce4Smillert=item Dynamic Loading Problems With GNU as and GNU ld
486c48bdce4Smillert
487c48bdce4SmillertIf you have problems with dynamic loading using gcc on SunOS or
488c48bdce4SmillertSolaris, and you are using GNU as and GNU ld, see the section
4899f11ffb7Safresh1L</"GNU as and GNU ld"> above.
490c48bdce4Smillert
491c48bdce4Smillert=item ld.so.1: ./perl: fatal: relocation error:
492c48bdce4Smillert
493c48bdce4SmillertIf you get this message on SunOS or Solaris, and you're using gcc,
494c48bdce4Smillertit's probably the GNU as or GNU ld problem in the previous item
4959f11ffb7Safresh1L</"GNU as and GNU ld">.
496c48bdce4Smillert
497c48bdce4Smillert=item dlopen: stub interception failed
498c48bdce4Smillert
499c48bdce4SmillertThe primary cause of the 'dlopen: stub interception failed' message is
500c48bdce4Smillertthat the LD_LIBRARY_PATH environment variable includes a directory
501c48bdce4Smillertwhich is a symlink to /usr/lib (such as /lib).  See
5029f11ffb7Safresh1L</"LD_LIBRARY_PATH"> above.
503c48bdce4Smillert
504c48bdce4Smillert=item #error "No DATAMODEL_NATIVE specified"
505c48bdce4Smillert
506c48bdce4SmillertThis is a common error when trying to build perl on Solaris 2.6 with a
507c48bdce4Smillertgcc installation from Solaris 2.5 or 2.5.1.  The Solaris header files
508c48bdce4Smillertchanged, so you need to update your gcc installation.  You can either
509c48bdce4Smillertrerun the fixincludes script from gcc or take the opportunity to
510c48bdce4Smillertupdate your gcc installation.
511c48bdce4Smillert
512c48bdce4Smillert=item sh: ar: not found
513c48bdce4Smillert
514c48bdce4SmillertThis is a message from your shell telling you that the command 'ar'
515c48bdce4Smillertwas not found.  You need to check your PATH environment variable to
516c48bdce4Smillertmake sure that it includes the directory with the 'ar' command.  This
517c48bdce4Smillertis a common problem on Solaris, where 'ar' is in the /usr/ccs/bin/
518c48bdce4Smillertdirectory.
519c48bdce4Smillert
520c48bdce4Smillert=back
521c48bdce4Smillert
522c48bdce4Smillert=head1 MAKE TEST
523c48bdce4Smillert
52479cd0b9aSmillert=head2 op/stat.t test 4 in Solaris
525c48bdce4Smillert
52648950c12SsthenF<op/stat.t> test 4 may fail if you are on a tmpfs of some sort.
527c48bdce4SmillertBuilding in /tmp sometimes shows this behavior.  The
528c48bdce4Smillerttest suite detects if you are building in /tmp, but it may not be able
529c48bdce4Smillertto catch all tmpfs situations.
530c48bdce4Smillert
53179cd0b9aSmillert=head2 nss_delete core dump from op/pwent or op/grent
53279cd0b9aSmillert
53379cd0b9aSmillertSee L<perlhpux/"nss_delete core dump from op/pwent or op/grent">.
53479cd0b9aSmillert
535e5157e49Safresh1=head1 CROSS-COMPILATION
536e5157e49Safresh1
537e5157e49Safresh1Nothing too unusual here.  You can easily do this if you have a
538e5157e49Safresh1cross-compiler available;  A usual Configure invocation when targetting a
539e5157e49Safresh1Solaris x86 looks something like this:
540e5157e49Safresh1
541e5157e49Safresh1    sh ./Configure -des -Dusecrosscompile \
542e5157e49Safresh1        -Dcc=i386-pc-solaris2.11-gcc      \
543e5157e49Safresh1        -Dsysroot=$SYSROOT                \
544e5157e49Safresh1        -Alddlflags=" -Wl,-z,notext"      \
545e5157e49Safresh1        -Dtargethost=... # The usual cross-compilation options
546e5157e49Safresh1
547e5157e49Safresh1The lddlflags addition is the only abnormal bit.
548e5157e49Safresh1
54979cd0b9aSmillert=head1 PREBUILT BINARIES OF PERL FOR SOLARIS.
550c48bdce4Smillert
551c48bdce4SmillertYou can pick up prebuilt binaries for Solaris from
552f64b279aSmillertL<http://www.sunfreeware.com/>, L<http://www.blastwave.org>,
553f64b279aSmillertActiveState L<http://www.activestate.com/>, and
554f64b279aSmillertL<http://www.perl.com/> under the Binaries list at the top of the
555f64b279aSmillertpage.  There are probably other sources as well.  Please note that
556f64b279aSmillertthese sites are under the control of their respective owners, not the
557f64b279aSmillertperl developers.
558c48bdce4Smillert
55979cd0b9aSmillert=head1 RUNTIME ISSUES FOR PERL ON SOLARIS.
560c48bdce4Smillert
56179cd0b9aSmillert=head2 Limits on Numbers of Open Files on Solaris.
562c48bdce4Smillert
563f64b279aSmillertThe stdio(3C) manpage notes that for LP32 applications, only 255
564f64b279aSmillertfiles may be opened using fopen(), and only file descriptors 0
565f64b279aSmillertthrough 255 can be used in a stream.  Since perl calls open() and
566f64b279aSmillertthen fdopen(3C) with the resulting file descriptor, perl is limited
567f64b279aSmillertto 255 simultaneous open files, even if sysopen() is used.  If this
568f64b279aSmillertproves to be an insurmountable problem, you can compile perl as a
5699f11ffb7Safresh1LP64 application, see L</Building an LP64 perl> for details.  Note
570f64b279aSmillertalso that the default resource limit for open file descriptors on
571f64b279aSmillertSolaris is 255, so you will have to modify your ulimit or rctl
572f64b279aSmillert(Solaris 9 onwards) appropriately.
573c48bdce4Smillert
574c48bdce4Smillert=head1 SOLARIS-SPECIFIC MODULES.
575c48bdce4Smillert
576f64b279aSmillertSee the modules under the Solaris:: and Sun::Solaris namespaces on CPAN,
577f64b279aSmillertsee L<http://www.cpan.org/modules/by-module/Solaris/> and
578f64b279aSmillertL<http://www.cpan.org/modules/by-module/Sun/>.
579c48bdce4Smillert
580c48bdce4Smillert=head1 SOLARIS-SPECIFIC PROBLEMS WITH MODULES.
581c48bdce4Smillert
58279cd0b9aSmillert=head2 Proc::ProcessTable on Solaris
583c48bdce4Smillert
584c48bdce4SmillertProc::ProcessTable does not compile on Solaris with perl5.6.0 and higher
585c48bdce4Smillertif you have LARGEFILES defined.  Since largefile support is the
586c48bdce4Smillertdefault in 5.6.0 and later, you have to take special steps to use this
587c48bdce4Smillertmodule.
588c48bdce4Smillert
589c48bdce4SmillertThe problem is that various structures visible via procfs use off_t,
590c48bdce4Smillertand if you compile with largefile support these change from 32 bits to
591c48bdce4Smillert64 bits.  Thus what you get back from procfs doesn't match up with
592c48bdce4Smillertthe structures in perl, resulting in garbage.  See proc(4) for further
593c48bdce4Smillertdiscussion.
594c48bdce4Smillert
595c48bdce4SmillertA fix for Proc::ProcessTable is to edit Makefile to
596c48bdce4Smillertexplicitly remove the largefile flags from the ones MakeMaker picks up
597c48bdce4Smillertfrom Config.pm.  This will result in Proc::ProcessTable being built
598c48bdce4Smillertunder the correct environment.  Everything should then be OK as long as
599c48bdce4SmillertProc::ProcessTable doesn't try to share off_t's with the rest of perl,
600c48bdce4Smillertor if it does they should be explicitly specified as off64_t.
601c48bdce4Smillert
60279cd0b9aSmillert=head2 BSD::Resource on Solaris
603c48bdce4Smillert
604c48bdce4SmillertBSD::Resource versions earlier than 1.09 do not compile on Solaris
605c48bdce4Smillertwith perl 5.6.0 and higher, for the same reasons as Proc::ProcessTable.
606c48bdce4SmillertBSD::Resource versions starting from 1.09 have a workaround for the problem.
607c48bdce4Smillert
60879cd0b9aSmillert=head2 Net::SSLeay on Solaris
609c48bdce4Smillert
610f64b279aSmillertNet::SSLeay requires a /dev/urandom to be present. This device is
611f64b279aSmillertavailable from Solaris 9 onwards.  For earlier Solaris versions you
612f64b279aSmillertcan either get the package SUNWski (packaged with several Sun
613f64b279aSmillertsoftware products, for example the Sun WebServer, which is part of
614f64b279aSmillertthe Solaris Server Intranet Extension, or the Sun Directory Services,
615f64b279aSmillertpart of Solaris for ISPs) or download the ANDIrand package from
616f64b279aSmillertL<http://www.cosy.sbg.ac.at/~andi/>. If you use SUNWski, make a
617f3142520Smillertsymbolic link /dev/urandom pointing to /dev/random.  For more details,
618f3142520Smillertsee Document ID27606 entitled "Differing /dev/random support requirements
619f3142520Smillertwithin Solaris[TM] Operating Environments", available at
62048950c12SsthenL<http://sunsolve.sun.com> .
621c48bdce4Smillert
622c48bdce4SmillertIt may be possible to use the Entropy Gathering Daemon (written in
623c48bdce4SmillertPerl!), available from L<http://www.lothar.com/tech/crypto/>.
624c48bdce4Smillert
625f64b279aSmillert=head1 SunOS 4.x
626f64b279aSmillert
627f64b279aSmillertIn SunOS 4.x you most probably want to use the SunOS ld, /usr/bin/ld,
628f64b279aSmillertsince the more recent versions of GNU ld (like 2.13) do not seem to
629f64b279aSmillertwork for building Perl anymore.  When linking the extensions, the
630f64b279aSmillertGNU ld gets very unhappy and spews a lot of errors like this
631f64b279aSmillert
632f64b279aSmillert  ... relocation truncated to fit: BASE13 ...
633f64b279aSmillert
634f64b279aSmillertand dies.  Therefore the SunOS 4.1 hints file explicitly sets the
63548950c12Ssthenld to be F</usr/bin/ld>.
636f64b279aSmillert
637f64b279aSmillertAs of Perl 5.8.1 the dynamic loading of libraries (DynaLoader, XSLoader)
638f64b279aSmillertalso seems to have become broken in in SunOS 4.x.  Therefore the default
639f64b279aSmillertis to build Perl statically.
640f64b279aSmillert
641f64b279aSmillertRunning the test suite in SunOS 4.1 is a bit tricky since the
642b8851fccSafresh1F<dist/Tie-File/t/09_gen_rs.t> test hangs (subtest #51, FWIW) for some
643f64b279aSmillertunknown reason.  Just stop the test and kill that particular Perl
644f64b279aSmillertprocess.
645f64b279aSmillert
646f64b279aSmillertThere are various other failures, that as of SunOS 4.1.4 and gcc 3.2.2
647f64b279aSmillertlook a lot like gcc bugs.  Many of the failures happen in the Encode
648f64b279aSmillerttests, where for example when the test expects "0" you get "&#48;"
649f64b279aSmillertwhich should after a little squinting look very odd indeed.
650f64b279aSmillertAnother example is earlier in F<t/run/fresh_perl> where chr(0xff) is
651f64b279aSmillertexpected but the test fails because the result is chr(0xff).  Exactly.
652f64b279aSmillert
653f64b279aSmillertThis is the "make test" result from the said combination:
654f64b279aSmillert
655f64b279aSmillert  Failed 27 test scripts out of 745, 96.38% okay.
656f64b279aSmillert
657f64b279aSmillertRunning the C<harness> is painful because of the many failing
658f64b279aSmillertUnicode-related tests will output megabytes of failure messages,
659f64b279aSmillertbut if one patiently waits, one gets these results:
660f64b279aSmillert
661f64b279aSmillert Failed Test                     Stat Wstat Total Fail  Failed  List of Failed
662f64b279aSmillert -----------------------------------------------------------------------------
663f64b279aSmillert ...
664f64b279aSmillert ../ext/Encode/t/at-cn.t            4  1024    29    4  13.79%  14-17
665f64b279aSmillert ../ext/Encode/t/at-tw.t           10  2560    17   10  58.82%  2 4 6 8 10 12
666f64b279aSmillert                                                                14-17
667f64b279aSmillert ../ext/Encode/t/enc_data.t        29  7424    ??   ??       %  ??
668f64b279aSmillert ../ext/Encode/t/enc_eucjp.t       29  7424    ??   ??       %  ??
669f64b279aSmillert ../ext/Encode/t/enc_module.t      29  7424    ??   ??       %  ??
670f64b279aSmillert ../ext/Encode/t/encoding.t        29  7424    ??   ??       %  ??
671f64b279aSmillert ../ext/Encode/t/grow.t            12  3072    24   12  50.00%  2 4 6 8 10 12 14
672f64b279aSmillert                                                                16 18 20 22 24
673f64b279aSmillert  Failed Test                     Stat Wstat Total Fail  Failed  List of Failed
674f64b279aSmillert ------------------------------------------------------------------------------
675f64b279aSmillert ../ext/Encode/t/guess.t          255 65280    29   40 137.93%  10-29
676f64b279aSmillert ../ext/Encode/t/jperl.t           29  7424    15   30 200.00%  1-15
677f64b279aSmillert ../ext/Encode/t/mime-header.t      2   512    10    2  20.00%  2-3
678f64b279aSmillert ../ext/Encode/t/perlio.t          22  5632    38   22  57.89%  1-4 9-16 19-20
679f64b279aSmillert                                                                23-24 27-32
680f64b279aSmillert ../ext/List/Util/t/shuffle.t       0   139    ??   ??       %  ??
681f64b279aSmillert ../ext/PerlIO/t/encoding.t                    14    1   7.14%  11
682f64b279aSmillert ../ext/PerlIO/t/fallback.t                     9    2  22.22%  3 5
683f64b279aSmillert ../ext/Socket/t/socketpair.t       0     2    45   70 155.56%  11-45
684f64b279aSmillert ../lib/CPAN/t/vcmp.t                          30    1   3.33%  25
685f64b279aSmillert ../lib/Tie/File/t/09_gen_rs.t      0    15    ??   ??       %  ??
686f64b279aSmillert ../lib/Unicode/Collate/t/test.t              199   30  15.08%  7 26-27 71-75
687f64b279aSmillert                                                                81-88 95 101
688f64b279aSmillert                                                                103-104 106 108-
689f64b279aSmillert                                                                109 122 124 161
690f64b279aSmillert                                                                169-172
691f64b279aSmillert ../lib/sort.t                      0   139   119   26  21.85%  107-119
692f64b279aSmillert op/alarm.t                                     4    1  25.00%  4
693f64b279aSmillert op/utfhash.t                                  97    1   1.03%  31
694f64b279aSmillert run/fresh_perl.t                              91    1   1.10%  32
695f64b279aSmillert uni/tr_7jis.t                                 ??   ??       %  ??
696f64b279aSmillert uni/tr_eucjp.t                    29  7424     6   12 200.00%  1-6
697f64b279aSmillert uni/tr_sjis.t                     29  7424     6   12 200.00%  1-6
698f64b279aSmillert 56 tests and 467 subtests skipped.
699b8851fccSafresh1 Failed 27/811 test scripts, 96.67% okay. 1383/75399 subtests failed,
700b8851fccSafresh1   98.17% okay.
701f64b279aSmillert
702f64b279aSmillertThe alarm() test failure is caused by system() apparently blocking
703f64b279aSmillertalarm().  That is probably a libc bug, and given that SunOS 4.x
704f64b279aSmillerthas been end-of-lifed years ago, don't hold your breath for a fix.
705f64b279aSmillertIn addition to that, don't try anything too Unicode-y, especially
706f64b279aSmillertwith Encode, and you should be fine in SunOS 4.x.
707f64b279aSmillert
708c48bdce4Smillert=head1 AUTHOR
709c48bdce4Smillert
710c48bdce4SmillertThe original was written by Andy Dougherty F<doughera@lafayette.edu>
711c48bdce4Smillertdrawing heavily on advice from Alan Burlison, Nick Ing-Simmons, Tim Bunce,
712c48bdce4Smillertand many other Solaris users over the years.
713c48bdce4Smillert
71498dafc01Safresh1Please report any errors, updates, or suggestions to
71598dafc01Safresh1L<https://github.com/Perl/perl5/issues>.
716