How to create a 32-bit Perl 5.12.3 build in / usr / local on Mac OS X Snow Leopard?

For one reason or another, we need to create a custom 32-bit Perl 5.12.3 build in / usr / local on Mac OS X Snow Leopard.

Can someone explain the process or indicate the direction of the textbook or example?

+1
source share
3 answers

In Snowleopard, the kernel runs in 32-bit mode, and the user interface is mostly in 64-bit mode. The kernel can run 32-bit and 64-bit user applications without problems. You need to tell the perl build system to create only a 32-bit binary. This is done by setting the -arch gcc flag.

For a simple single-file application, you will do this as follows:

  gcc -arch i386 -o app app.m -lobjc -framework CoreFoundation -framework Cocoa

In your case, you need to pass the arch flag to the build system. I am not a perl expert, but I would configure perl as follows:

  ./Configure -Dprefix = / usr / local -A ccflags = "- arch i386"
+1
source

If your system does not support 64-bit kernel extensions, you should simply build Perl directly from the source and pass DESTDIR = / usr / local on the make install command line. If the system is in 64-bit mode, you need to see how to cross-compile the i386, which I shouldn't have done before, as I just create perl for my own architecture or install from a package.

0
source

Here's how I did it with Perlbrew:

  • Install Perlbrew
  • Make sure you follow all the correct steps, including adding bits to the end of .bash_profile .
  • Run the following (for perl 5.14.2, with a stream. Adjust as needed for other versions and parameters of perl) (Thanks to WildPerl for this piece of wisdom):

    perlbrew install 5.14.2 -ders -Dusethreads -Duseithreads -Accflags = "- arch i386" -Accflags = "- B / Developer / SDK / MacOSX10.6.sdk / usr / include / gcc" -Accflags = "- B / Developer /SDK/MacOSX10.6.sdk/usr/lib/gcc "-Accflags =" - isystem / Developer / SDK / MacOSX10.6.sdk / usr / include "-Accflags =" - F / Developer / SDK / MacOSX10.6 .sdk / System / Library / Frameworks "-Accflags =" - mmacosx-version-min = 10.5 "-Aldflags =" - arch i386 -Wl, -search_paths_first "-Aldflags =" - Wl, -syslibroot, / Developer / SDKs / MacOSX10.6.sdk "-Aldflags =" - mmacosx-version-min = 10.5 "-Alddlflags =" - arch i386 -Wl, -search_paths_first "-Alddlflags =" - Wl, -syslibroot, / Developer / SDK / MacOSX10.6 .sdk "-Alddlflags =" - mmacosx-version-min = 10.5 "-Duseshrplib

  • If you have a newer version of Xcode with the Developer SDK as part of the application package, you need to create a symbolic link for them from / Developer:

    sudo ln -s / Applications / Xcode.app / Contents / Developer / Platforms / MacOSX.platform / Developer // Developer

  • Install a local copy of cpanm:

    perlbrew install-cpanm

  • After that, go to the place where perlbrew installed perl (on my system: ~/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/darwin-thread-multi-2level/ and edited Config.pm to change this line:

    cc => 'cc',

:

 cc => 'cc -m32', 
0
source

Source: https://habr.com/ru/post/978834/


All Articles