Note that there are some explanatory texts on larger screens.

plurals
  1. POBuilding Perl for OS X - Architecture-Specific Compile Options
    primarykey
    data
    text
    <p>Thanks to a suggestion from <a href="https://stackoverflow.com/users/78259/chas-owens">Chas. Owens</a>, I have been having fun playing with <a href="http://search.cpan.org/~gugod/App-perlbrew-0.10/lib/App/perlbrew.pm" rel="nofollow noreferrer">Perlbrew</a> to have various Perl builds in my home directory. My question is more generally on building a newer Perl under OS X however. </p> <p>I have OS X 10.6.4 Snow Leopard running on a very recent MacBook Pro. After a <a href="https://stackoverflow.com/questions/1810327/cant-use-gcc-in-os-x-terminal">small diversion</a> getting gcc properly setup under Snow Leopard, I have built and run Perl 5.12.1 in my home directory just using the default options. It passes the Perl test harness. </p> <p>Perlbrew allows Perl to be built with OS and platform specific flags. These are the <code>-D -U -A</code> options to the Perl configure script. The <a href="http://perldoc.perl.org/perlmacosx.html" rel="nofollow noreferrer">perlmacosx</a> read me file hasn't been updated in 4 years, so that is not very helpful anymore.</p> <p>I am tempted to just ape Apple's switches used in the system Perl v 5.10.0 (which you can be seen for your particular Perl by typing <code>[path_to_specific_perl]/perl -V</code> or <code>/usr/bin/perl</code> for the system in most cases...) Other than the <code>-Dprefix=/usr</code> which would be different for a different root for the new Perl build, what should I use?</p> <p>(eyeballing) Here are the main <strong>differences</strong> between the Apple compilation options and the default: </p> <pre><code>config_args: Apple: -ds -e Default: -de -D: ======================= Apple: useithreads=define, usemultiplicity=define Default: useithreads=undef, usemultiplicity=undef Compiler: ================= Apple: optimize='-Os' Default: optimize='-O3' Apple: -arch x86_64 -arch i386 -arch ppc Default: none specified Apple: -g -pipe Default these optimizations are not set Apple not set Default -no-cpp-precomp Linker: ================ Apple: useshrplib=true, libperl=libperl.dylib Default: useshrplib=false, libperl=libperl.a Characteristics of libperl: ============= Apple MULTIPLICITY PERL_IMPLICIT_CONTEXT USE_ITHREADS USE_REENTRANT_API Default PERL_MALLOC_WRAP USE_PERL_ATOF </code></pre> <p>Another difference is the Apple Perl libperl is a dynaloader, the default build is statically linked. </p> <p>So, <strong>questions</strong>: </p> <ol> <li>Which <code>-D -U -A</code> switches should I use to build a local copy of Perl on OS X 10.6+? I don't think I need a fat binary like the Apple version, and I don't know if I should do a dynaloader version. Mainly I am looking for the suggested switches for optimization and suggested characteristics of resulting libperl.</li> <li>Should I do a dynaloader version? (ie, in the OS X sense of <a href="http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/OverviewOfDynamicLibraries.html#//apple_ref/doc/uid/TP40001873-SW1" rel="nofollow noreferrer">Dynamic Libraries</a>...)</li> <li>The system Perl is <code>/usr/bin/perl</code> and I don't want to change it. Do I change the sheebang in scripts to point to the Perlbrew version of Perl? That means my sheebang would be `/Users/andrew/perl5/perl.' Do I change my path to point there? What are others doing in this regard? What is considered "best practice"?</li> <li>When I run Perlbrew, I get the warning <code>v-string in use/require non-portable at ./perlbrew line 818.</code> Line 818 in Perlbrew is <code>use 5.8.0;</code> Shouldn't that line be <code>use 5.008_000</code>? </li> </ol> <p><strong>Edit</strong></p> <p>Thanks to Jonathan Leffler, I least had some Perls to look at. Rather than get too deep into it, I just took the defaults in most cases, added threads, and it seems to work OK. Now I have Perlbrew's installed with several Perl and I have left the system Perl at 5.10. I use <code>/usr/bin/env perl</code> on the sheebang to have future-proofish code.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload