[英]How do I resolve this make fatal error: numpy/arrayobject.h: No such file or directory?
I have the following snippet in my makefile
(the first line was added by me after finding it as a candidate solution online - unfortunately, it doesn't work):我的makefile
中有以下代码段(第一行是我在网上找到它作为候选解决方案后添加的 - 不幸的是,它不起作用):
$(shell set(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} /usr/local/lib/python3.5/dist-packages/numpy/core/include))
all: obj $(EXEC) link
$(EXEC): $(OBJS)
$(CC) $(COMMON) -I./src/factor $(CFLAGS) $^ -o $@ $(LDFLAGS)
$(CC) -shared $(COMMON) -I./src/factor $(CFLAGS) $^ -o $(SHAREDLIB) $(LDFLAGS)
$(OBJDIR)%.o: %.c $(DEPS)
$(CC) $(COMMON) -I./src/factor $(CFLAGS) -c $< -o $@
I verified that numpy/arrayobject.h
is in /usr/local/lib/python3.5/dist-packages/numpy/core/include
on my system.我验证了numpy/arrayobject.h
在我的系统上的/usr/local/lib/python3.5/dist-packages/numpy/core/include
中。 After executing make
I get:执行make
后,我得到:
gcc -I ./include -I/usr/include/python3.5 -DGPU -I/usr/local/cuda-10.0/include/ -DCUDNN -I./src/factor -Wall -Wfatal-errors -fPIC -Ofast -DGPU -DCUDNN -c ./src/ComputationPy.c -o obj/ComputationPy.o
./src/ComputationPy.c:12:31: fatal error: numpy/arrayobject.h: No such file or directory
compilation terminated.
Makefile:51: recipe for target 'obj/ComputationPy.o' failed
make: *** [obj/ComputationPy.o] Error 1
Line 51 corresponds to the last line of the snippet.第 51 行对应于代码段的最后一行。
Without seeing the complete Makefile it's hard to be sure what's wrong, but this line looks like it can't possibly be correct:没有看到完整的 Makefile 很难确定出了什么问题,但这条线看起来不可能是正确的:
$(shell set(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} /usr/local/lib/python3.5/dist-packages/numpy/core/include))
In GNU make, $(shell...)
runs sh -c "..."
[technically, $(SHELL) -c "..."
) and evaluates to whatever that command prints on its stdout.在 GNU make 中, $(shell...)
运行sh -c "..."
[技术上, $(SHELL) -c "..."
) 并评估该命令在其标准输出上打印的任何内容。 set(...)
is not valid sh syntax, and also, the stuff inside $(shell...)
cannot change Make variables. set(...)
不是有效的 sh 语法,而且$(shell...)
里面的东西不能改变 Make 变量。 I would expect this line to print an error message as part of the make log, something like我希望这一行会打印一条错误消息作为 make 日志的一部分,例如
sh: 1: Syntax error: word unexpected (expecting ")")
and otherwise have no effect.否则无效。
Assuming the goal here is to append /usr/local/lib/python3.5/dist-packages/numpy/core/include
to the value of the Make variable PYTHON_INCLUDE_DIRS
, the way to do that is with +=
:假设这里的目标是 append /usr/local/lib/python3.5/dist-packages/numpy/core/include
到 Make 变量PYTHON_INCLUDE_DIRS
的值,这样做的方法是使用+=
:
PYTHON_INCLUDE_DIRS += /usr/local/lib/python3.5/dist-packages/numpy/core/include
The rules you quoted don't directly make use of this variable, but I suspect there may be a reference to it hiding inside $(COMMON)
.您引用的规则不直接使用此变量,但我怀疑可能在$(COMMON)
中隐藏了对它的引用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.