![](/img/trans.png)
[英]Compiling through macOS Terminal, fatal error: stdio.h: No such file or directory
[英]Attempting to compile through MacOS Terminal: “No such file or directory”
我正在尝试从 DTU 编译这个项目。 该项目需要安装PETSc 。
我已将 PETSc 安装到/Users/hornymoose/petsc-3.13.3/
我已将 zip 从 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_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
为了编译代码,我在终端中编写了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
您可以通过环境变量提供它,而不是手动替换 makefile 中的 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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.