Thursday, December 30, 2010

dyld: unknown required load command 0x80000022 starting Firefox (and others) on Mac OS X 10.5

If you get a message like this when running a Mozilla application on Leopard:
dyld: unknown required load command 0x80000022
Trace/BPT trap
...chances are the system tries to run a build intended for Snow Leopard.

A workaround you could try is to run Terminal.app and use the arch command like this:

arch -i386 /Applications/Firefox.app/Contents/MacOS/firefox-bin

(Substitute /Application/Firefox.app with the location of the app, and use the name of the executable (ending with -bin) instead of firefox-bin as necessary.)

As with any other command you can create a launcher icon for the command easily.

This should apply to newer Mozilla-based applications: Firefox 4 (including Minefield builds since Oct 2010), Thunderbird post 3.2, BlueGriffon, and future versions of other applications based on Mozilla 2 (Komodo, Songbird, etc.)

Technical details

If the workaround works for you, the application is a i386/x86_64 universal binary. The x86_64 part of the application uses 10.6-specific features, so it can't run on 10.5; the i386 binary is intended for 10.5.

The cause of the error message is that the wrong architecture is selected for some reason. This happened to me when trying to run such an executable directly from the command line (technical details are in this Mozilla bug).

Stripping x86_64 part from the binary

This tip is brought to you by JW from the comments (via jarib from github): if you don't control the command line command used to start Firefox, you can instead strip the x86_64 part from firefox-bin using ditto:

cd /Applications/Firefox.app/Contents/MacOS
mv firefox-bin firefox-bin.original
ditto --arch i386 firefox-bin.original firefox-bin

Warning: with this workaround (unlike when running via arch) you will stop receiving Firefox updates and this change will have to be re-applied each time you update Firefox manually.

6 comments:

  1. Thank you very much for this helpful post!

    ReplyDelete
  2. Try this on OSX 10.5:
    ditto --arch i386 firefox-bin.original firefox-bin

    It was suggested here:
    https://github.com/jnicklas/capybara/issues/313/#comment_950014

    ReplyDelete
  3. Oddly, I only had this problem when attempting to load Firefox with a command-line argument (such as loading a different profile or the profile manager. When loading firefox with no command-line arguments, it loaded fine.

    Many thanks for taking the time to post this information!

    ReplyDelete
  4. If you receive this error, the application was incorrectly built on OS X 10.6 machine for a 10.5 machine. The developer can fix this by considering three things:

    1. Using the correct compiler parameters:
    gcc-4.2 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk ...

    2. Using the correct linker settings (setting environment variable before link command). This is required, so that the OS X 10.6 linker will not use the loader command 'LC_DYLD_INFO_ONLY' (=0x80000022), because OS X 10.5 does not understand this command:

    export MACOSX_DEPLOYMENT_TARGET=10.5
    (or setenv MACOSX_DEPLOYMENT_TARGET=10.5)

    After this is fixed, one can check if the application was correctly built for OS X 10.5 by running 'otool':

    otool -l binary

    The correct binary should not contain any 'LC_DYLD_INFO_ONLY' load commands (only 'LC_DYLD_INFO' commands).

    (also see my blog article http://grauonline.de/wordpress/?p=71 )

    ReplyDelete
  5. Awesome--thanks for this solution.

    ReplyDelete
  6. Awesome, thanks! --Simon Smith, Arcode

    ReplyDelete