'make' 找不到头文件

Header files not found by 'make'

make 指令未找到编译所需的库。它们不在通常的 /usr/include 文件夹中。

我正在使用一个名为 magnum.fe 的模拟软件我已经安装了所有必需的依赖项 (FEniCS = 1.5 CMake >= 2.8 痛饮 >= 2.0 G++ >= 4.0) 并按照说明开始 运行 make

$ cd /path/to/magnum.fe
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install

但是当 运行ning make 我得到以下错误:

/usr/include/petscsys.h:136:12: fatal error: petsc/mpiuni/mpi.h: No such file or directory
  136 | #  include <petsc/mpiuni/mpi.h>
      |            ^~~~~~~~~~~~~~~~~~~~
compilation terminated.

文件确实存在,但在其他文件夹中:/home/myusername/bin/petsc/include/mpiuni/mpi.h

我使用以下指令在 /home/myusername/bin/petsc/ 上编译了 petsc

$ ./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-mpich --download-fblaslapack
$ make all check

它编译成功,但我无法完成 magnum.fe 编译。

我尝试将每个头文件移动到 /usr/include,但现在如果将整个 petsc 目录移动到此文件夹中,我会卡住。这一定是一种更优雅的方式。

谢谢

我做到了!

有两个选项可用:

指定库与编辑MAKE文件的make命令一起使用,使用变量LDLIBS进行设置。详细用法在这里:https://web.archive.org/web/20070723140628/http://arco.inf-cr.uclm.es/~david.villa/doc/repo/make/make.html#AEN36

创建指向 /usr/include 的符号链接。就我而言,我使用了:

ln -s /home/myusername/bin/petsc/include/* /usr/include