- Как мне установить компилятор Фортрана на Mac? (OS X 10.x, x> = 4)
- Установка версии, соответствующей системным компиляторам
- Установка предварительно скомпилированного, современного двоичного файла из HPC Mac OS X
- Используйте MacPorts
- Используйте Homebrew
- Используйте Fink
- Другие методы
- Binaries available for gfortran
- Windows
- macOS
- GNU/Linux
- Building from Source
- MacOS Software
- Best Free Software for Mac OS
- Fortran
- Fortran for Mac
- Fortran Compiler Installation Instructions for OS X
Как мне установить компилятор Фортрана на Mac? (OS X 10.x, x> = 4)
Значительное количество программных пакетов в вычислительной науке написано на Фортране, и Фортран не уходит. Компилятор Фортрана также необходим для сборки других программных пакетов (одним из примечательных примеров является SciPy ).
Тем не менее, Mac OS X не включает в себя компилятор Fortran. Как мне установить компилятор Фортрана на мою машину?
Выбрать свой яд. Я рекомендую использовать Homebrew. Я перепробовал все эти методы, кроме «Fink» и «Other Methods». Первоначально я предпочел MacPorts, когда писал этот ответ. За два года, прошедшие с тех пор, Homebrew значительно вырос как проект и оказался более удобным, чем MacPorts, что может потребовать много PATH взлома.
Установка версии, соответствующей системным компиляторам
Если вы хотите, чтобы версия gfortran соответствовала версиям gcc, g ++ и т. Д., Установленным на вашем компьютере, загрузите соответствующую версию gfortran здесь . В разработчиках R и разработчики SciPy рекомендуют этот метод.
- Преимущества : Соответствует версиям компиляторов, установленных с XCode или с установщиком Кеннета Рейтца ; вряд ли помешает обновлению ОС; прекрасно сосуществует с MacPorts (и, вероятно, Fink и Homebrew), потому что он устанавливается в /usr/bin . Не забивает существующие компиляторы. Не нужно редактировать PATH .
- Недостатки : стек компилятора будет очень старым. (GCC 4.2.1 — последний компилятор Apple; он был выпущен в 2007 году.) /usr/bin .
Установка предварительно скомпилированного, современного двоичного файла из HPC Mac OS X
HPC Mac OS X имеет двоичные файлы для последней версии GCC (на момент написания этой статьи — 4.8.0 (экспериментальная версия)), а также двоичные файлы g77 и компилятор на основе f2c. Разработчики PETSc рекомендуют этот метод в своих часто задаваемых вопросах .
- Преимущества : с правильной командой, устанавливает в /usr/local ; до настоящего времени. Не забивает существующие системные компиляторы или подход, описанный выше. Не будет мешать обновлению ОС.
- Недостатки : нужно редактировать PATH . Нет простого способа переключения между версиями. (Вы можете изменить PATH, удалить установку компилятора или обойти его.) Помешает другим методам установки компиляторов, /usr/local потому что двоичные файлы компилятора просто называются «gcc», «g ++» и т. Д. (Без номера версии и без любые ссылки).
Используйте MacPorts
MacPorts имеет несколько версий компиляторов, доступных для использования.
- Преимущества : Устанавливается в /opt/local ; port select может использоваться для переключения между версиями компилятора (включая системные компиляторы). Не будет мешать обновлению ОС.
- Недостатки : установка портов требует целой «программной экосистемы». Компиляторы не включают символы отладки, которые могут создавать проблемы при использовании отладчика или установке PETSc. ( Шон Фарли предлагает некоторые обходные пути.) Также требует изменения PATH . Может мешать установкам Homebrew и Fink. (Смотрите этот пост на SuperUser .)
Используйте Homebrew
Homebrew также можно использовать для установки компилятора Фортрана.
- преимущества : Простой в использовании менеджер пакетов; устанавливает тот же компилятор Fortran, что и в разделе «Установка версии, соответствующей системным компиляторам». Устанавливайте только то, что вам нужно (в отличие от MacPorts). Может установить новый стек GCC (4.7.0), используя альтернативный репозиторий homebrew-dupes.
- Недостатки : наследует все недостатки от «Установка версии, соответствующей системным компиляторам». Может потребоваться следовать парадигме Homebrew при установке другого (не Homebrew) программного обеспечения, /usr/local чтобы избежать путаницы. Может помешать установке MacPorts и Fink. (См. Этот пост на SuperUser .) Необходимо изменить PATH . Установка может зависеть от системных библиотек, это означает, что зависимости для пакетов Homebrew могут нарушаться при обновлении ОС. (См. Эту статью .) Я не ожидал, что при установке gfortran будут зависеть системные библиотеки, но могут быть такие зависимости при установке других пакетов Homebrew.
Используйте Fink
Теоретически вы можете использовать Fink для установки gfortran. Я не использовал это, и я не знаю никого, кто имел (и был готов сказать что-то положительное).
Другие методы
Другие двоичные файлы и ссылки перечислены на вики GFortran . Некоторые ссылки уже перечислены выше. Остальные способы установки могут конфликтовать или не конфликтовать с описанными выше; Используйте на свой риск.
EasyBuild ( http://hpcugent.github.com/easybuild ) позволяет легко создавать и устанавливать собственный набор компиляторов GCC.
По сути, вы даете ему простой файл easyconfig (.eb), в котором указывается, что вы хотите собрать (GCC + версия + набор языков, для которых вы хотите компиляторы для + . ), а затем сборка и установка выполняется одной командой. Я бы сказал, что это немного похоже на Homebrew, но дает вам больше свободы.
Кроме того, EasyBuild поддерживает множество других (научных) программных пакетов, которые могут быть собраны и установлены с помощью одной команды, поэтому стоит посмотреть на них.
Отказ от ответственности: я являюсь частью команды EasyBuild. Сборка GCC (с включенным gfortran) должна работать на OS X, но другие сборки могут быть хлопотными. Мы работаем над этим, дайте нам знать, если у вас возникнут проблемы.
Источник
Binaries available for gfortran
This page gathers links to all unofficial gfortran binary packages people regularly build, based on the current development gfortran source code.
Note: There do not exist any official FSF/GNU/GCC binary builds (only source packages). Most of the builds below come from gfortran maintainers but not all.
Windows
If in doubt, or if you don’t know what Cygwin and MinGW are, the package for you is the MinGW («native Windows») package!
MinGW for Win64: The Mingw-w64 project has regularly updated snapshots of compilers generating 64-bit Windows executables. They provides several compilers, which run on Windows (32-bit and 64-bit Windows), Cygwin, Linux, and Darwin/MacOS — and which generate binaries for 32bit or 64bit Windows. The file name pattern is — — — ; thus, mingw-w64-bin_x86_64-mingw_20100527.zip is a compiler targeting 64bit Windows ( mingw-w64) but also running («host») on 64bit Windows ( xx86-64-mingw); you might search for the file in Toolchains targetting Win64 (Personal Builds or Automatized Builds).
MinGW build («native Windows» build)
Official MinGW builds (only releases), last seen was 6.3.0 (2017-05-30)
The MinGW for Win64 project has also binaries for 32bit Windows; e.g. mingw-w32-bin_i686-mingw_ .zip runs on and generates binaries for 32bit Windows (cf. above); you might search for the file in Toolchains targetting Win32 (Personal Builds or Automatized Builds).
MinGW 32/64bit builds by www.Equation.com (builds were announced at comp.lang.fortran; note — equation.com is not affiliated with any MinGW or GCC developer. Use at your own risk)
Cygwin: The Cygwin project offers up-to-date builds of GCC and gfortran
Octave: Octave 6.1 comes with gcc/gfortran-9.3.1. From the Windows start menu, open up Octave and you will find the bash shell. Stick it to your task bar so it’s always to hand. Combined with Notepad++ (https://notepad-plus-plus.org/), you will be able to get on with fortran development using nothing but GPL tools. Alternatively, the ‘system’ command can be used to run gfortran from the Octave GUI together with the Octave editor.
macOS
The gfortran maintainers offer nice Apple-style installers for macOS: https://github.com/fxcoudert/gfortran-for-macOS/releases Detailed instructions can be found here.
Other projects packaging GCC (and gfortran) binaries for Mac include:
Homebrew offers the latest stable gfortran release as part of the «gcc» package.
HPC Mac OS X offers GCC builds, which include gfortran
MacPorts (package name, e.g., «gcc48») — the fastest way to get a developer version of GCC. MacPorts comes with a packing software, but all software is compiled before installation. For the developer version, the «Portfile» is updated approx. weekly.
Fink offers GCC packages (all released versions) — similar to MacPorts, but also offers binaries; it does not have the developer versions, just the releases.
GNU/Linux
Most Linux distributions offer gfortran packages, some have also builds for the experimental versions
Nightly builds are available at:
32-bit processors (i686)
64-bit AMD-compatible processors (x86_64, AMD64,Intel64, em64t)
gcc-4.8-infrastructure package (GCC 4.8 and later; for GCC 4.3 to 4.7 use gcc-infrastructure), which contains required libraries (GMP, MPFR, MPC, etc.) — simply unpack in the «gcc-trunk» (or «gcc-4.6» or . ) directory
To unpack .xz files: Use xzcat with tar. It is contained in pre-build xz package, if you don’t have it.
Building from Source
See also InstallingGCC and http://gcc.gnu.org/install/
- Obtain the source code either via
You should have the right versions of GMP, MPFR and MPC (and optionally for Graphite: CLOOG and ISL) installed, which you can download from ftp://gcc.gnu.org/pub/gcc/infrastructure/ (They can also be automatically build with GCC.)
Note: You can use ./contrib/download_prerequisites to download them.
Follow the instructions; in a nutshell, you will do
create a build directory, e.g. gcc-build underneath the source directory
go to the build directory and run configure from there; for instance: ../configure —prefix=$HOME/gcc-trunk —enable-languages=c,fortran
Useful configure options: —enable-checking=release which disables some compile-time checks which slow down the compiler; —disable-bootstrap which speeds up the build but uses the system compiler and disables some consistency checks; —disable-build-poststage1-with-cxx (for 4.7 or higher) avoids building GCC with a C++ compiler, esp. useful if no C++ should be compiled; —disable-libstdcxx-pch speeds up the compilation a bit by not creating pre-compiled header files.
None: GFortranBinaries (последним исправлял пользователь PaulThomas 2021-03-24 11:23:35)
Источник
MacOS Software
Best Free Software for Mac OS
Fortran
Fortran for Mac
Java may be the hot computer language of the nineties, but you wouldn’t know it to look at business and government sites; in the real world, older languages like COBOL and FORTRAN (Gfortran) are still doing much of the day-to-day work at banks, government labs, and NASA. In big-project scientific and numeric calculation, for example, the ancient FORTRAN language in one of its newer forms–FORTRAN 77 or FORTRAN 90–is still grinding away on optimized legacy code.
Source code originally written for Cray and Fujitsu supercomputers can now run without serious modification on a Mac using latest Gfortran package. This formidable suite includes compilers for FORTRAN 77, the more modern FORTRAN 90, and the thoroughly modern C/C++ (optimized for use in the MPW Shell); IMSL’s FORTRAN numeric and statistics libraries, the best available for any language, are available as an option. All this magnificence takes a little more programming background to put into action than the new CodeWarrior-adapted LS FORTRAN from Fortner Research, but compiled code runs two to three times faster with Gfortran –and for most FORTRAN users, speed of executables is the number one consideration.
The Gfortran program makes itself practically invisible: you simply install it, set a few options, and watch the Pro FORTRAN compiler devour your source code. On four benchmarks–two of my own and two industry-standard SPECmark routines–the compiled code running on a 604e-based Mac executed roughly twice as fast as the same programs compiled in LS FORTRAN. The Absoft product also breezed through a grueling test pastiche of combined C and FORTRAN code.
As a language that started life when RAM was measured in 4KB chunks, Gfortran has a huge bag of optimization tricks and is the topic of many reference books–and the new FORTRAN-based teaching language F suggests that FORTRAN will have some big-computer tasks all to itself for at least another decade.
PROS: Superior performance of compiled code; few Mac porting modifications.
CONS: Some popular editor features missing.
Category: Tools
Version: 9.2
Download Size: 80 MB
License: Free to try
Release Date: October 1, 2019
Last Updated: December 6, 2019
System requirements: Mac OS X 10.14 or later
Источник
Fortran Compiler Installation Instructions for OS X
The Mac OS X operating system is a variant of unix (called Darwin, which is a derivative of BSD unix). It is a versatile computing platform suitable both for computational chemistry calculations and for developing and compiling programs.
Although scientific programs use a variety of languages (basic, pascal, c, java, perl, python, . ), a substantial base of scientific code is written in fortran. Most (though not all) computational engines supported by WebMO are written in fortran. This resource concentrates on fortran compilers and the tools needed to support them.
While integrated development environments (IDE’s) are useful in supporting program development, this resource concentrates on the command line interface (CLI) using the Terminal application that is supplied with OS X.
The procedures discussed on this page have been designed for Mac OS X 10.5.
SOFTWARE DEVELOPMENT UTILITIES AND c COMPILER
Command line program development often uses unix utilities (cvs, make, ranlib, . ) when developing and compiling a project. These utilities, together with the c compiler for OS X, are available as part of the Xcode Tools that come with OS X. However, they are not installed by default.
- Insert Mac OS X Installation DVD. Navigate to the Optional Installs: Xcode Tools folder.
- Double-click XcodeTools.mpkg. Follow the prompts, but at Installation Type, click the Customize button.
- Uncheck all the components and check only Unix Development Support. In particular, Developer Tools Essentials should be unchecked (saving you 2.5GB of disk space)!
- Provide your password for the installation will proceed.
- Notes:
- The latest version of Xcode Tools can be obtained by registering for a free ADC membership and then downloading the latest version of Xcode from Apple (caution: it is > 1GB!).
- Xcode can be uninstalled by running
g77 is the gnu fortran77 compiler. It was last produced with gnu compiler collection (gcc) 3.4, and has since been supplanted with gfortran which supports fortran95. Because of the free-cost and high quality of the gnu copmpilers, a significant amount of software has been developed for and compiled with the g77 compiler.
A tar file of the final realease of g77 compiled for OS X exists at High Performance Computing for Mac OS X.
- Download g77-intel-bin.tar.gz (Intel Mac only) or g77-bin.tar.gz (PowerPC only)
- If your browser did not automatically unzip the file, then
gfortran is the new gnu fortran compiler, which attempts to follow the fortran95 standard. As such, it should be backward compatible with fortran77 and fortran90. It also promises to attempt following future fortran standards, such as fortran2003. gfortran replaces the gnu g77 compiler and is included with gnu compiler collection (gcc) 4.0 and higher.
Although Apple XCode Tools includes gcc 4.X, it is not a complete implementation and lacks gfortran. However, various implementations of gfortran have been compiled and are available at GCC Wiki GFortranBinaries, Tools — R (and Fortran) for Mac OS X, or High Performance Computing for Mac OS X. These implementations vary by version, platform supported, and integration with XCode Tools. Important: Install only one implementation of gfortran, as each version would overwrite portions of the others!
- The «GCC Wiki» implementation described in the following procedure is typically the newest binary release of gfortran, but requires that you download a version appropriate for your architecture.
- Visit the GCC Wiki GFortranBinaries page and scroll to the MacOS section
- Download gfortran-macosx-x86.dmg (Intel) or gfortran-macosx-ppc.dmg (PowerPC)
- If your browser did not automatically mount the disk image, the double-click the dmg file to mount and open it
- Open the gfortran-macosx-
— folder, double-click gfortran.pkg, and follow the prompts to install it - Notes:
- All gfortran files are installed in /usr/local/gfortran, and a single symbloic link /usr/local/bin/gfortran is created. Thus, to uninstall the package, run
f2c TRANSLATOR / f77 COMPILER f2c is a fortran77-to-c source code translator. Because f2c is written in c and its ouput is c, both of which can be compiled natively on unix operating systems, f2c offers a very transportable compiler solution for compiling fortran programs. f2c also offers a means of converting large fortran libraries, such as LAPACK, into c. f2c is still actively maintained and is available at http://www.netlib.org/f2c/.
f77 was the first complete fortran77 compiler and was written in c. The original f77 program is no longer available for current computer architectures. However, f2c is based on the original f77 program, and the f2c distribution contains a f77 wrapper script that combines the f2c translation and c compilation steps. The f77 script also supports many command line options commonly associated with fortran compilers. Since the f77 script calls f2c, which in turn is based upon the original f77 program, the f77 script within the f2c distribution represents the most current implementation of the original f77 program.
Источник