问题描述
我正在尝试遵循这些说明来编译版本10.14.6 上的href ="http://www.elmerfem.org/blog/" rel ="nofollow noreferrer"> Elmer FEM .但是,在运行 make install
时,出现错误消息:
.../elmerfem/umfpack/src/umfpack/include/umf_internal.h:29:10:致命错误:找不到'string.h'文件#include< string.h>^ ~~~~~~~~~~产生1个错误.make [2]:*** [umfpack/src/umfpack/umfpack_zl_save_symbolic.c]错误1make [2]:***删除文件`umfpack/src/umfpack/umfpack_zl_save_symbolic.c'make [1]:*** [umfpack/src/umfpack/CMakeFiles/umfpack.dir/all]错误2制作:*** [全部]错误2
搜索互联网这篇文章建议
-
xcode-select --install
-
sudo xcode-select --switch/Library/Developer/CommandLineTools/
在我的案例中之前已经完成,并且对上述错误没有影响.此和此发表建议
sudo安装程序-pkg/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target/-allowUntrusted
这将导致错误消息
如果您能帮助我知道问题出在哪里以及如何解决,我将不胜感激.感谢您的提前支持.
PS1.根据要求在此,我的 make
版本是 GNU Make 3.81
.
PS2.我的硬盘驱动器上的 string.h
文件列表此处.
PS3..将CMake的输出粘贴到此处.
好的,我想我已经解决了问题.从此处,我跑了
cmake -DCMAKE_C_COMPILER =/usr/bin/gcc -DCMAKE_CXX_COMPILER =/usr/bin/g ++ ..
同时位于 build
文件夹中.然后 make.
正常工作,但有一些警告.我仍然不确定是什么问题,或者这是否是最佳/规范的解决方案.因此,除非其他人提供更好的解决方案,否则我不会将其标记为可接受的解决方案.
PS1.我在此处也可以使用Elmer的HomeBrew公式.
P.S.2.要使用OpenMP和MPI进行编译,请执行以下操作:
cmake -DCMAKE_C_COMPILER =/usr/local/Cellar/gcc/9.2.0_3/bin/gcc-9 -DCMAKE_CXX_COMPILER =/usr/local/Cellar/gcc/9.2.0_3/bin/g ++-9-DWITH_Mumps = FALSE -DWITH_MPI = TRUE -DWITH_OpenMP = TRUE -DWITH_MKL = FALSE -DWITH_ELMERGUI = TRUE -DWITH_ELMERPOST = FALSE -DWITH_ELMERGUITESTER = FALSE ..
我通过HomeBrew安装了GNU GCC和OpenMPI.
brew install gcc open-mpi .
P.S.3..如果您还希望安装ElmerGUI:
- 从此处
- 使用
brew install cartr/qt4/qt @ 4
来安装qt4. - 使用
brew install cartr/qt4/qwt-qt4
安装qwt - 然后
cmake -DCMAKE_C_COMPILER =/usr/local/Cellar/gcc/9.2.0_3/bin/gcc-9 -DCMAKE_CXX_COMPILER =/usr/local/Cellar/gcc/9.2.0_3/bin/g ++-9-DWITH_Mumps = FALSE -DWITH_MPI = TRUE -DWITH_OpenMP = TRUE -DWITH_MKL = FALSE -DWITH_ELMERGUI = TRUE -DWITH_ELMERPOST = TRUE -DWITH_ELMERGUITESTER = TRUE -DQWT_INCLUDE_DIR =/usr/local/Cellar/q/qwt.1.3.framework/Versions/6/Headers/..
I'm trying to follow these instructions to compile Elmer FEM on macOS Mojave Version 10.14.6
. However, when running the make install
I get the error message:
.../elmerfem/umfpack/src/umfpack/include/umf_internal.h:29:10: fatal error: 'string.h' file not found
#include <string.h>
^~~~~~~~~~
1 error generated.
make[2]: *** [umfpack/src/umfpack/umfpack_zl_save_symbolic.c] Error 1
make[2]: *** Deleting file `umfpack/src/umfpack/umfpack_zl_save_symbolic.c'
make[1]: *** [umfpack/src/umfpack/CMakeFiles/umfpack.dir/all] Error 2
make: *** [all] Error 2
searching the internet this post suggests
xcode-select --install
sudo xcode-select --switch /Library/Developer/CommandLineTools/
which had already been done before in my case and have no effect on the above error. This and this post suggest
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / -allowUntrusted
which leads to the error message
I would appreciate it if you could help me know what is the problem and how I can resolve it. Thanks for your kind support in advance.
P.S.1. As was asked here, my make
version is GNU Make 3.81
.
P.S.2. the list of string.h
files on my hard drive here.
P.S.3. the output of CMake is pasted here.
OK, I think I solved the problem. From here, I ran
cmake -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ ..
while being inside the build
folder. and then make .
worked fine except some warning. I'm still not sure what was the problem or if this is the optimal/canonical solution. So I will not mark this as the accepted solution until others provide better ones.
P.S.1. I sent a pull request here on Elmer's HomeBrew formula as well.
P.S.2. To compile with OpenMP and MPI:
cmake -DCMAKE_C_COMPILER=/usr/local/Cellar/gcc/9.2.0_3/bin/gcc-9 -DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc/9.2.0_3/bin/g++-9 -DWITH_Mumps=FALSE -DWITH_MPI=TRUE -DWITH_OpenMP=TRUE -DWITH_MKL=FALSE -DWITH_ELMERGUI=TRUE -DWITH_ELMERPOST=FALSE -DWITH_ELMERGUITESTER=FALSE ..
I have GNU GCC and OpenMPI installed via HomeBrew brew install gcc open-mpi
.
P.S.3. If you want the ElmerGUI also installed:
- install qt4 with
brew install cartr/qt4/qt@4
from here - install qwt with
brew install cartr/qt4/qwt-qt4
- then
cmake -DCMAKE_C_COMPILER=/usr/local/Cellar/gcc/9.2.0_3/bin/gcc-9 -DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc/9.2.0_3/bin/g++-9 -DWITH_Mumps=FALSE -DWITH_MPI=TRUE -DWITH_OpenMP=TRUE -DWITH_MKL=FALSE -DWITH_ELMERGUI=TRUE -DWITH_ELMERPOST=TRUE -DWITH_ELMERGUITESTER=TRUE -DQWT_INCLUDE_DIR=/usr/local/Cellar/qwt-qt4/6.1.3_1/lib/qwt.framework/Versions/6/Headers/ ..
这篇关于在macOS Mojave上编译Elmer FEM会导致致命错误:找不到"string.h"文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!