是否可以在 CPython 中禁用 _FILE_OFFSET_BITS==64(作为 Yocto/Poky 包)?

Is it possible to disable _FILE_OFFSET_BITS==64 in CPython (as a Yocto/Poky package)?

我有一个依赖于 Python2.7.

的 bitbake 食谱

我正在尝试编译一个 C 文件(由 CFFI 生成),其中包含 Python.h 和一个包含 fts.h 的库头文件。它失败了

#error "<fts.h> cannot be used with -D_FILE_OFFSET_BITS==64"

我注意到 _FILE_OFFSET_BITSpyconfig.h:1136 中设置为 64,并且该文件是自动生成的,所以我想知道我是否可以阻止此 #define被包含在内,代价是无法访问大于 2GB 的文件。

郑重声明,Python 是通过

收录的

RDEPENDS_${PN} += "python"

在文件中

/common/recipes-core/packagegroups/nativesdk-packagegroup-swi-toolchain.bb

哦,结果很简单!

files/disable-lfs.补丁

--- Python-2.7.3.orig/configure.in
+++ Python-2.7.3/configure.in
@@ -1449,7 +1449,7 @@
 # structures (such as rlimit64) without declaring them. As a
 # work-around, disable LFS on such configurations

-use_lfs=yes
+use_lfs=no
 AC_MSG_CHECKING(Solaris LFS bug)
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #define _LARGEFILE_SOURCE 1

python-native_%.bbappend

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://disable-lfs.patch"