1

I have read similar topics here, but unfortunately these solutions does not help me.

I would like to recompile all installed software (or at least some formulas) from Homebrew using gcc from Homebrew.

Is it possible to force Homebrew to use specific compiler (e.g. gcc) and compiler options (e.g. std library to use for linking)?

I have tried to set all kinds of environment variables, but it does not help :/ ?

0/> env | grep CC
HOMEBREW_CC=gcc
CC=/usr/local/bin/gcc
0/kpykc> echo $PATH
/Users/kp/kpykc/devel/bin:/opt/ros/indigo/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/texbin
0/kpykc> ls -la /usr/local/bin/g??-?.?
lrwxr-xr-x  1 kp  admin  31 Nov 24 16:23 /usr/local/bin/g++-4.9@ -> ../Cellar/gcc/4.9.2/bin/g++-4.9
lrwxr-xr-x  1 kp  admin  31 Nov 24 16:23 /usr/local/bin/gcc-4.9@ -> ../Cellar/gcc/4.9.2/bin/gcc-4.9
0/kpykc> ls -la /usr/local/bin/g[c+][c+]
lrwxr-xr-x  1 kp  admin  22 Nov 11 23:54 /usr/local/bin/g++@ -> /usr/local/bin/g++-4.9
lrwxr-xr-x  1 kp  admin  22 Nov 11 23:53 /usr/local/bin/gcc@ -> /usr/local/bin/gcc-4.9

Also tried to use this solution.

The reason for doing that is that I want to compile some code* with gcc and link against libraries installed from brew. But it seems that gcc can't link to libs built by clang. On other side it lacks support of some C++11 features which are required by the program* i would like to compile.

So only solution that I see, is to recompile all needed libs with gcc.

Thank you for help.

Update (on system/compiler/homebrew versions):

0/kpykc> sw_vers
ProductName:    Mac OS X
ProductVersion: 10.10.1
BuildVersion:   14B25
0/kpykc> brew config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew
HEAD: 32923f435c7cf93820f434d6bdacf3bfdc3695eb
Last commit: 11 days ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit ivybridge
OS X: 10.10.1-x86_64
CLT: 6.1.1.0.1.1416017670
Clang: 6.0 build 600
X11: 2.7.7 => /opt/X11
System Ruby: 2.0.0-481
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.8_2/Frameworks /Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/bin/ruby

In particular I have troubles with code which uses Eigen::aligned_allocator. I have updated Eigen to HEAD version from Homebrew. I suspect my problem is also connected with this bug. But it should be fixed in HEAD, I think so.

  • Which OS - note the issue is not necessarily the compiler but the C++ std library you link with - also which programs have this issue clang now has good C++11 features – Mark Dec 3 '14 at 10:42
  • Thanks for clarifying, anyway this adds to question "how to force homebrew use specific compiler and compiler options, e.g. std library to use" – kpykc Dec 5 '14 at 13:40

You must log in to answer this question.

Browse other questions tagged .