简体   繁体   中英

How to make a fortran executable that runs on Mac OS X 10.5 and 10.6

I'd like to compile a fortran code with gfortran so that it will work on both Mac OS X 10.5 and 10.6. Is there a way to do this? I tried compiling on 10.6 and get this message when I run the executable on 10.5:

dyld: unknown required load command 0x80000022 Trace/BPT trap

What version of 10.5 are you on? According to this (0x22) is a dynamic load function that got added at 10.5.6. You could try upgrading to >10.5.6 and see if the problem persists.

Also where did you get your gfortran from? In the numpy community the ones from att.com are highly recommended and the builds from hpc are generally to be avoided .

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:

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

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 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM