ChemPy:clang:错误:不支持的选项“-fopenmp”

我正在尝试解决以下问题。当我尝试在此 ntb中运行以下行时,我得到:


native = get_native(rsys, odesys, 'cvode')


INFO:pyodesys.native._base:Cythonizing /Users/user/Library/Caches/python3.8-pyodesys-0.13.1/_cvode_wrapper.pyx to ./_cvode_wrapper.cpp

INFO:pyodesys.native._base:In "/var/folders/bx/tb4883l53hdd3zp2y0nyy_4m0000gp/T/tmpt2vuw8pg", executing:

"/usr/bin/g++ -fwrapv -pthread -c -std=c++11 -Wall -Wextra -fPIC -O2 -ffast-math -funroll-loops -fopenmp -fno-strict-aliasing -o ./_cvode_wrapper.o -DPYCVODES_NO_KLU=0 -DPYCVODES_NO_LAPACK=0 -DANYODE_NO_LAPACK=0 -I/Users/user/anaconda3/lib/python3.8/site-packages/numpy/core/include -I/Users/jan/anaconda3/lib/python3.8/site-packages/pyodesys/native/sources -I/Users/jan/anaconda3/lib/python3.8/site-packages/pycvodes/include -I/Users/jan/anaconda3/include/python3.8 ./_cvode_wrapper.cpp"

