我正试图从DTU编译这个项目。该项目要求安装PETSc。
我已将PETSc安装到/Users/hornymoose/petsc-3.13.3/
我已经提取了GitHub到/Users/hornymoose/dtu
的zip
DTU项目的makefile
具有以下线路:
include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules
include ${PETSC_DIR}/lib/petsc/conf/test
在这些行中,{PETSC_DIR}
将替换为用户的PETSc安装目录。因此,我将这些行更改为:
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
为了编译代码,我在Terminal中编写了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中使用终端非常陌生。提前谢谢!
路径中有一个$
:
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
您可以通过环境变量提供它,而不是手动替换生成文件中的PETSC_DIR(假设PETSC生成文件不错(:
export PETSC_DIR=/Users/hornymoose/petsc-3.13.3
make topopt
或:
PETSC_DIR=/Users/hornymoose/petsc-3.13.3 make topopt
或者将其值传递给make调用:
make topopt PETSC_DIR=/Users/hornymoose/petsc-3.13.3