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

NAME

6       perlmacosx - Perl under Mac OS X
7

SYNOPSIS

9       This document briefly describes Perl under Mac OS X.
10
11         curl http://www.cpan.org/src/perl-5.12.3.tar.gz > perl-5.12.3.tar.gz
12         tar -xzf perl-5.12.3.tar.gz
13         cd perl-5.12.3
14         ./Configure -des -Dprefix=/usr/local/
15         make
16         make test
17         sudo make install
18

DESCRIPTION

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

Starting From Scratch

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

AUTHOR

235       This README was written by Sherm Pendley <sherm@dot-app.org>, and
236       subsequently updated by Dominic Dunlop <domo@computer.org>.  The
237       "Starting From Scratch" recipe was contributed by John Montbriand
238       <montbriand@apple.com>.
239

DATE

241       Last modified 2006-02-24.
242
243
244
245perl v5.16.3                      2013-03-04                     PERLMACOSX(1)
Impressum