首页 > 解决方案 > 在 OSX 上安装 LibTorch:不支持的选项 fopenmp

问题描述

我正在尝试按照说明(此处为https://pytorch.org/cppdocs/installing.html)在 OSX 上安装 LibTorch。我一切顺利,直到“make”命令返回

Scanning dependencies of target example-app
[ 50%] Building CXX object CMakeFiles/example-app.dir/example-app.cpp.o
clang: error: unsupported option '-fopenmp'
make[2]: *** [CMakeFiles/example-app.dir/example-app.cpp.o] Error 1
make[1]: *** [CMakeFiles/example-app.dir/all] Error 2
make: *** [all] Error 2

有什么想法可以解决这个问题吗?

顺便说一句,在前面的 cmake 步骤中,Cmake 找到的编译器似乎是 Mac 上的默认系统编译器:

-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works

标签: c++cmakeopenmplibtorch

解决方案


推荐阅读