1PERLMACOSX(1)          Perl Programmers Reference Guide          PERLMACOSX(1)
2
3
4

NAME

6       README.macosx - Perl under Mac OS X
7

SYNOPSIS

9       This document briefly describes perl under Mac OS X.
10

DESCRIPTION

12       The latest Perl release (5.8.8 as of this writing) builds without
13       changes under Mac OS X. Under 10.3 "Panther" and newer OS versions, all
14       self-tests pass, and all standard features are supported.
15
16       Earlier Mac OS X releases (10.2 "Jaguar" and older) did not include a
17       completely thread-safe libc, so threading is not fully supported. Also,
18       earlier releases included a buggy libdb, so some of the DB_File tests
19       are known to fail on those releases.
20
21   Installation Prefix
22       The default installation location for this release uses the traditional
23       UNIX directory layout under /usr/local. This is the recommended
24       location for most users, and will leave the Apple-supplied Perl and its
25       modules undisturbed.
26
27       Using an installation prefix of '/usr' will result in a directory
28       layout that mirrors that of Apple's default Perl, with core modules
29       stored in '/System/Library/Perl/${version}', CPAN modules stored in
30       '/Library/Perl/${version}', and the addition of
31       '/Network/Library/Perl/${version}' to @INC for modules that are stored
32       on a file server and used by many Macs.
33
34   SDK support
35       First, export the path to the SDK into the build environment:
36
37           export SDK=/Developer/SDKs/MacOSX10.3.9.sdk
38
39       Use an SDK by exporting some additions to Perl's 'ccflags' and
40       '..flags' config variables:
41
42           ./Configure -Accflags="-nostdinc -B$SDK/usr/include/gcc \
43                                  -B$SDK/usr/lib/gcc -isystem$SDK/usr/include \
44                                  -F$SDK/System/Library/Frameworks" \
45                       -Aldflags="-Wl,-syslibroot,$SDK" \
46                       -de
47
48   Universal Binary support
49       To compile perl as a universal binary (built for both ppc and intel),
50       export the SDK variable as above, selecting the 10.4u SDK:
51
52           export SDK=/Developer/SDKs/MacOSX10.4u.sdk
53
54       In addition to the compiler flags used to select the SDK, also add the
55       flags for creating a universal binary:
56
57           ./Configure -Accflags="-arch i686 -arch ppc -nostdinc -B$SDK/usr/include/gcc \
58                                  -B$SDK/usr/lib/gcc -isystem$SDK/usr/include \
59                                  -F$SDK/System/Library/Frameworks" \
60                       -Aldflags="-arch i686 -arch ppc -Wl,-syslibroot,$SDK" \
61                       -de
62
63       In Leopard (MacOSX 10.5.6 at the time of this writing) you must use the
64       10.5 SDK:
65
66           export SDK=/Developer/SDKs/MacOSX10.5.sdk
67
68       You can use the same compiler flags you would use with the 10.4u SDK.
69
70       Keep in mind that these compiler and linker settings will also be used
71       when building CPAN modules. For XS modules to be compiled as a
72       universal binary, any libraries it links to must also be universal
73       binaries. The system libraries that Apple includes with the 10.4u SDK
74       are all universal, but user-installed libraries may need to be re-
75       installed as universal binaries.
76
77   64-bit PPC support
78       Follow the instructions in INSTALL to build perl with support for
79       64-bit integers ("use64bitint") or both 64-bit integers and 64-bit
80       addressing ("use64bitall"). In the latter case, the resulting binary
81       will run only on G5-based hosts.
82
83       Support for 64-bit addressing is experimental: some aspects of Perl may
84       be omitted or buggy. Note the messages output by Configure for further
85       information. Please use "perlbug" to submit a problem report in the
86       event that you encounter difficulties.
87
88       When building 64-bit modules, it is your responsiblity to ensure that
89       linked external libraries and frameworks provide 64-bit support: if
90       they do not, module building may appear to succeed, but attempts to use
91       the module will result in run-time dynamic linking errors, and
92       subsequent test failures.  You can use "file" to discover the
93       architectures supported by a library:
94
95           $ file libgdbm.3.0.0.dylib
96           libgdbm.3.0.0.dylib: Mach-O fat file with 2 architectures
97           libgdbm.3.0.0.dylib (for architecture ppc):      Mach-O dynamically linked shared library ppc
98           libgdbm.3.0.0.dylib (for architecture ppc64):    Mach-O 64-bit dynamically linked shared library ppc64
99
100       Note that this issue precludes the building of many Macintosh-specific
101       CPAN modules ("Mac::*"), as the required Apple frameworks do not
102       provide PPC64 support. Similarly, downloads from Fink or Darwinports
103       are unlikely to provide 64-bit support; the libraries must be rebuilt
104       from source with the appropriate compiler and linker flags. For further
105       information, see Apple's 64-Bit Transition Guide at
106       <http://developer.apple.com/documentation/Darwin/Conceptual/64bitPorting/index.html>.
107
108   libperl and Prebinding
109       Mac OS X ships with a dynamically-loaded libperl, but the default for
110       this release is to compile a static libperl. The reason for this is
111       pre-binding. Dynamic libraries can be pre-bound to a specific address
112       in memory in order to decrease load time. To do this, one needs to be
113       aware of the location and size of all previously-loaded libraries.
114       Apple collects this information as part of their overall OS build
115       process, and thus has easy access to it when building Perl, but
116       ordinary users would need to go to a great deal of effort to obtain the
117       information needed for pre-binding.
118
119       You can override the default and build a shared libperl if you wish
120       (Configure ... -Duseshrlib), but the load time on pre-10.4 OS releases
121       will be greater than either the static library, or Apple's pre-bound
122       dynamic library.
123
124       With 10.4 "Tiger" and newer, Apple has all but eliminated the
125       performance penalty for non-prebound libraries.
126
127   Updating Apple's Perl
128       In a word - don't, at least without a *very* good reason. Your scripts
129       can just as easily begin with "#!/usr/local/bin/perl" as with
130       "#!/usr/bin/perl". Scripts supplied by Apple and other third parties as
131       part of installation packages and such have generally only been tested
132       with the /usr/bin/perl that's installed by Apple.
133
134       If you find that you do need to update the system Perl, one issue worth
135       keeping in mind is the question of static vs. dynamic libraries. If you
136       upgrade using the default static libperl, you will find that the
137       dynamic libperl supplied by Apple will not be deleted. If both
138       libraries are present when an application that links against libperl is
139       built, ld will link against the dynamic library by default. So, if you
140       need to replace Apple's dynamic libperl with a static libperl, you need
141       to be sure to delete the older dynamic library after you've installed
142       the update.
143
144   Known problems
145       If you have installed extra libraries such as GDBM through Fink (in
146       other words, you have libraries under /sw/lib), or libdlcompat to
147       /usr/local/lib, you may need to be extra careful when running Configure
148       to not to confuse Configure and Perl about which libraries to use.
149       Being confused will show up for example as "dyld" errors about symbol
150       problems, for example during "make test". The safest bet is to run
151       Configure as
152
153           Configure ... -Uloclibpth -Dlibpth=/usr/lib
154
155       to make Configure look only into the system libraries.  If you have
156       some extra library directories that you really want to use (such as
157       newer Berkeley DB libraries in pre-Panther systems), add those to the
158       libpth:
159
160           Configure ... -Uloclibpth -Dlibpth='/usr/lib /opt/lib'
161
162       The default of building Perl statically may cause problems with complex
163       applications like Tk: in that case consider building shared Perl
164
165           Configure ... -Duseshrplib
166
167       but remember that there's a startup cost to pay in that case (see above
168       "libperl and Prebinding").
169
170       Starting with Tiger (Mac OS X 10.4), Apple shipped broken locale files
171       for the eu_ES locale (Basque-Spain).  In previous releases of Perl,
172       this resulted in failures in the "lib/locale" test. These failures have
173       been supressed in the current release of Perl by making the test ignore
174       the broken locale.  If you need to use the eu_ES locale, you should
175       contact Apple support.
176
177   MacPerl
178       Quite a bit has been written about MacPerl, the Perl distribution for
179       "Classic MacOS" - that is, versions 9 and earlier of MacOS. Because it
180       runs in environment that's very different from that of UNIX, many
181       things are done differently in MacPerl. Modules are installed using a
182       different procedure, Perl itself is built differently, path names are
183       different, etc.
184
185       From the perspective of a Perl programmer, Mac OS X is more like a
186       traditional UNIX than Classic MacOS. If you find documentation that
187       refers to a special procedure that's needed for MacOS that's
188       drastically different from the instructions provided for UNIX, the
189       MacOS instructions are quite often intended for MacPerl on Classic
190       MacOS. In that case, the correct procedure on Mac OS X is usually to
191       follow the UNIX instructions, rather than the MacPerl instructions.
192
193   Carbon
194       MacPerl ships with a number of modules that are used to access the
195       classic MacOS toolbox. Many of these modules have been updated to use
196       Mac OS X's newer "Carbon" toolbox, and are available from CPAN in the
197       "Mac::Carbon" module.
198
199   Cocoa
200       There are two ways to use Cocoa from Perl. Apple's PerlObjCBridge
201       module, included with Mac OS X, can be used by standalone scripts to
202       access Foundation (i.e. non-GUI) classes and objects.
203
204       An alternative is CamelBones, a framework that allows access to both
205       Foundation and AppKit classes and objects, so that full GUI
206       applications can be built in Perl. CamelBones can be found on
207       SourceForge, at <http://www.sourceforge.net/projects/camelbones/>.
208

Starting From Scratch

210       Unfortunately it is not that difficult somehow manage to break one's
211       Mac OS X Perl rather severely.  If all else fails and you want to
212       really, REALLY, start from scratch and remove even your Apple Perl
213       installation (which has become corrupted somehow), the following
214       instructions should do it.  Please think twice before following these
215       instructions: they are much like conducting brain surgery to yourself.
216       Without anesthesia.  We will not come to fix your system if you do
217       this.
218
219       First, get rid of the libperl.dylib:
220
221           # cd /System/Library/Perl/darwin/CORE
222           # rm libperl.dylib
223
224       Then delete every .bundle file found anywhere in the folders:
225
226           /System/Library/Perl
227           /Library/Perl
228
229       You can find them for example by
230
231           # find /System/Library/Perl /Library/Perl -name '*.bundle' -print
232
233       After this you can either copy Perl from your operating system media
234       (you will need at least the /System/Library/Perl and /usr/bin/perl), or
235       rebuild Perl from the source code with "Configure -Dprefix=/usr
236       -Dusershrplib" NOTE: the "-Dprefix=/usr" to replace the system Perl
237       works much better with Perl 5.8.1 and later, in Perl 5.8.0 the settings
238       were not quite right.
239
240       "Pacifist" from CharlesSoft (<http://www.charlessoft.com/>) is a nice
241       way to extract the Perl binaries from the OS media, without having to
242       reinstall the entire OS.
243

AUTHOR

245       This README was written by Sherm Pendley <sherm@dot-app.org>, and
246       subsequently updated by Dominic Dunlop <domo@computer.org>.  The
247       "Starting From Scratch" recipe was contributed by John Montbriand
248       <montbriand@apple.com>.
249

DATE

251       Last modified 2006-02-24.
252
253
254
255perl v5.12.4                      2011-06-07                     PERLMACOSX(1)
Impressum