【问题标题】:Trying to compile Python fails because of files' timestamps由于文件的时间戳,尝试编译 Python 失败
【发布时间】:2016-09-08 14:04:39
【问题描述】:

我想编译 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 所说:

...
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 ...

是否有适当的方法来防止这种行为?

谢谢,

【问题讨论】:

  • 通常有一个 .PHONY 目标 all 作为 makefile 中的第一个目标,例如 all : target1 target2makemake all 将始终重新制作 target1 和 target2。
  • 另一个尝试是make -Bmake --always-make
  • @ElpieKay 谢谢。

标签: python git makefile compilation


【解决方案1】:

显然这是已知问题。结帐后使用make touch,然后make 应该可以工作。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多