Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

526 lines
20 KiB

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