I need to have a C compiler with openmp support. I installed gcc49 via Homebrew but still the configure script of the library I like to install (nfft) complains: You don't seem to have a C compiler with OpenMP support installed which is required for threaded NFFT. I have the Command Line Tools installed (as this is requested by installing Homebrew). gcc -v delivers Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) Target: x86_64-apple-darwin13.0.0 Thread model: posix. So it points to the version in Xcode and seems not to support openmp. On the other hand, gcc49 should support openmp. How do I now get this to work?

  • What is your PATH and also in a normal configure script you can set the compilers' path in an environment variable
    – mmmmmm
    Feb 13 '14 at 12:05

You called the Xcode gcc which is gcc 4.2 iirc. To use your Homebrew gcc just run gcc-49 and to compile with OpenMP support append -fopenmp.

Example with g++ for C++11:

g++-4.9 -fopenmp -std=c++11 omp_code.cpp -o omp_executable

This should give you insight about gcc and show that it's just a symlink to Xcode's llvm.

ls -la /usr/bin | grep gcc

You could just change the symlink to your new gcc-49, but you should be careful, as this might break other things for you.

If gcc-49 isn't available for you, you still have to add Homebrew to PATH.

export PATH

To permanently add this to your PATH, add these lines to your ~/.bashrc . If you use a different shell, you need to find the right file for it (~/.zshrc for zsh i.e.)

Invoke 'brew doctor' to see if Homebrew is set up correctly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .