Ubuntu upgrade Python error pydtrace_probes.h: No such file or directory

System environment: Ubuntu

When I downloaded the offline package of version 3.9.2 to install Python on HUAWEI CLOUD ( https://mirrors.huaweicloud.com/python/3.9.2/ ), I encountered the following problem and reported an error:

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

Try to search online to solve this problem, but did not find relevant materials, and finally after research, modify the pydtrace.h file to solve this problem

The introduction of DTrace is as follows: (Source Baidu Encyclopedia)
DTrace (full name Dynamic Tracing), also known as dynamic tracing, is a tool developed by Sun™ to find system bottlenecks on production and experimental production systems, which can be used for The technology that the kernel (kernel) and user application (user application) perform dynamic tracking and does not pose any danger to the operation of the system. It is not a debugging tool in any case, but a real-time system analysis tool to find performance and other problems. DTrace is a particularly good analysis tool, with a large number of features to help diagnose system problems. You can also use pre-written scripts to take advantage of its capabilities. Users can also create their own customized analysis tools by using DTrace D language to meet specific needs.

Obviously we don't need this function, so we can try to shield the reference of the header file

Find the error file, the content is as follows:

//原始内容
#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

When configuring the python offline package, the configuration content is clearly no, but the header file is still referenced for some reason

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

Guess you like

Origin blog.csdn.net/Wangguang_/article/details/126880647