我正在尝试编译this project from DTU。此项目需要安装PETSc。
我已经在/Users/hornymoose/petsc-3.13.3/
上安装了PETSc
我已经解压了GitHub到/Users/hornymoose/dtu
的压缩文件
DTU项目的makefile
包含以下行:
include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules
include ${PETSC_DIR}/lib/petsc/conf/test
在这些行中,将用用户的PETSc安装目录替换{PETSC_DIR}
。因此,我将这些行改为:
include $/Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables
include $/Users/hornymoose/petsc-3.13.3/lib/petsc/conf/rules
include $/Users/hornymoose/petsc-3.13.3/lib/petsc/conf/test
为了编译代码,我在终端中编写了make topopt
。这样做会产生以下结果:
makefile:13: Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables: No such file or directory
makefile:14: Users/hornymoose/petsc-3.13.3/lib/petsc/conf/rules: No such file or directory
makefile:15: Users/hornymoose/petsc-3.13.3/lib/petsc/conf/test: No such file or directory
make: *** No rule to make target `Users/jhutopopt/petsc-3.13.3/lib/petsc/conf/test'. Stop.
我已经返回并手动检查了Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables
、...rules
和...test
是否确实存在并且没有错误。
为什么我会收到这个错误?我是否在我的makefile
中错误地指出了目录?makefile
中的语法是否不正确?
我相信有一个简单的解决方案,我只是对在MacOS中使用终端非常陌生。提前谢谢你!
发布于 2020-07-11 17:08:03
路径中有一个$
:
include $/Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables
^
这会导致/
被视为变量,并扩展为空,因为从未设置过。运行带有--warn-undefined-variables
选项的make
,以获得有关此类事件的警告。也许在这一点上已经很明显了,但正确的线条应该是:
include /Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables
您可以通过环境变量提供它,而不是手动替换makefile中的PETSC_DIR (假设PETSc makefile不坏):
export PETSC_DIR=/Users/hornymoose/petsc-3.13.3
make topopt
...or:
PETSC_DIR=/Users/hornymoose/petsc-3.13.3 make topopt
...or将其值传递给make调用:
make topopt PETSC_DIR=/Users/hornymoose/petsc-3.13.3
https://stackoverflow.com/questions/62843341
复制相似问题