【发布时间】:2015-04-17 06:01:17
【问题描述】:
我正在尝试在 OS X Yosemite 上构建 GraphChi,但出现以下错误:
fatal error: 'omp.h' file not found
从这个问题 - How to include omp.h in OS X? - 我了解到 Yosemite 使用 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
接下来,我通过 Homebrew 安装了 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
【问题讨论】:
-
试试
locate "omp.h"。如果您还没有配置locate,我建议您这样做 - 大约需要一分钟左右,但您会找到它的确切位置,因此您可以将其添加到您的路径中。 -
另外,如果
gcc -v仍然指向旧版本,请编辑您的~/.bashrc并重新实例化您的终端。 -
我已经重新实例化了我的终端,这就是为什么路径已经指向正确的目录
-
导出路径=/usr/local/Cellar/gcc/4.9.2_1/bin:$PATH
-
我尝试定位 omp.h 并将其位置添加到 $PATH,但它仍然没有帮助。我正在编辑 ~/.profile 中的路径,这是正确的还是在我执行此操作时会有所不同?
标签: xcode gcc openmp osx-yosemite