Debian Codegraph @

upstream/mageia-cauldron/man1/perlmacosx.1

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "PERLMACOSX 1"
61 .TH PERLMACOSX 1 2025-06-24 "perl v5.42.0" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 perlmacosx \- Perl under Mac OS X
68 .SH SYNOPSIS
69 .IX Header "SYNOPSIS"
70 This document briefly describes Perl under Mac OS X.
71 .PP
72 .Vb 7
73 \& curl \-O https://www.cpan.org/src/perl\-5.42.0.tar.gz
74 \& tar \-xzf perl\-5.42.0.tar.gz
75 \& cd perl\-5.42.0
76 \& ./Configure \-des \-Dprefix=/usr/local/
77 \& make
78 \& make test
79 \& sudo make install
80 .Ve
81 .SH DESCRIPTION
82 .IX Header "DESCRIPTION"
83 The latest Perl release (5.42.0 as of this writing) builds without changes
84 under all versions of Mac OS X from 10.3 "Panther" onwards.
85 .PP
86 In order to build your own version of Perl you will need \*(Aqmake\*(Aq,
87 which is part of Apple\*(Aqs developer tools \- also known as Xcode. From
88 Mac OS X 10.7 "Lion" onwards, it can be downloaded separately as the
89 \&\*(AqCommand Line Tools\*(Aq bundle directly from <https://developer.apple.com/downloads/>
90 (you will need a free account to log in), or as a part of the Xcode suite,
91 freely available at the App Store. Xcode is a pretty big app, so
92 unless you already have it or really want it, you are advised to get the
93 \&\*(AqCommand Line Tools\*(Aq bundle separately from the link above. If you want
94 to do it from within Xcode, go to Xcode \-> Preferences \-> Downloads and
95 select the \*(AqCommand Line Tools\*(Aq option.
96 .PP
97 Between Mac OS X 10.3 "Panther" and 10.6 "Snow Leopard", the \*(AqCommand
98 Line Tools\*(Aq bundle was called \*(Aqunix tools\*(Aq, and was usually supplied
99 with Mac OS install DVDs.
100 .PP
101 Earlier Mac OS X releases (10.2 "Jaguar" and older) did not include a
102 completely thread\-safe libc, so threading is not fully supported. Also,
103 earlier releases included a buggy libdb, so some of the DB_File tests
104 are known to fail on those releases.
105 .SS "Installation Prefix"
106 .IX Subsection "Installation Prefix"
107 The default installation location for this release uses the traditional
108 UNIX directory layout under /usr/local. This is the recommended location
109 for most users, and will leave the Apple\-supplied Perl and its modules
110 undisturbed.
111 .PP
112 Using an installation prefix of \*(Aq/usr\*(Aq will result in a directory layout
113 that mirrors that of Apple\*(Aqs default Perl, with core modules stored in
114 \&\*(Aq/System/Library/Perl/${version}\*(Aq, CPAN modules stored in
115 \&\*(Aq/Library/Perl/${version}\*(Aq, and the addition of
116 \&\*(Aq/Network/Library/Perl/${version}\*(Aq to \f(CW@INC\fR for modules that are stored
117 on a file server and used by many Macs.
118 .SS "SDK support"
119 .IX Subsection "SDK support"
120 First, export the path to the SDK into the build environment:
121 .PP
122 .Vb 1
123 \& export SDK=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
124 .Ve
125 .PP
126 Please make sure the SDK version (i.e. the numbers right before \*(Aq.sdk\*(Aq)
127 matches your system\*(Aqs (in this case, Mac OS X 10.8 "Mountain Lion"), as it is
128 possible to have more than one SDK installed. Also make sure the path exists
129 in your system, and if it doesn\*(Aqt please make sure the SDK is properly
130 installed, as it should come with the \*(AqCommand Line Tools\*(Aq bundle mentioned
131 above. Finally, if you have an older Mac OS X (10.6 "Snow Leopard" and below)
132 running Xcode 4.2 or lower, the SDK path might be something like
133 \&\f(CW\*(Aq/Developer/SDKs/MacOSX10.3.9.sdk\*(Aq\fR.
134 .PP
135 You can use the SDK by exporting some additions to Perl\*(Aqs \*(Aqccflags\*(Aq and \*(Aq..flags\*(Aq
136 config variables:
137 .PP
138 .Vb 5
139 \& ./Configure \-Accflags="\-nostdinc \-B$SDK/usr/include/gcc \e
140 \& \-B$SDK/usr/lib/gcc \-isystem$SDK/usr/include \e
141 \& \-F$SDK/System/Library/Frameworks" \e
142 \& \-Aldflags="\-Wl,\-syslibroot,$SDK" \e
143 \& \-de
144 .Ve
145 .SS "Universal Binary support"
146 .IX Subsection "Universal Binary support"
147 Note: From Mac OS X 10.6 "Snow Leopard" onwards, Apple only supports
148 Intel\-based hardware. This means you can safely skip this section unless
149 you have an older Apple computer running on ppc or wish to create a perl
150 binary with backwards compatibility.
151 .PP
152 You can compile perl as a universal binary (built for both ppc and intel).
153 In Mac OS X 10.4 "Tiger", you must export the \*(Aqu\*(Aq variant of the SDK:
154 .PP
155 .Vb 1
156 \& export SDK=/Developer/SDKs/MacOSX10.4u.sdk
157 .Ve
158 .PP
159 Mac OS X 10.5 "Leopard" and above do not require the \*(Aqu\*(Aq variant.
160 .PP
161 In addition to the compiler flags used to select the SDK, also add the flags
162 for creating a universal binary:
163 .PP
164 .Vb 6
165 \& ./Configure \-Accflags="\-arch i686 \-arch ppc \-nostdinc \e
166 \& \-B$SDK/usr/include/gcc \e
167 \& \-B$SDK/usr/lib/gcc \-isystem$SDK/usr/include \e
168 \& \-F$SDK/System/Library/Frameworks" \e
169 \& \-Aldflags="\-arch i686 \-arch ppc \-Wl,\-syslibroot,$SDK" \e
170 \& \-de
171 .Ve
172 .PP
173 Keep in mind that these compiler and linker settings will also be used when
174 building CPAN modules. For XS modules to be compiled as a universal binary, any
175 libraries it links to must also be universal binaries. The system libraries that
176 Apple includes with the 10.4u SDK are all universal, but user\-installed libraries
177 may need to be re\-installed as universal binaries.
178 .SS "64\-bit PPC support"
179 .IX Subsection "64-bit PPC support"
180 Follow the instructions in \fIINSTALL\fR to build perl with support for 64\-bit
181 integers (\f(CW\*(C`use64bitint\*(C'\fR) or both 64\-bit integers and 64\-bit addressing
182 (\f(CW\*(C`use64bitall\*(C'\fR). In the latter case, the resulting binary will run only
183 on G5\-based hosts.
184 .PP
185 Support for 64\-bit addressing is experimental: some aspects of Perl may be
186 omitted or buggy. Note the messages output by \fIConfigure\fR for further
187 information. Please use <https://github.com/Perl/perl5/issues> to submit a
188 problem report in the event that you encounter difficulties.
189 .PP
190 When building 64\-bit modules, it is your responsibility to ensure that linked
191 external libraries and frameworks provide 64\-bit support: if they do not,
192 module building may appear to succeed, but attempts to use the module will
193 result in run\-time dynamic linking errors, and subsequent test failures.
194 You can use \f(CW\*(C`file\*(C'\fR to discover the architectures supported by a library:
195 .PP
196 .Vb 4
197 \& $ file libgdbm.3.0.0.dylib
198 \& libgdbm.3.0.0.dylib: Mach\-O fat file with 2 architectures
199 \& libgdbm.3.0.0.dylib (for architecture ppc): Mach\-O dynamically linked shared library ppc
200 \& libgdbm.3.0.0.dylib (for architecture ppc64): Mach\-O 64\-bit dynamically linked shared library ppc64
201 .Ve
202 .PP
203 Note that this issue precludes the building of many Macintosh\-specific CPAN
204 modules (\f(CW\*(C`Mac::*\*(C'\fR), as the required Apple frameworks do not provide PPC64
205 support. Similarly, downloads from Fink or Darwinports are unlikely to provide
206 64\-bit support; the libraries must be rebuilt from source with the appropriate
207 compiler and linker flags. For further information, see Apple\*(Aqs
208 \&\fI64\-Bit Transition Guide\fR at
209 <https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/64bitPorting/transition/transition.html>.
210 .SS "libperl and Prebinding"
211 .IX Subsection "libperl and Prebinding"
212 Mac OS X ships with a dynamically\-loaded libperl, but the default for
213 this release is to compile a static libperl. The reason for this is
214 pre\-binding. Dynamic libraries can be pre\-bound to a specific address in
215 memory in order to decrease load time. To do this, one needs to be aware
216 of the location and size of all previously\-loaded libraries. Apple
217 collects this information as part of their overall OS build process, and
218 thus has easy access to it when building Perl, but ordinary users would
219 need to go to a great deal of effort to obtain the information needed
220 for pre\-binding.
221 .PP
222 You can override the default and build a shared libperl if you wish
223 (Configure\ ...\ \-Duseshrplib).
224 .PP
225 With Mac OS X 10.4 "Tiger" and newer, there is almost no performance
226 penalty for non\-prebound libraries. Earlier releases will suffer a greater
227 load time than either the static library, or Apple\*(Aqs pre\-bound dynamic library.
228 .SS "Updating Apple\*(Aqs Perl"
229 .IX Subsection "Updating Apple's Perl"
230 In a word \- don\*(Aqt, at least not without a *very* good reason. Your scripts
231 can just as easily begin with "#!/usr/local/bin/perl" as with
232 "#!/usr/bin/perl". Scripts supplied by Apple and other third parties as
233 part of installation packages and such have generally only been tested
234 with the /usr/bin/perl that\*(Aqs installed by Apple.
235 .PP
236 If you find that you do need to update the system Perl, one issue worth
237 keeping in mind is the question of static vs. dynamic libraries. If you
238 upgrade using the default static libperl, you will find that the dynamic
239 libperl supplied by Apple will not be deleted. If both libraries are
240 present when an application that links against libperl is built, ld will
241 link against the dynamic library by default. So, if you need to replace
242 Apple\*(Aqs dynamic libperl with a static libperl, you need to be sure to
243 delete the older dynamic library after you\*(Aqve installed the update.
244 .SS "Known problems"
245 .IX Subsection "Known problems"
246 If you have installed extra libraries such as GDBM through Fink
247 (in other words, you have libraries under \fI/sw/lib\fR), or libdlcompat
248 to \fI/usr/local/lib\fR, you may need to be extra careful when running
249 Configure to not to confuse Configure and Perl about which libraries
250 to use. Being confused will show up for example as "dyld" errors about
251 symbol problems, for example during "make test". The safest bet is to run
252 Configure as
253 .PP
254 .Vb 1
255 \& Configure ... \-Uloclibpth \-Dlibpth=/usr/lib
256 .Ve
257 .PP
258 to make Configure look only into the system libraries. If you have some
259 extra library directories that you really want to use (such as newer
260 Berkeley DB libraries in pre\-Panther systems), add those to the libpth:
261 .PP
262 .Vb 1
263 \& Configure ... \-Uloclibpth \-Dlibpth=\*(Aq/usr/lib /opt/lib\*(Aq
264 .Ve
265 .PP
266 The default of building Perl statically may cause problems with complex
267 applications like Tk: in that case consider building shared Perl
268 .PP
269 .Vb 1
270 \& Configure ... \-Duseshrplib
271 .Ve
272 .PP
273 but remember that there\*(Aqs a startup cost to pay in that case (see above
274 "libperl and Prebinding").
275 .PP
276 Starting with Tiger (Mac OS X 10.4), Apple shipped broken locale files for
277 the eu_ES locale (Basque\-Spain). In previous releases of Perl, this resulted in
278 failures in the \fIlib/locale\fR test. These failures have been suppressed
279 in the current release of Perl by making the test ignore the broken locale.
280 If you need to use the eu_ES locale, you should contact Apple support.
281 .SS Cocoa
282 .IX Subsection "Cocoa"
283 There are two ways to use Cocoa from Perl. Apple\*(Aqs PerlObjCBridge
284 module, included with Mac OS X, can be used by standalone scripts to
285 access Foundation (i.e. non\-GUI) classes and objects.
286 .PP
287 An alternative is CamelBones, a framework that allows access to both
288 Foundation and AppKit classes and objects, so that full GUI applications
289 can be built in Perl. CamelBones can be found on SourceForge, at
290 <https://www.sourceforge.net/projects/camelbones/>.
291 .SH "Starting From Scratch"
292 .IX Header "Starting From Scratch"
293 Unfortunately it is not that difficult somehow manage to break one\*(Aqs
294 Mac OS X Perl rather severely. If all else fails and you want to
295 really, \fBREALLY\fR, start from scratch and remove even your Apple Perl
296 installation (which has become corrupted somehow), the following
297 instructions should do it. \fBPlease think twice before following
298 these instructions: they are much like conducting brain surgery to
299 yourself. Without anesthesia.\fR We will \fBnot\fR come to fix your system
300 if you do this.
301 .PP
302 First, get rid of the libperl.dylib:
303 .PP
304 .Vb 2
305 \& # cd /System/Library/Perl/darwin/CORE
306 \& # rm libperl.dylib
307 .Ve
308 .PP
309 Then delete every .bundle file found anywhere in the folders:
310 .PP
311 .Vb 2
312 \& /System/Library/Perl
313 \& /Library/Perl
314 .Ve
315 .PP
316 You can find them for example by
317 .PP
318 .Vb 1
319 \& # find /System/Library/Perl /Library/Perl \-name \*(Aq*.bundle\*(Aq \-print
320 .Ve
321 .PP
322 After this you can either copy Perl from your operating system media
323 (you will need at least the /System/Library/Perl and /usr/bin/perl),
324 or rebuild Perl from the source code with \f(CW\*(C`Configure \-Dprefix=/usr
325 \&\-Duseshrplib\*(C'\fR NOTE: the \f(CW\*(C`\-Dprefix=/usr\*(C'\fR to replace the system Perl
326 works much better with Perl 5.8.1 and later, in Perl 5.8.0 the
327 settings were not quite right.
328 .PP
329 "Pacifist" from CharlesSoft (<https://www.charlessoft.com/>) is a nice
330 way to extract the Perl binaries from the OS media, without having to
331 reinstall the entire OS.
332 .SH AUTHOR
333 .IX Header "AUTHOR"
334 This README was written by Sherm Pendley <sherm@dot\-app.org>,
335 and subsequently updated by Dominic Dunlop <[email protected]>
336 and Breno G. de Oliveira <[email protected]>. The "Starting From Scratch"
337 recipe was contributed by John Montbriand <[email protected]>.
338 .SH DATE
339 .IX Header "DATE"
340 Last modified 2013\-04\-29.