尝试编译Python失败,因为文件'时间戳

时间:2016-09-08 14:04:40

标签: python git makefile compilation

我想编译Python;我从Github克隆了存储库:

git clone --depth=1 --branch=2.7 https://github.com/python/cpython.git

配置工作但构建失败,因为找不到Python:

$ cd cpython
$ ./configure
...
$ make
/bin/mkdir -p Include
./Parser/asdl_c.py -h Include ./Parser/Python.asdl
/usr/bin/env: python: No such file or directory
Makefile:718: recipe for target 'Include/Python-ast.h' failed
make: *** [Include/Python-ast.h] Error 127

这是因为Include/Python-ast.hParser/asdl_c.py更新,make --debug告诉{/ 1}}

...
Prerequisite 'Parser/Python.asdl' is newer than target 'Include/Python-ast.h'.
Prerequisite 'Parser/asdl.py' is newer than target 'Include/Python-ast.h'.
Prerequisite 'Parser/asdl_c.py' is newer than target 'Include/Python-ast.h'.
Must remake target 'Include/Python-ast.h'.

确实,在Python脚本之后克隆了一些标题:

$ ls --full-time Include/Python-ast.h Parser/asdl_c.py
-rw-r--r-- 1 piwi piwi 21113 2016-09-08 15:22:32.984000000 +0200 Include/Python-ast.h
-rwxr-xr-x 1 piwi piwi 41414 2016-09-08 15:22:33.248000000 +0200 Parser/asdl_c.py

在这种特定情况下,触摸标题可以解决问题:

$ touch Include/Python-ast.h
$ make
... compiles ...

是否有适当的方法来阻止此行为?

谢谢,

1 个答案:

答案 0 :(得分:1)

显然这是已知的问题。结帐后使用make touch,然后make应该有效。

请参阅https://github.com/python/cpython/blob/b72e279bfa0eece094f652b9fc329200d5964ffa/Makefile.pre.in#L1504