![]() The GCC Fortran compiler I built from source didn't support the use of the -arch compile flag. Do GCC provide backwards compatibility with Apple's (forks of?) GCC? I know gfortran has the -ff2c flag, but is this stable across versions? Compile flags So, if I was to build dynamic libraries made with GCC's gfortran v4.6, could they then be linked with C code compiled by Xcode's native compiler? At a minimum, I figure resulting Mach-O binaries need both x86_64 and i386 code paths. Apparently, a GNU license change, or something, stopped Apple from updating to more modern versions of GCC. But GCC's current release and development branches are versions 4.6 and 4.7, respectively. The compiler that comes with Xcode is (a fork of?) GCC v4.2. Can this be done? Compatibility Libraries This looks interesting, but I don't know how I could use it to compile 'llvm-gfortran-4.x'. DragonEggÄragonEgg is a "gcc plugin that replaces GCC's optimisers and code-generators. I compiled the entire GCC collection (v4.6.3), including autotools, automake, libtool and m4 - like the GCC wiki and this blog describe - but the resulting compilers didn't compile universal binaries, probably because LLVM wasn't used as a backend. Having dug around on the internet a lot in the last couple of days, I've found other Fortran compilers, but I've failed to get any to cross-compile universal binaries, or to compile SciPy. I guess this will be the easiest way to get gfortran installed, but port search gfortran comes up with nothing, and I've not had any joy with MacPorts in the past (no offence to MacPorts it's looks like a very active project, but I've been spoilt with Linux package managers, my favourite manager being aptitude) so on Mac OS X I've compiled software and libraries from source code in the past. Anyone tried this on Mountain Lion? MacPorts The G95 project hasn't had an update since 2010, so I didn't try it. They provide instructions and a script for Building a Universal Compiler, but, again, this hasn't been updated for Mountain Lion yet. SciPy's recommended (free) Fortran compiler is the one on CRAN's R server, but this has not been updated for Mountain Lion yet. However, I failed to get this to compile SciPy, and later saw in SciPy's README that it is "known to generate buggy scipy binaries". I've only found a single website that distributes a binary version of gfortran specifically for Mountain Lion: the HPC website. Apple's Native CompilersĪs far as I can tell, the Xcode C / C++ / ObjC compilers use a fork of the GNU compiler collection, with llvm as a backend the latter I figure enables compiling and optimising "universal" binaries, for both Intel and PPC architectures. There is a compiler option to cause all local variables to act as if "save" were used - see if that makes a difference.Since Apple have stopped distributing gfortran with Xcode, how should I compile architecture independent Fortran code? I have Mac OS X Mountain Lion (10.8), and XCode 4.4 installed, with the Command Line Tools package installed. If it is an old Fortran 77 code, it may assume that local variables are preserved across procedure calls, even without the use of "save" in the declarations. ![]() ![]() ![]() Is that a difference from Linux and Mac ? I think that ifort has options to control this. Or maybe the program is assuming that memory is preallocated to some value. You could also try "-assume protect_parens", which will make ifort compliant with the Fortran standard, and see if that makes the problem go away. check all -traceback -warn all -fstack-protector If there is a bug and you are lucky they might reveal it or give a clue. I suggest turning on all warning and checking options. If the code is doing its own memory management (no longer necessary with Fortran ) with an internal array of ints, something could be going wrong different OS. Or optimization could be revealing a bug in the program. As already said, it is possible that the final result is numerically sensitive and optimization, which relaxes the arithmetic rules, is resulting in a numeric instability.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |