首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >编译C++代码,包括PETSc库。make:没有生成目标错误消息的规则

编译C++代码,包括PETSc库。make:没有生成目标错误消息的规则
EN

Stack Overflow用户
提问于 2021-04-19 18:31:39
回答 2查看 287关注 0票数 0

我对使用讨论过的这里的开放源代码很感兴趣。讨论了如何运行代码的框架和一些说明,并对这里进行了讨论。要能够使用代码,首先应该安装PETSc。我已经这样做了,它似乎是正确的安装。当我按照make topopt中给出的指令运行时,问题就会出现(第2.2节)。在GitHub上存在一个makefile_ref,它按照中的指令进行以下更改:PETSC_DIR=\home\myusername\petscPETSC_ARCH=arch-linux-c-debug。在运行make -d topopt之后,我得到以下错误:

代码语言:javascript
运行
复制
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上工作。

提前谢谢。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-04-21 13:05:29

答案:

事实上,编译GitHub上给出的拓扑优化代码并不是那么复杂。在这里,我重申了已经给出的关于GitHub的说明,并给出了更多的细节。

要使用PETSc运行拓扑优化开源代码,首先需要安装PETSc。您应该注意,要安装PETSc,您需要安装BLAS和LAPACK库,它非常简单,并在PETSc中给出了说明。既然PETSc已经安装在系统上,就只需从GitHub克隆TopOpt_in_PETSc。

您将找到一个名为makefile_ref的文件,将该文件的名称更改为makefile,然后打开它,并在代码的前两行修改路径,这将类似于PETSC_DIR=/home/username/petscPETSC_ARCH=arch-linux-c-debug (在我的例子中是这样,根据您的计算机可能有所不同)。前者是在本地计算机上安装PETSc的目录的路径,后者是PETSc的构建名称。

一旦完成了上述操作,您就可以运行make topopt,它将构建一个名为topopt的可执行文件。按照中给出的指令,您将能够运行拓扑优化模拟。

备注:上面给出的安装说明是在ubuntu20.04LTS上执行的,尽管PETSc也兼容iOS和iOS,甚至是安卓。另一方面,TopOpt_in_PETSc是在linux上开发和实现的,很可能需要在linux上安装进一步的操作。

票数 0
EN

Stack Overflow用户

发布于 2021-04-20 15:58:04

有一个makefile_ref,按照论文中的说明,我做了以下修改.

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67167502

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档