【问题标题】:Header files not found by 'make'“make”找不到头文件
【发布时间】:2020-12-05 17:47:31
【问题描述】:

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

但是在运行 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 目录移动到此文件夹中,我会卡住。这一定是一种更优雅的方式。

谢谢

【问题讨论】:

  • 我发现我可以使用 LDLIBS 行指定要在 make 文件中使用的库。但我做不到,所以我将整个 ...petsc/include 文件夹复制到 /usr/include 并工作

标签: makefile compiler-errors mpi petsc


【解决方案1】:

我成功了!

有两种选择:

指定库与 make 命令一起使用编辑 MAKEfile,使用变量 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-26
    • 1970-01-01
    • 2021-11-20
    相关资源
    最近更新 更多