python - python3.8.10 源代码构建错误 [Makefile:617: sharedmods] 错误 139
问题描述
在构建 python3.8.10 源代码上浪费时间。
构建环境:
gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1)
Linux localhost.localdomain 4.18.0-305.19.1.el8_4.x86_64 #1 SMP Wed Sep 15 15:39:39 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux(centos8 x86_64)
File:./Objects/unicodeobject.c
Error:make: *** [Makefile:617: sharedmods] Error 139
让我解释。为了监视连接两个这样的字符串时会发生什么:
src_str = "hello "
dst_str = src_str + "world"
所以,我在函数中插入了一些额外的代码,PyUnicode_Append
我希望这可以帮助我将参数存储到文件中。
void
PyUnicode_Append_Handler(PyObject *left, PyObject *right)
{
FILE* fp = fopen("/home/pyiast/append.log","a+");
if (NULL == fp){
return;
}
PyObject *data = PyUnicode_FromFormat("append:dst=%s, src=%s\n", PyUnicode_AsUTF8(left),PyUnicode_AsUTF8(right));
if (data != NULL){
PyObject_Print(data, fp, 0);
Py_DECREF(data);
}
fclose(fp);
}
void
PyUnicode_Append(PyObject **p_left, PyObject *right)
{
//... other code
assert(_PyUnicode_CheckConsistency(*p_left, 1));
// this is my code
PyUnicode_Append_Handler(left, right);
}
重新制作此代码时,会发生错误。
if test $? -ne 0 ; then \
echo "generate-posix-vars failed" ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
CC='gcc -pthread' LDSHARED='gcc -pthread -shared ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall' _TCLTK_INCLUDES='' _TCLTK_LIBS='' ./python -E ./setup.py build
/bin/sh: line 9: 30341 Segmentation fault (core dumped) CC='gcc -pthread' LDSHARED='gcc -pthread -shared ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall' _TCLTK_INCLUDES='' _TCLTK_LIBS='' ./python -E ./setup.py $quiet build
make: *** [Makefile:617: sharedmods] Error 139
如果有人遇到这个问题,请帮助我。</p>
解决方案
推荐阅读
- android - Android Q ADB/SHELL命令禁用应用中的所有通知,有Root
- java - 使用 protobuf for java 时使用 gradle 重复处理策略错误
- azure - Terraform如何跳过1个工作区的参数
- java - Wicket:由于浏览器信息扩展,需要双重登录
- dayjs - Dayjs 中的 isSame 方法是否会自动将日期转换为 UTC?
- matlab - 如果 A 和 B 都是相同大小的行向量,那么操作 A'\B' 会做什么?
- python - Python AttributeError:'function'对象没有属性'verify_mode'
- git - 使用 PR 打补丁
- java - spark-cassandra-connector - repartitionByCassandraReplica 返回空 RDD - Java
- python - 如何使用 KL Divergence 进行 8 位量化校准