How to build openmpi with homebrew and gcc-4.9? - gcc

By default brew install openmpi uses clang to create its wrapper.
I need to specify gcc-4.9(Homebrew installed) for the wrapper.
I have tried
$export CC=gcc-4.9
$brew install openmpi
$brew install --cc=gcc-4.9 openmpi
$brew install --with-gcc49 openmpi
$brew install -CC=gcc-4.9 -CXX=g++-4.9 -FC=gfortran -F77=gfortran openmpi
$brew install openmpi --cc=gcc-4.9
$brew install openmpi --CC=gcc-4.9 --CXX=g++-4.9 --FC=gfortran --F77=gfortran
Finally, I've modified the openmpi formula adding:
args = %W[
CC=gcc-4.9
CXX=g++-4.9
FC=gfortran
F77=gfortran
I still get
$mpicc --showme
clang -I/usr/local/Cellar/open-mpi/1.8.4/include -L/usr/local/opt/libevent/lib -L/usr/local/Cellar/open-mpi/1.8.4/lib -lmpi

Finally it was solved as follows:
1) Add environment variables for homebrew (you can also add these lines to your ~\.bashrc):
export HOMEBREW_CC=gcc-4.9
export HOMEBREW_CXX=g++-4.9
2) Rebuild and reinstall openmpi and its dependencies from source
brew reinstall openmpi --build-from-source
3) In the end you will get a message like:
==> Reinstalling open-mpi
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
==> Downloading http://www.open-mpi.org/software/ompi/v1.8/downloads/openmpi-1.8.
Already downloaded: /Library/Caches/Homebrew/open-mpi-1.8.4.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/open-mpi/1.8.4 --disable-silent-rules
==> make all
==> make check
==> make install
Warning: open-mpi dependency gcc was built with a different C++ standard
library (libstdc++ from clang). This may cause problems at runtime.
🍺 /usr/local/Cellar/open-mpi/1.8.4: 785 files, 23M, built in 41.2 minutes
$mpicc --showme
gcc-4.9 -I/usr/local/Cellar/open-mpi/1.8.4/include -L/usr/local/opt/libevent/lib -L/usr/local/Cellar/open-mpi/1.8.4/lib -lmpi
On my MacBook I had some conflicts with XCode 6.2, which were solved following this instructions
However, I decided to stay with the clang version to avoid issues with gfortran.

Related

rbenv and Apple m1. Failed installing ruby 3.2, 2.7 and 2.6

I can't install any ruby version with rbenv. I tried 2.6.10 2.7.7 or 3.2.0 .
This is the error I got when executing:
❯ rbenv install 3.2.0
To follow progress, use 'tail -f /var/folders/4v/kyv3nw1s7lq8s7lz7r6djvsr0000gn/T/ruby-build.20230125170342.85553.log' or pass --verbose
Downloading openssl-3.0.7.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/83049d042a260e696f62406ac5c08bf706fd84383f945cf21bd61e9ed95c396e
Installing openssl-3.0.7...
Installed openssl-3.0.7 to /Users/idanahal/.rbenv/versions/3.2.0
Downloading ruby-3.2.0.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0.tar.gz
Installing ruby-3.2.0...
ruby-build: using readline from homebrew
ruby-build: using gmp from homebrew
BUILD FAILED (macOS 13.1 using ruby-build 20221225)
Inspect or clean up the working tree at /var/folders/4v/kyv3nw1s7lq8s7lz7r6djvsr0000gn/T/ruby-build.20230125170342.85553.VSOgmw
Results logged to /var/folders/4v/kyv3nw1s7lq8s7lz7r6djvsr0000gn/T/ruby-build.20230125170342.85553.log
Last 10 log lines:
compiling ossl_x509ext.c
compiling ossl_x509name.c
compiling ossl_x509req.c
compiling ossl_x509revoked.c
compiling ossl_x509store.c
installing default openssl libraries
linking shared-object date_core.bundle
linking shared-object openssl.bundle
linking shared-object ripper.bundle
make: *** [build-ext] Error 2
When installing with Homebrew it's working. I don't know what to do. Should rbenv even suppose to work with m1 computers?
I have MacOS 13.1
Setting the environment variable below solves the problem:
export RUBY_CONFIGURE_OPTS="--with-zlib-dir=$(brew --prefix zlib) --with-openssl-dir=$(brew --prefix openssl#1.1) --with-readline-dir=$(brew --prefix readline) --with-libyaml-dir=$(brew --prefix libyaml) --with-gdbm-dir=$(brew --prefix gdbm)"
before running rbenv install for all versions.
Note: The configuration --with-openssl-dir=$(brew --prefix openssl#1.1) is needed only for versions 2.6.* and 2.7.*. You can (and should) remove it if you are trying to install ruby 3.*.*.
For 2.6 and 2.7 sometimes this environment variable also needed:
export RUBY_CFLAGS="-Wno-error=implicit-function-declaration"
If all of the above didn't work, you can install ruby with Homebrew.
If you want to manage the Homebrew installed version from rbenv read this answer.

brew install gcc49 on OS X 10.10 (Unable to find a usable ISL)

When I try to install gcc49, I receive an error
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-versions/master/gcc49.rb
######################################################################## 100.0%
==> Downloading http://ftpmirror.gnu.org/gcc/gcc-4.9.3/gcc-4.9.3.tar.bz2
Already downloaded: /Library/Caches/Homebrew/gcc49-4.9.3.tar.bz2
==> ../configure --build=x86_64-apple-darwin14.5.0 --prefix=/usr/local/Cellar/gcc49/4.9.3 --libdir=/usr/local/Cellar/gcc49/4.9.3/lib/gcc/4.9 --enable-languages=c,c++,objc,obj-c++ --program-suffix=-4.9 --w
checking for version 0.10 of ISL... no
checking for version 0.11 of ISL... no
checking for version 0.12 of ISL... no
checking for version 0.14 of ISL... no
configure: error: Unable to find a usable ISL. See config.log for details.
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
READ THIS: https://git.io/brew-troubleshooting
However, I do have ISL:
$ brew info isl
isl: stable 0.14.1 (bottled), HEAD
Integer Set Library for the polyhedral model
http://freecode.com/projects/isl
/usr/local/Cellar/isl/0.14.1 (68 files, 3.2M) *
Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/isl.rb
==> Dependencies
Build: xz ✔
Required: gmp ✔
I do not know where is the config.log located.
The correct way to install GCC 4.9 is to use
$ brew install homebrew/versions/gcc49
This way Homebrew will correctly resolve the missing dependencies and install them for you. You can find this version of gcc (or any other) using
$ brew search gcc49
homebrew/versions/gcc49
or
$ brew search gcc
gcc homebrew/versions/gcc47
homebrew/dupes/apple-gcc42 homebrew/versions/gcc48
homebrew/versions/gcc43 homebrew/versions/gcc49
homebrew/versions/gcc44 homebrew/versions/gcc5
homebrew/versions/gcc45 homebrew/versions/llvm-gcc28
homebrew/versions/gcc46
However, the dependency you are missing is not isl but isl011. You can install it with
$ brew install isl011
We can see that this is a dependency of gcc49 with
$ brew info gcc49
==> Dependencies
Required: gmp4 ✔, libmpc08 ✔, mpfr2 ✔, cloog018 ✔, isl011 ✔
The problem is caused by updated Xcode. Need run : "$ xcode-select --install"

How do I install DevIL with homebrew on mac?

I entered this:
brew install devil
and got this:
Error: devil cannot be built with any available compilers.
To install this formula, you may need to:
brew install gcc
So I reinstalled gcc and got this:
Toms-MBP:~ tom$ brew install gcc
==> Downloading https://homebrew.bintray.com/bottles/gcc-5.2.0.yosemite.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring gcc-5.2.0.yosemite.bottle.1.tar.gz
==> Caveats
GCC has been built with multilib support. Notably, OpenMP may not work:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60670
If you need OpenMP support you may want to
brew reinstall gcc --without-multilib
==> Summary
🍺 /usr/local/Cellar/gcc/5.2.0: 1353 files, 248M
But I keep getting the same error when I try to install DevIL

How to link to a new gcc version with brew?

I just got a new gcc version by running brew update and brew upgrade. brew complained that brew link did not complete successfully:
~
✓ brew upgrade
==> Upgrading 1 outdated package, with result:
gcc 4.8.2_1
==> Upgrading gcc
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/gcc-4.8.2_1
######################################################################## 100,0%
==> Pouring gcc-4.8.2_1.mavericks.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using:
brew link gcc
Possible conflicting files are:
/usr/local/bin/gfortran -> /usr/local/Cellar/gfortran/4.8.2/bin/gfortran
/usr/local/share/man/man1/gfortran.1 -> /usr/local/Cellar/gfortran/4.8.2/share/man/man1/gfortran.1
So I ran brew link gcc manually:
~
✓ brew link gcc
Linking /usr/local/Cellar/gcc/4.8.2... 25 symlinks created
Now when I tell brew to clean up I get the following warning:
~
✓ brew cleanup
Warning: Skipping (old) /usr/local/Cellar/gcc/4.8.2 due to it being linked
There are two gcc version in my Cellar:
~
✓ ls /usr/local/Cellar/gcc
4.8.2 4.8.2_1
Do I need both? I would like to remove the old version. How can I achieve that?
I solved it by running the following commands
brew unlink gcc
brew rm gfortran
brew cleanup
brew link gcc
It seems that gfortran was linked to the old gcc version.

RVM requirements error

I have OS X Mavericks installed and I'm trying to run rvm requirements in terminal and it gives me this error.
Installing required packages: autoconf, automake, libtool, pkgconfig, libyaml, libffi, readline, libksba, curl-ca-bundle, gdbm.............
Error running 'requirements_osx_port_libs_install autoconf automake libtool pkgconfig libyaml libffi readline libksba curl-ca-bundle gdbm',
please read /Users/Alex/.rvm/log/ruby-1.9.3-p448/1374263757_package_install_autoconf_automake_libtool_pkgconfig_libyaml_libffi_readline_libksba_curl-ca-bundle_gdbm.log
Requirements installation failed with status: 1.
It looks like RVM tried to install some dependencies using Macports and Macports proceeded to get really confused about dependencies when it tried to install autoconf.
Try running:
brew install autoconf
Otherwise you should run this bash script:
https://gist.github.com/siraj/1399288
Assuming you have brew, which you should if you don't.
If your Macports just isn't working, then you can manually install all of the requirements like this:
brew install autoconf automake libtool pkgconfig libyaml libffi readline libksba curl-ca-bundle gdbm
I tried the above, and a few other things. None worked.
It seems that on OSX 10.9 and XCode5 moved some libs around on us. So I had to install XCode5-DP6 (Dev Preview 6), opened up DP6 and in the settings, you have to tell the command line tools to use the new DP6 build and not the Standard XCode from the marketplace.
First, I had to install homebrew. Nothing liked to play with macports. I am on my first mac as of only a month ago, so macports was just what solved apache for me at the time. I then had to run 'brew install autoconf'
Once I did that I then ran rvm requirements, everything installed without issue. then sudo gem install jekyll from there and it all works like a charm now.
I'm sure once Mavericks is actually released this will get ironed out. We are using early releases after all...
Hope this works for you guys.

Resources