我试图在上构建GraphChi,但得到了以下错误:
fatal error: 'omp.h' file not found
从这个问题-- How to include omp.h in OS X? --我了解到约塞米蒂使用的是Clang而不是gcc,后者不包括omp.h。
$ which gcc
/usr/bin/gcc
$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix接下来,我通过家庭酿造安装了gcc
$ brew info gcc
gcc: stable 4.9.2 (bottled)
http://gcc.gnu.org
/usr/local/Cellar/gcc/4.9.2_1 (1092 files, 177M)
Built from source with: --without-multilib并更新了$PATH以包括通往gcc新版本的路径。
$ echo $PATH
/usr/local/Cellar/gcc/4.9.2_1:usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin但是,gcc -v和which gcc仍然指向旧版本,由于缺少omp.h文件,构建GraphChi仍然无法工作
有人知道我还需要做什么吗?
更新
locate omp.h返回:
/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/lib/gcc/i686-apple-darwin11/4.2.1/include/omp.h
/usr/local/Cellar/gcc/4.9.2_1/lib/gcc/4.9/gcc/x86_64-apple-darwin14.1.0/4.9.2/include/omp.h
/usr/local/Cellar/gfortran/4.8.2/gfortran/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2/include/omp.h我的~/.profile:
export PATH=/usr/local/Cellar/gcc/4.9.2_1/lib/gcc/4.9/gcc/x86_64-apple-darwin14.1.0/4.9.2/include:/usr/local/Cellar/gcc/4.9.2_1/bin:usr/local/bin:/opt/local/bin:/opt/local/sbin:$PATH发布于 2015-06-13 18:32:23
我通过使用国产软件安装gcc解决了这个问题:
brew install gcc --without-multilib,然后用
CC=gcc-5 CXX=g++-5 cmake ..
CC=gcc-5 CXX=g++-5 make -j7发布于 2015-02-16 23:03:25
一旦你安装了gcc-4.9与自制,它将自动在您的道路上。要使用OpenMP,只需确保使用新安装的gcc-4.9,它将能够找到omp.h。
对于GraphChi,您必须将Makefile的第3行更改为gcc-4.9。从此以后,跑步就可以了。他们在自述中描述了这一点,但至少他们描述的版本已经过时了https://github.com/GraphChi/graphchi-cpp#problems-compiling-on-mac。
发布于 2015-02-16 17:39:34
clang还不支持OpenMP。此外,默认情况下,gcc链接到苹果的LLVM编译器(而不是安装自brew的GCC )。相反,gcc-4.9会链接到GCC。我认为如果指定了-fopenmp,就会自动包含omp.h。
可以手动构建带有OpenMP支持的clang版本,请参阅http://clang-omp.github.io。
https://stackoverflow.com/questions/28546288
复制相似问题