无法静态地使用模块“testcapimodule”生成CPython3.6

2024-04-16 19:27:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用以下文档从GitHub静态构建CPython3.6:

https://wiki.python.org/moin/BuildStatically

将*共享*更改为*静态*

并且只在Modules/Setup文件中取消了模块“testcapimodule”的注释:

_testcapi_testcapimodule.c#PythonC API测试模块

和“make LINKFORSHARED=”“”一起跑

不过,我有错误:

    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes    -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers   -I. -I./Include    -DPy_BUILD_CORE  -c ./Modules/_testcapimodule.c -o Modules/_testcapimodule.o
./Modules/_testcapimodule.c: In function ‘test_datetime_capi’:
        ./Modules/_testcapimodule.c:2191:9: error: ‘PyDateTimeAPI’ undeclared (first use in this function)
             if (PyDateTimeAPI) {
                 ^
        ./Modules/_testcapimodule.c:2191:9: note: each undeclared identifier is reported only once for each function it appears in
        ./Modules/_testcapimodule.c:2203:5: error: ‘PyDateTime_IMPORT’ undeclared (first use in this function)
             PyDateTime_IMPORT;
             ^
        ./Modules/_testcapimodule.c:2208:1: warning: control reaches end of non-void function [-Wreturn-type]
         }
         ^
        make: *** [Modules/_testcapimodule.o] Error 1

但当我用“共享”构建Cpython3.6时,它可以成功。在


Tags: 模块inmodulesmakeunuseduse静态function