Ubuntu升级Python报错pydtrace_probes.h: No such file or directory

系统环境:Ubuntu

在华为云(https://mirrors.huaweicloud.com/python/3.9.2/)下载了3.9.2版本的离线包以安装Python时,遇到以下问题报错:

In file included from Python/ceval.c:30:0:
./Include/pydtrace.h:11:10: fatal error: pydtrace_probes.h: No such file or directory
 #include "pydtrace_probes.h"
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:1782: recipe for target 'Python/ceval.o' failed
make[3]: *** [Python/ceval.o] Error 1
make[3]: Leaving directory '/home/wang/Downloads/Python-3.9.2'
Makefile:531: recipe for target 'build_all_generate_profile' failed
make[2]: *** [build_all_generate_profile] Error 2
make[2]: Leaving directory '/home/wang/Downloads/Python-3.9.2'
Makefile:505: recipe for target 'profile-gen-stamp' failed
make[1]: *** [profile-gen-stamp] Error 2
make[1]: Leaving directory '/home/wang/Downloads/Python-3.9.2'
Makefile:516: recipe for target 'profile-run-stamp' failed
make: *** [profile-run-stamp] Error 2

尝试网上搜索解决此问题,并没有找到相关材料,最终经过研究,修改pydtrace.h文件解决此问题

有关Dtrace的介绍如下:(来源百度百科)
DTrace(全称Dynamic Tracing),也称为动态跟踪,是由 Sun™ 开发的一个用来在生产和试验性生产系统上找出系统瓶颈的工具,可以对内核(kernel)和用户应用程序(user application)进行动态跟踪并且对系统运行不构成任何危险的技术。在任何情况下它都不是一个调试工具, 而是一个实时系统分析寻找出性能及其他问题的工具。 DTrace 是个特别好的分析工具,带有大量的帮助诊断系统问题的特性。还可以使用预先写好的脚本利用它的功能。 用户也可以通过使用 DTrace D 语言创建他们自己定制的分析工具, 以满足特定的需求。

很显然我们并不需要这个功能,因此可以尝试屏蔽该头文件的引用

找到报错的文件,内容如下:

//原始内容
#ifdef WITH_DTRACE

//修改后的内容
#ifndef WITH_DTRACE

#include "pydtrace_probes.h"

/* pydtrace_probes.h, on systems with DTrace, is auto-generated to include
   `PyDTrace_{PROBE}` and `PyDTrace_{PROBE}_ENABLED()` macros for every probe
   defined in pydtrace_provider.d.

   Calling these functions must be guarded by a `PyDTrace_{PROBE}_ENABLED()`
   check to minimize performance impact when probing is off. For example:

       if (PyDTrace_FUNCTION_ENTRY_ENABLED())
           PyDTrace_FUNCTION_ENTRY(f);
*/

#else

在配置python离线包时,配置内容明明是no,但不知为何仍会引用头文件

checking for --with-valgrind... no
checking for --with-dtrace... no
checking for dlopen... yes

猜你喜欢

转载自blog.csdn.net/Wangguang_/article/details/126880647