Homebrew / legacy-homebrew

💀 The former home of Homebrew/homebrew (deprecated)
https://brew.sh
26.99k stars 11.36k forks source link

gfortran, recent versions #7233

Closed pletnes closed 13 years ago

pletnes commented 13 years ago

It would be great if homebrew could do one of the following:

Otherwise, great job on making a nice package manager (ish) program!

Sharpie commented 13 years ago

We won't provide these formula in mcxl/master repository as duplicating GCC would cause all kinds of grief. A huge issue is that Apple's GCC builds are the only ones that can compile universal binaries---a feature required by many formulae.

That being said, we encourage people to follow whatever rules they please in their own repositories. Adam maintains a homebrew-alt repository that contains may formulae that duplicate system tools or provide older versions of software. You can find formuale for GCC there:

Also, see this page in the wiki:

https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers

pletnes commented 13 years ago

OK, thanks!

mxcl commented 13 years ago

We do provide a gfortran formula. Or am I getting it wrong?

Sharpie commented 13 years ago

I think he was wondering about a newer GFortran than 4.2.x.

pletnes commented 13 years ago

Anything older than 4.4 is not too useful. The newer versions are much better both for performance and debug messages.

On 27. aug. 2011, at 19:17, Sharpiereply@reply.github.com wrote:

I think he was wondering about a newer GFortran than 4.2.x.

Reply to this email directly or view it on GitHub: https://github.com/mxcl/homebrew/issues/7233#issuecomment-1920775

mxcl commented 13 years ago

I can see that this formula has a lot of discussion and history, though personally I don't know why it is an older version.

You're welcome to jump into this mess and improve it. brew edit gfortran

Sharpie commented 13 years ago

The reason we use the 4.2.4 binaries is that they are built with Apple's patches and designed to integrate with the GCC compilers shipped with XCode without overwriting any critical components.

Personally, I think 4.2.4 compilers are plenty useful---they are the binaries that the R project uses to compile packages on the OS X. This means that the compiler is continuously tested by daily CRAN builds and produces code that is performant enough to support a major scientific computing ecosystem.

If anything, the only limitation I notice when using the 4.2.4 build is that it doesn't have good support for Fortran 2003 or 2008 as those features were added in later GCC versions.

pletnes commented 13 years ago

Useful, yes - but when developing new code, I'd rather have the warnings from 4.6. Also, OpenMP 3.0 support came in 4.3, AFAIK. Coarrays is another feature which only 4.6 posesses, and the list goes on.

Sharpie commented 13 years ago

Useful, yes - but when developing new code, I'd rather have the warnings from 4.6.

Right. And any Homebrew formula that compiles Fortran code should be using ENV.fortran which checks to see if you set the FC environment variable to point to an alternate Fortran compiler. If not, it falls back on the build of GFortran 4.2.4 provided by brew install gfortran.

So, if you want to use IFort or a newer build of GFortran just install it and export FC=<ifort/gfortran-4.6/etc> or set a permanent value in your shell's profile.

See ENV.rb for the gory details:

https://github.com/mxcl/homebrew/blob/master/Library/Homebrew/extend/ENV.rb#L160-206

mxcl commented 13 years ago

We're happy to have the fortran formula be able to compile 4.x (though I guess the default will remain 4.2) however it will be up to someone such as you to make it happen since we don't really know fortran well enough.

pletnes commented 13 years ago

I've actually been working on it, but I can't seem to get gfortran to compile. ./configure;make install basically works when done manually, but not with 'brew create', after modification. Here's what I've got so far. The flag --enable-languages=fortran should hopefully be enough to make sure only gfortran is installed, so we have 'no system duplicates'.

require 'formula'

class Gfortran < Formula
  url 'ftp://mirrors.kernel.org/gnu/gcc/gcc-4.6.1/gcc-4.6.1.tar.bz2'
  homepage ''
  md5 'c57a9170c677bf795bdc04ed796ca491'

  def install
    system "./configure", "--enable-languages=fortran", "--disable-debug", "--disable-dependency-tracking",
                          "--prefix=#{prefix}"
    system "make install"
  end

  def test
    # Trivial test for now.
    system "gfortran --version"
  end
end
mxcl commented 13 years ago

The formula cookbook has a troubleshooting section. I imagine you have to deparallelise the build or stuff like that. That's a common issue. Though I'd be surprised if GNU don't support parallel builds.

https://github.com/mxcl/homebrew/wiki/Formula-Cookbook

pletnes commented 13 years ago

I'm going to try harder as soon as possible. Thanks for the info.

On 1. sep. 2011, at 10.44, mxcl wrote:

The formula cookbook has a troubleshooting section. I imagine you have to deparallelise the build or stuff like that.

https://github.com/mxcl/homebrew/wiki/Formula-Cookbook

Reply to this email directly or view it on GitHub: https://github.com/mxcl/homebrew/issues/7233#issuecomment-1966511

Sharpie commented 13 years ago

You may want to look at the GCC formula in Homebrew-alt, it was compiling the last time I worked on it:

https://github.com/adamv/homebrew-alt/blob/master/duplicates/gcc.rb

Although, I haven't done any testing on Lion.

One thing to note is that even though you pass --enable-languages=fortran, you will always get a C compiler in the install---no way around it. So if you want to make a GFortran binary only, some things will need to be thinned out post-install.

dongli commented 12 years ago

Higher version (e.g. 4.6+) of gfortran is really helpful, since it supports more recent standard (e.g. 2003/2008)!

RuiPereira commented 12 years ago

I've also a couple of cases where a newer version of gfortran is needed. Besides, R's gfortran (which is indeed 4.2.1 instead of the claimed 4.2.4) does not seem to have a .dylib. How about the http://gcc.gnu.org/wiki/GFortranBinaries#MacOS binaries (4.6.2)? I'd be happy to write a formula for it or modify the existing gfortran.rb with a new option switch to install this newer version if it could be considered for inclusion.

pletnes commented 12 years ago

I tried the installer from http://gcc.gnu.org/wiki/GFortranBinaries#MacOS and the installer itself crashed on 10.7.3. ymmv.

RuiPereira commented 12 years ago

Worked fine for me on 10.7.3. It basically just copies everything into /usr/local/gfortran and symlinks (or tries to) gfortran into /usr/local/bin. It could be done cleanly (avoiding/deleting the gcc, g++, etc bundled in the package) using a formula.

Sharpie commented 12 years ago

We may look at upgrading GFortran sometime in the future since Apple-GCC is fading into the past. However, the starting point is to submit a formula to Homebrew-alt that provides a binary install for newer GFortran versions.