(Cmake, Trilinos)clang: error: unsupported option '-fopenmp'
(Cmake, Trilinos)clang: error: unsupported option '-fopenmp'
平台:macOS 11.1
当我尝试配置 Trilinos 时,我遇到了一个问题,我无法处理它。
以下命令用于编译Trilinos:
#!/bin/bash
rm -rf CMakeCache.txt
rm -rf CMakeFiles
rm -rf CMakeCache.txt
cmake \
-D CMAKE_INSTALL_PREFIX:PATH=/Users/weiqiangguo/Downloads/Trilinos/build \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_SHARED_LIBS:BOOL=ON \
\
-D TPL_ENABLE_MPI:BOOL=ON \
-D TPL_ENABLE_BLAS:BOOL=ON \
-D TPL_ENABLE_LAPACK:BOOL=ON \
-D TPL_ENABLE_Pthread:BOOL=ON \
-D TPL_ENABLE_HWLOC:BOOL=ON \
-D TPL_ENABLE_HDF5:BOOL=ON \
-D TPL_ENABLE_SCALAPACK:BOOL=ON \
-D TPL_ENABLE_SuperLU:BOOL=ON \
-D TPL_ENABLE_SuperLUDist:BOOL=ON \
-D TPL_ENABLE_METIS:BOOL=ON \
-D TPL_ENABLE_ParMETIS:BOOL=ON \
\
-D ML_ENABLE_SuperLU:BOOL=OFF \
\
-D CMAKE_C_COMPILER:STRING="mpicc" \
-D CMAKE_CXX_COMPILER:FILEPATH=/usr/local/bin/mpicxx \
-D CMAKE_Fortran_COMPILER:STRING="mpif90" \
-D CMAKE_CXX_FLAGS:STRING="-O3 -g -fopenmp" \
\
-D TPL_SCALAPACK_LIBRARIES='/usr/local/lib/libscalapack.dylib' \
\
-D Teuchos_ENABLE_COMPLEX=ON \
\
-D Trilinos_ENABLE_ALL_PACKAGES:BOOL=OFF \
-D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=OFF \
-D Trilinos_ENABLE_ML:BOOL=ON \
-D Trilinos_ENABLE_Belos:BOOL=ON \
-D Trilinos_ENABLE_Epetra:BOOL=ON \
-D Trilinos_ENABLE_EpetraExt:BOOL=ON \
-D Trilinos_ENABLE_Ifpack:BOOL=ON \
-D Trilinos_ENABLE_Amesos:BOOL=ON \
-D Trilinos_ENABLE_Anasazi:BOOL=ON \
-D Trilinos_ENABLE_NOX:BOOL=ON \
-D Trilinos_ENABLE_Teko:BOOL=ON \
-D Trilinos_ENABLE_Galeri:BOOL=ON \
-D Trilinos_ENABLE_OpenMP:BOOL=OFF \
-D Trilinos_ENABLE_PyTrilinos:BOOL=ON \
\
-D MPI_BASE_DIR:FILEPATH="/usr/local/Cellar/open-mpi" \
-D PYTHON_EXECUTABLE:FILEPATH="/usr/bin/python3" \
-D SuperLU_LIBRARY_DIRS:FILEPATH="/usr/local/lib" \
-D SuperLU_INCLUDE_DIRS:FILEPATH="/usr/local/include" \
-D SuperLUDist_LIBRARY_DIRS:FILEPATH="/usr/local/lib" \
-D SuperLUDist_INCLUDE_DIRS:FILEPATH="/usr/local/include" \
../
错误信息如下:
Probing the environment ...
-- USE_XSDK_DEFAULTS='FALSE'
-- BUILD_SHARED_LIBS='ON'
-- CMAKE_BUILD_TYPE='Release'
-- MPI_BASE_DIR='/usr/local/Cellar/open-mpi'
-- MPI_BIN_DIR='/usr/local/Cellar/open-mpi/bin'
-- MPI_USE_COMPILER_WRAPPERS='ON'
-- Leaving current CMAKE_C_COMPILER=mpicc since it is already set!
-- Leaving current CMAKE_CXX_COMPILER=/usr/local/bin/mpicxx since it is already set!
-- Leaving current CMAKE_Fortran_COMPILER=mpif90 since it is already set!
-- MPI_EXEC='/usr/local/bin/mpiexec'
-- The C compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/bin/mpicc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- CMAKE_C_COMPILER_ID='AppleClang'
-- CMAKE_C_COMPILER_VERSION='12.0.0.12000032'
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /usr/local/bin/mpicxx
-- Check for working CXX compiler: /usr/local/bin/mpicxx - broken
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.20/Modules/CMakeTestCXXCompiler.cmake:59 (message):
The C++ compiler
"/usr/local/bin/mpicxx"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/weiqiangguo/Downloads/Trilinos/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make -f Makefile cmTC_690b0/fast && /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_690b0.dir/build.make CMakeFiles/cmTC_690b0.dir/build
Building CXX object CMakeFiles/cmTC_690b0.dir/testCXXCompiler.cxx.o
/usr/local/bin/mpicxx -O3 -g -fopenmp -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -std=gnu++14 -MD -MT CMakeFiles/cmTC_690b0.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_690b0.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_690b0.dir/testCXXCompiler.cxx.o -c /Users/weiqiangguo/Downloads/Trilinos/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
clang: error: unsupported option '-fopenmp'
make[1]: *** [CMakeFiles/cmTC_690b0.dir/testCXXCompiler.cxx.o] Error 1
make: *** [cmTC_690b0/fast] Error 2
CMake will not be able to correctly generate this project.
我真的不知道怎么解决。我还尝试将 gcc complier 设置为自制 gcc 而不是 clang。
谁能帮我解决这个问题?
Xcode 工具链不支持 OpenMP。
除了他们希望您改用 Apple 特定的 API(这显然不等同)之外,没有其他技术原因。
要使用 OpenMP,您可以使用 LLVM Clang/libc++/libopenmp,您应该可以 to install through Homebrew:
brew install --with-toolchain llvm
或自己从源代码构建。
平台:macOS 11.1
当我尝试配置 Trilinos 时,我遇到了一个问题,我无法处理它。 以下命令用于编译Trilinos:
#!/bin/bash
rm -rf CMakeCache.txt
rm -rf CMakeFiles
rm -rf CMakeCache.txt
cmake \
-D CMAKE_INSTALL_PREFIX:PATH=/Users/weiqiangguo/Downloads/Trilinos/build \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_SHARED_LIBS:BOOL=ON \
\
-D TPL_ENABLE_MPI:BOOL=ON \
-D TPL_ENABLE_BLAS:BOOL=ON \
-D TPL_ENABLE_LAPACK:BOOL=ON \
-D TPL_ENABLE_Pthread:BOOL=ON \
-D TPL_ENABLE_HWLOC:BOOL=ON \
-D TPL_ENABLE_HDF5:BOOL=ON \
-D TPL_ENABLE_SCALAPACK:BOOL=ON \
-D TPL_ENABLE_SuperLU:BOOL=ON \
-D TPL_ENABLE_SuperLUDist:BOOL=ON \
-D TPL_ENABLE_METIS:BOOL=ON \
-D TPL_ENABLE_ParMETIS:BOOL=ON \
\
-D ML_ENABLE_SuperLU:BOOL=OFF \
\
-D CMAKE_C_COMPILER:STRING="mpicc" \
-D CMAKE_CXX_COMPILER:FILEPATH=/usr/local/bin/mpicxx \
-D CMAKE_Fortran_COMPILER:STRING="mpif90" \
-D CMAKE_CXX_FLAGS:STRING="-O3 -g -fopenmp" \
\
-D TPL_SCALAPACK_LIBRARIES='/usr/local/lib/libscalapack.dylib' \
\
-D Teuchos_ENABLE_COMPLEX=ON \
\
-D Trilinos_ENABLE_ALL_PACKAGES:BOOL=OFF \
-D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=OFF \
-D Trilinos_ENABLE_ML:BOOL=ON \
-D Trilinos_ENABLE_Belos:BOOL=ON \
-D Trilinos_ENABLE_Epetra:BOOL=ON \
-D Trilinos_ENABLE_EpetraExt:BOOL=ON \
-D Trilinos_ENABLE_Ifpack:BOOL=ON \
-D Trilinos_ENABLE_Amesos:BOOL=ON \
-D Trilinos_ENABLE_Anasazi:BOOL=ON \
-D Trilinos_ENABLE_NOX:BOOL=ON \
-D Trilinos_ENABLE_Teko:BOOL=ON \
-D Trilinos_ENABLE_Galeri:BOOL=ON \
-D Trilinos_ENABLE_OpenMP:BOOL=OFF \
-D Trilinos_ENABLE_PyTrilinos:BOOL=ON \
\
-D MPI_BASE_DIR:FILEPATH="/usr/local/Cellar/open-mpi" \
-D PYTHON_EXECUTABLE:FILEPATH="/usr/bin/python3" \
-D SuperLU_LIBRARY_DIRS:FILEPATH="/usr/local/lib" \
-D SuperLU_INCLUDE_DIRS:FILEPATH="/usr/local/include" \
-D SuperLUDist_LIBRARY_DIRS:FILEPATH="/usr/local/lib" \
-D SuperLUDist_INCLUDE_DIRS:FILEPATH="/usr/local/include" \
../
错误信息如下:
Probing the environment ...
-- USE_XSDK_DEFAULTS='FALSE'
-- BUILD_SHARED_LIBS='ON'
-- CMAKE_BUILD_TYPE='Release'
-- MPI_BASE_DIR='/usr/local/Cellar/open-mpi'
-- MPI_BIN_DIR='/usr/local/Cellar/open-mpi/bin'
-- MPI_USE_COMPILER_WRAPPERS='ON'
-- Leaving current CMAKE_C_COMPILER=mpicc since it is already set!
-- Leaving current CMAKE_CXX_COMPILER=/usr/local/bin/mpicxx since it is already set!
-- Leaving current CMAKE_Fortran_COMPILER=mpif90 since it is already set!
-- MPI_EXEC='/usr/local/bin/mpiexec'
-- The C compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/bin/mpicc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- CMAKE_C_COMPILER_ID='AppleClang'
-- CMAKE_C_COMPILER_VERSION='12.0.0.12000032'
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /usr/local/bin/mpicxx
-- Check for working CXX compiler: /usr/local/bin/mpicxx - broken
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.20/Modules/CMakeTestCXXCompiler.cmake:59 (message):
The C++ compiler
"/usr/local/bin/mpicxx"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/weiqiangguo/Downloads/Trilinos/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make -f Makefile cmTC_690b0/fast && /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_690b0.dir/build.make CMakeFiles/cmTC_690b0.dir/build
Building CXX object CMakeFiles/cmTC_690b0.dir/testCXXCompiler.cxx.o
/usr/local/bin/mpicxx -O3 -g -fopenmp -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -std=gnu++14 -MD -MT CMakeFiles/cmTC_690b0.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_690b0.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_690b0.dir/testCXXCompiler.cxx.o -c /Users/weiqiangguo/Downloads/Trilinos/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
clang: error: unsupported option '-fopenmp'
make[1]: *** [CMakeFiles/cmTC_690b0.dir/testCXXCompiler.cxx.o] Error 1
make: *** [cmTC_690b0/fast] Error 2
CMake will not be able to correctly generate this project.
我真的不知道怎么解决。我还尝试将 gcc complier 设置为自制 gcc 而不是 clang。
谁能帮我解决这个问题?
Xcode 工具链不支持 OpenMP。 除了他们希望您改用 Apple 特定的 API(这显然不等同)之外,没有其他技术原因。
要使用 OpenMP,您可以使用 LLVM Clang/libc++/libopenmp,您应该可以 to install through Homebrew:
brew install --with-toolchain llvm
或自己从源代码构建。