Problem : I compile a program on a Mac OS X 10.6 system, but run the binary on an older Mac OS X system such as 10.5 or 10.4. The program aborts immediately without starting with error "dyld: unknown required load command 0x80000022"
Environment : Mac OS X, mixed OS versions. Intel Fortran Compiler for Mac OS X, Intel C++ Compiler for Mac OS X
Root Cause :
Generally, if you are targeting your applicaiton to run on multiple versions of Mac OS X, you should use the 'least common denominator' approach of developing on the older OS version. This is because newer version may have extended the base OS API but generally newer versions will maintain backwards compatibility.
Although there is no guarantee for backwards compatibility, if you have a newer version of Mac OS X as your development platform, follow these guidelines:
compile and link with option -static-intel ( for older compilers, -i-static )
Pass linker option: -Wl,-macosx_version_min,10.4
ifort -static-intel -Wl,-macosx_version_min,10.4 ...other options...
icc -static-intel -Wl,-macosx_version_min,10.4 ...other options...
icpc -static-intel -Wl,-macosx_version_min,10.4 ...other options...
The -static-intel will statically link all Intel compiler runtime libraries into your executable so that you will not need these DYLD libraries on the target computer.
The -Wl,-macosx_version_min,10.4 passes the argument -macosx_version_min 10.4
to your ld linker. This tells the linker to create headers and sections for the executable that are backwards compatible to Mac OS X 10.4. Another option might be 10.5. Please read your 'ld' man page or documentation for allowed options.
EXCEPTION: the linker provided with Xcode 4.0.1 on Snow Leopard is rejecting the -macosx_version_min option, although it is documented in the 'ld' man page. We believe this is a recent bug in the Apple linker and hope that it is addressed shortly ( Apr 2011 )