Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Mac::Carbon et.c on Mac OS X 10.8

by luis.roca (Deacon)
on Feb 22, 2013 at 23:18 UTC ( #1020245=note: print w/ replies, xml ) Need Help??

in reply to Mac::Carbon et.c on Mac OS X 10.8

I honestly don't know why they shipped these modules with Mountain Lion. As far as I can tell, they have not been updated for a few years (Possibly since Tiger) and were not included in the last few versions of OSX for what I can assume are those very reasons you mentioned. At least with Mac::Carbon the documentation states there are significant portions of the Carbon API that are unavailable to programs on Mac OSX (See 64-Bit Perl section). Quickly looking at Mac::Glue seems to indicate some conflicts as well.

If you're looking to work with the Finder and other applications on the Mac, I would stick with AppleScript and combine it with Perl shell scripts. You can call one from the other. They pair well together from what I remember. Check out the Mac Developer library on how as well as Oreilly's AppleScript The Definitive Guide has some, dated, but good examples if you sift through them. If you'll be working often this way, it may be worth a few bucks for you to get the excellent ScriptDebugger which takes a lot of the headaches out of grokking each software's particular flavor of AppleScript.

I don't want to discourage you from a separate install of Perl. That's not a bad idea and often recommended but I don't think it will help you with this particular issue. To download and maintain a separate install on the Mac, I use Macports.

Good luck :)

"...the adversities born of well-placed thoughts should be considered mercies rather than misfortunes." Don Quixote

Comment on Re: Mac::Carbon et.c on Mac OS X 10.8
Re^2: Mac::Carbon et.c on Mac OS X 10.8
by kwalker (Novice) on Feb 23, 2013 at 02:07 UTC

    Thanks, that's helpful.

    Before posting here I had already tried rebuilding Mac::Glue (as suggested in the first response to my original question), but without any luck. I was planning on next building my own perl, but then I began to suspect that the problem was more fundamental and could not be fixed by tweaking the build parameters.

    Perl (v5.12.4) claims to be bi-architectural:

    [kw|~] file /usr/bin/perl /usr/bin/perl: Mach-O universal binary with 2 architectures /usr/bin/perl (for architecture i386): Mach-O executable i386 /usr/bin/perl (for architecture x86_64): Mach-O 64-bit executable x +86_64
    The module I want to use is 32-bit i386:
    [kw|~] lipo -info /System/Library/Perl/Extras/5.12/darwin-thread-multi +-2level/auto/MacPerl/MacPerl.bundle Non-fat file: /System/Library/Perl/Extras/5.12/darwin-thread-multi-2le +vel/auto/MacPerl/MacPerl.bundle is architecture: i386
    But things fail anyway:
    [kw|~] perl -ce 'use Mac::Glue' Can't load '/System/Library/Perl/Extras/5.12/darwin-thread-multi-2leve +l/auto/MacPerl/MacPerl.bundle' for module MacPerl: dlopen(/System/Lib +rary/Perl/Extras/5.12/darwin-thread-multi-2level/auto/MacPerl/MacPerl +.bundle, 1): no suitable image found. Did find: /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level/auto/M +acPerl/MacPerl.bundle: mach-o, but wrong architecture at /System/Libr +ary/Perl/5.12/darwin-thread-multi-2level/ line 204. at /System/Library/Perl/Extras/5.12/Mac/Glue/ line 21 Compilation failed in require at /System/Library/Perl/Extras/5.12/Mac/ +Glue/ line 21. BEGIN failed--compilation aborted at /System/Library/Perl/Extras/5.12/ +Mac/Glue/ line 21. Compilation failed in require at /System/Library/Perl/Extras/5.12/Mac/ line 7. BEGIN failed--compilation aborted at /System/Library/Perl/Extras/5.12/ +Mac/ line 7. Compilation failed in require at -e line 1. BEGIN failed--compilation aborted at -e line 1.
    I'm guessing that I'm out of luck, since the OS is 64-bit and Mac::Glue will only build as 32-bit (since it depends on the Carbon API). But I'm a novice on these architecture compatibility issues, so if someone wants to authoritatively confirm that I'm out of luck I would appreciate it.

      The short answer would be no.

      From perlmacosx (specifically that last paragraph)

      Support for 64-bit addressing is experimental: some aspects of Perl ma +y be omitted or buggy. Note the messages output by Configure for fur +ther information. Please use "perlbug" to submit a problem report in th +e event that you encounter difficulties. When building 64-bit modules, it is your responsiblity to ensure t +hat linked external libraries and frameworks provide 64-bit support: i +f they do not, module building may appear to succeed, but attempts to use + the module will result in run-time dynamic linking errors, and subsequ +ent test failures. You can use "file" to discover the architectures supported by a library: $ file libgdbm.3.0.0.dylib libgdbm.3.0.0.dylib: Mach-O fat file with 2 architectures libgdbm.3.0.0.dylib (for architecture ppc): Mach-O dynami +cally linked shared library ppc libgdbm.3.0.0.dylib (for architecture ppc64): Mach-O 64-bit + dynamically linked shared library ppc64 Note that this issue precludes the building of many Macintosh-spec +ific CPAN modules ("Mac::*"), as the required Apple frameworks do not p +rovide PPC64 support. Similarly, downloads from Fink or Darwinports are unlikely to provide 64-bit support; the libraries must be rebuilt +from source with the appropriate compiler and linker flags. For further information, see Apple's *64-Bit Transition Guide* at < +orting /index.html>.

      That last link no longer works and redirects you to a menu. Here's the updated page if you're interested:

      "...the adversities born of well-placed thoughts should be considered mercies rather than misfortunes." Don Quixote

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020245]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2014-08-30 06:11 GMT
Find Nodes?
    Voting Booth?

    The best computer themed movie is:

    Results (291 votes), past polls