首页 > 解决方案 > 编译包含 PETSc 库的 C++ 代码。make: 没有规则来制作目标错误信息

问题描述

我对使用这里讨论的开源代码很感兴趣。此处讨论了有关如何运行代码的框架和一些说明。为了能够使用代码,首先应该安装PETSc。我已经这样做了,它似乎已正确安装。当我尝试按照论文make topopt中给出的说明(第 2.2 节)运行时,问题就出现了。在GitHub 上有一个地方,按照本文中给出的说明,我进行了以下更改:和. 运行后出现以下错误:makefile_refPETSC_DIR=\home\myusername\petscPETSC_ARCH=arch-linux-c-debugmake -d topopt

GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating makefiles....
 Considering target file 'GNUmakefile'.
  File 'GNUmakefile' does not exist.
  Looking for an implicit rule for 'GNUmakefile'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.o'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.c'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.cc'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.C'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.cpp'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.p'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.f'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.F'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.m'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.r'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.s'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.S'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.mod'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.sh'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile,v'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'RCS/GNUmakefile,v'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'RCS/GNUmakefile'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 's.GNUmakefile'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'SCCS/s.GNUmakefile'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.o'.
  Looking for a rule with intermediate file 'GNUmakefile.o'.
   Avoiding implicit rule recursion.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.c'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.cc'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.C'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.cpp'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.p'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.f'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.F'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.m'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.r'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.s'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.S'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.mod'.
   Trying pattern rule with stem 'GNUmakefile.o'.
   Trying implicit prerequisite 'GNUmakefile.o,v'.
   Trying pattern rule with stem 'GNUmakefile.o'.
   Trying implicit prerequisite 'RCS/GNUmakefile.o,v'.
   Trying pattern rule with stem 'GNUmakefile.o'.
   Trying implicit prerequisite 'RCS/GNUmakefile.o'.
   Trying pattern rule with stem 'GNUmakefile.o'.
   Trying implicit prerequisite 's.GNUmakefile.o'.
   Trying pattern rule with stem 'GNUmakefile.o'.
   Trying implicit prerequisite 'SCCS/s.GNUmakefile.o'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.c'.
   Looking for a rule with intermediate file 'GNUmakefile.c'.
    Avoiding implicit rule recursion.
    Avoiding implicit rule recursion.
    Trying pattern rule with stem 'GNUmakefile'.
    Trying implicit prerequisite 'GNUmakefile.y'.
    Trying pattern rule with stem 'GNUmakefile'.
.
.
.
.
.
.
.
.
.
.
Looking for a rule with intermediate file 'topopt.mod'.
   Avoiding implicit rule recursion.
   Avoiding implicit rule recursion.
   Trying pattern rule with stem 'topopt.mod'.
   Trying implicit prerequisite 'topopt.mod,v'.
   Trying pattern rule with stem 'topopt.mod'.
   Trying implicit prerequisite 'RCS/topopt.mod,v'.
   Trying pattern rule with stem 'topopt.mod'.
   Trying implicit prerequisite 'RCS/topopt.mod'.
   Trying pattern rule with stem 'topopt.mod'.
   Trying implicit prerequisite 's.topopt.mod'.
   Trying pattern rule with stem 'topopt.mod'.
   Trying implicit prerequisite 'SCCS/s.topopt.mod'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.c'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.cc'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.C'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.cpp'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.p'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.f'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.F'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.m'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.r'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.s'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.S'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.mod'.
 Trying pattern rule with stem 'topopt'.
 Trying implicit prerequisite 'topopt.sh'.
 Looking for a rule with intermediate file 'topopt.sh'.
  Avoiding implicit rule recursion.
  Trying pattern rule with stem 'topopt.sh'.
  Trying implicit prerequisite 'topopt.sh,v'.
  Trying pattern rule with stem 'topopt.sh'.
  Trying implicit prerequisite 'RCS/topopt.sh,v'.
  Trying pattern rule with stem 'topopt.sh'.
  Trying implicit prerequisite 'RCS/topopt.sh'.
  Trying pattern rule with stem 'topopt.sh'.
  Trying implicit prerequisite 's.topopt.sh'.
  Trying pattern rule with stem 'topopt.sh'.
  Trying implicit prerequisite 'SCCS/s.topopt.sh'.
 No implicit rule found for 'topopt'.
 Finished prerequisites of target file 'topopt'.
Must remake target 'topopt'.
make: *** No rule to make target 'topopt'.  Stop.

上面的代码只是整个消息的一部分(开始部分和结束部分)。

我正在开发 Ubuntu 20.04。

提前致谢。

标签: c++makefileubuntu-20.04finite-element-analysispetsc

解决方案


有一个makefile_ref地方按照本文中给出的说明进行了以下更改[...]

如果没有指定要读取的生成文件的显式选项,该make实用程序会通过几个替代名称查找输入文件。makefile_ref不是其中之一。我将文件名的“_ref”部分作为“参考”的助记符,从这个角度来看,意图似乎是您复制makefile_ref到,比如说,makefile(默认情况下查找的文件名之一),make 修改复制到适合您的环境。


推荐阅读