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