Compiling Elmer FEM on macOS Mojave causes the fatal error: 'string.h' file not found

筅森魡賤 提交于 2021-02-11 14:10:30

问题


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

installer: The install failed (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.)

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.


回答1:


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:

  1. install qt4 with brew install cartr/qt4/qt@4 from here
  2. install qwt with brew install cartr/qt4/qwt-qt4
  3. 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/ ..


来源:https://stackoverflow.com/questions/60586977/compiling-elmer-fem-on-macos-mojave-causes-the-fatal-error-string-h-file-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!