fopenmp我认为这可能是和 的问题gcc,如这些地方所述(How to deal with "clang: error: unsupported option '-fopenmp'" on travis?https://github.com/microsoft/LightGBM/issues/ 3、 https: //github.com/velocyto-team/velocyto.R/issues/2)但提出的解决方案(https://github.com/velocyto-team/velocyto.R/issues/2#issuecomment-341165967https://github.com/microsoft/LightGBM/issues/3#issuecomment-254149689,https : //github.com/kharchenkolab/conos/wiki/Installing-Conos-for-Mac-OS)只是不适用于我。我也尝试使用 conda 安装 GCC 但我得到:

conda install gcc
PackagesNotFoundError: The following packages are not available from current channels:

  - gcc

Current channels:

  - https://repo.anaconda.com/pkgs/main/osx-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/osx-64
  - https://repo.anaconda.com/pkgs/r/noarch

使用homebrew我已经gcc安装...知道发生了什么以及如何修复它吗?我运行的是 MacOS 10.15.7。谢谢


梦里花落0921
浏览 228回答 2
2回答

HUH函数

自制程序将安装类似的东西:/usr/local/bin/g++-10您可以通过以下方式准确检查它安装的内容和位置:brew ls gcc样本输出/usr/local/Cellar/gcc/10.2.0/bin/c++-10/usr/local/Cellar/gcc/10.2.0/bin/cpp-10/usr/local/Cellar/gcc/10.2.0/bin/g++-10/usr/local/Cellar/gcc/10.2.0/bin/gcc-10/usr/local/Cellar/gcc/10.2.0/bin/gcc-ar-10/usr/local/Cellar/gcc/10.2.0/bin/gcc-nm-10/usr/local/Cellar/gcc/10.2.0/bin/gcc-ranlib-10/usr/local/Cellar/gcc/10.2.0/bin/gcov-10/usr/local/Cellar/gcc/10.2.0/bin/gcov-dump-10/usr/local/Cellar/gcc/10.2.0/bin/gcov-tool-10/usr/local/Cellar/gcc/10.2.0/bin/gfortran/usr/local/Cellar/gcc/10.2.0/bin/gfortran-10/usr/local/Cellar/gcc/10.2.0/bin/lto-dump-10/usr/local/Cellar/gcc/10.2.0/bin/x86_64-apple-darwin19-c++-10/usr/local/Cellar/gcc/10.2.0/bin/x86_64-apple-darwin19-g++-10/usr/local/Cellar/gcc/10.2.0/bin/x86_64-apple-darwin19-gcc-10/usr/local/Cellar/gcc/10.2.0/bin/x86_64-apple-darwin19-gcc-10.2.0/usr/local/Cellar/gcc/10.2.0/bin/x86_64-apple-darwin19-gcc-ar-10/usr/local/Cellar/gcc/10.2.0/bin/x86_64-apple-darwin19-gcc-nm-10/usr/local/Cellar/gcc/10.2.0/bin/x86_64-apple-darwin19-gcc-ranlib-10/usr/local/Cellar/gcc/10.2.0/bin/x86_64-apple-darwin19-gfortran-10/usr/local/Cellar/gcc/10.2.0/include/c++/ (770 files)/usr/local/Cellar/gcc/10.2.0/lib/gcc/ (638 files)/usr/local/Cellar/gcc/10.2.0/libexec/gcc/ (13 files)/usr/local/Cellar/gcc/10.2.0/share/gcc-10.2.0/ (4 files)/usr/local/Cellar/gcc/10.2.0/share/man/ (11 files)然后你可以找到你应该实际使用的符号链接二进制文件,如下所示:cd /usr/local/binls -l | grep gcc样本输出lrwxr-xr-x   1 mark  admin        31 21 Aug 16:41 c++-10 -> ../Cellar/gcc/10.2.0/bin/c++-10lrwxr-xr-x   1 mark  admin        31 21 Aug 16:41 cpp-10 -> ../Cellar/gcc/10.2.0/bin/cpp-10lrwxr-xr-x   1 mark  admin        31 21 Aug 16:41 g++-10 -> ../Cellar/gcc/10.2.0/bin/g++-10lrwxr-xr-x   1 mark  admin        31 21 Aug 16:41 gcc-10 -> ../Cellar/gcc/10.2.0/bin/gcc-10lrwxr-xr-x   1 mark  admin        34 21 Aug 16:41 gcc-ar-10 -> ../Cellar/gcc/10.2.0/bin/gcc-ar-10lrwxr-xr-x   1 mark  admin        34 21 Aug 16:41 gcc-nm-10 -> ../Cellar/gcc/10.2.0/bin/gcc-nm-10lrwxr-xr-x   1 mark  admin        38 21 Aug 16:41 gcc-ranlib-10 -> ../Cellar/gcc/10.2.0/bin/gcc-ranlib-10lrwxr-xr-x   1 mark  admin        32 21 Aug 16:41 gcov-10 -> ../Cellar/gcc/10.2.0/bin/gcov-10lrwxr-xr-x   1 mark  admin        37 21 Aug 16:41 gcov-dump-10 -> ../Cellar/gcc/10.2.0/bin/gcov-dump-10lrwxr-xr-x   1 mark  admin        37 21 Aug 16:41 gcov-tool-10 -> ../Cellar/gcc/10.2.0/bin/gcov-tool-10lrwxr-xr-x   1 mark  admin        33 21 Aug 16:41 gfortran -> ../Cellar/gcc/10.2.0/bin/gfortranlrwxr-xr-x   1 mark  admin        36 21 Aug 16:41 gfortran-10 -> ../Cellar/gcc/10.2.0/bin/gfortran-10lrwxr-xr-x   1 mark  admin        36 21 Aug 16:41 lto-dump-10 -> ../Cellar/gcc/10.2.0/bin/lto-dump-10lrwxr-xr-x   1 mark  admin        53 21 Aug 16:41 x86_64-apple-darwin19-c++-10 -> ../Cellar/gcc/10.2.0/bin/x86_64-apple-darwin19-c++-10lrwxr-xr-x   1 mark  admin        53 21 Aug 16:41 x86_64-apple-darwin19-g++-10 -> ../Cellar/gcc/10.2.0/bin/x86_64-apple-darwin19-g++-10lrwxr-xr-x   1 mark  admin        53 21 Aug 16:41 x86_64-apple-darwin19-gcc-10 -> ../Cellar/gcc/10.2.0/bin/x86_64-apple-darwin19-gcc-10lrwxr-xr-x   1 mark  admin        57 21 Aug 16:41 x86_64-apple-darwin19-gcc-10.2.0 -> ../Cellar/gcc/10.2.0/bin/x86_64-apple-darwin19-gcc-10.2.0lrwxr-xr-x   1 mark  admin        56 21 Aug 16:41 x86_64-apple-darwin19-gcc-ar-10 -> ../Cellar/gcc/10.2.0/bin/x86_64-apple-darwin19-gcc-ar-10lrwxr-xr-x   1 mark  admin        56 21 Aug 16:41 x86_64-apple-darwin19-gcc-nm-10 -> ../Cellar/gcc/10.2.0/bin/x86_64-apple-darwin19-gcc-nm-10lrwxr-xr-x   1 mark  admin        60 21 Aug 16:41 x86_64-apple-darwin19-gcc-ranlib-10 -> ../Cellar/gcc/10.2.0/bin/x86_64-apple-darwin19-gcc-ranlib-10lrwxr-xr-x   1 mark  admin        58 21 Aug 16:41 x86_64-apple-darwin19-gfortran-10 -> ../Cellar/gcc/10.2.0/bin/x86_64-apple-darwin19-gfortran-10因此,一旦确定要使用哪个编译器,您需要告诉构建工具如何使用它。我不熟悉您提到的软件包,但您帖子的第四行暗示它正在使用,/usr/bin/g++如果您想使用 homebrew ,这是不正确的 /usr/local/bin/g++-10。指定不同编译器的常见方法是:对于CMake:CXX=/usr/local/bin/g++-10 cmake ..对于品牌:make CXX=/usr/local/bin/g++-10对于自动配置:./configure CXX=/usr/local/bin/g++-10

喵喵时光机

我花了很长时间,最终出现了两个我认为对其他人可能有用的主要问题。ChemPy 仅在 Linux 上受支持,因此即使我让编译器正常工作,我也没有使其在 Mac 或 Windows 上运行。编译器一团糟。最后有效的是使用 Anaconda 环境中的 clang v10 而不是 v12:export CC=/usr/bin/clang export CXX=/usr/bin/clang++为了使它完整,这里是现有的和工作的:(base) bash-3.2$ clang --version clang version 10.0.0 Target: x86_64-apple-darwin19.6.0 Thread model: posix InstalledDir: /Users/user/anaconda3/bin (base) bash-3.2$ which clang /Users/user/anaconda3/bin/clang
打开App,查看更多内容
随时随地看视频慕课网APP