-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Open
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesOS-netbsdbuildThe build process and cross-buildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
CPython fails to build with DTrace support on NetBSD.
System library conflicts
- NetBSD dtrace requires-x nolibs
flag to avoid system library conflictsMake automatic variable expansion failure
-$<
automatic variable doesn't expand properly in NetBSD MakeConfigure detection failure
- The configure script's DTrace linking test fails on NetBSD, causingDTRACE_OBJS
to remain empty
Environment
OS: NetBSD 10.0
Architecture: x86_64
$ dtrace -V
dtrace: Sun D 1.13
Configuration
./configure --with-dtrace --with-pydebug
Build
$ make
Output:
--- check-clean-src ---
--- check-app-store-compliance ---
--- Include/pydtrace_probes.h ---
--- build/scripts-3.15/idle3.15 ---
--- build/scripts-3.15/pydoc3.15 ---
--- python-config ---
--- Programs/_freeze_module.o ---
--- Modules/getpath_noop.o ---
--- Include/pydtrace_probes.h ---
mkdir -p Include
--- Programs/_freeze_module.o ---
gcc -pthread -c -fno-strict-overflow -Wsign-compare -g -Og -Wall -O2 -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I./Include/internal/mimalloc -I. -I./Include -DPy_BUILD_CORE -o Programs/_freeze_module.o Programs/_freeze_module.c
--- python-config ---
sed -e "s,@EXENAME@,/usr/local/bin/python3.15d," < ./Misc/python-config.in >python-config.py
--- build/scripts-3.15/idle3.15 ---
sed -e "s,/usr/bin/env python3,/usr/local/bin/python3.15d," < ./Tools/scripts/idle3 > build/scripts-3.15/idle3.15
--- Include/pydtrace_probes.h ---
CC="gcc -pthread" CFLAGS="-O2" /usr/sbin/dtrace -o Include/pydtrace_probes.h -h -s
--- Modules/getpath_noop.o ---
gcc -pthread -c -fno-strict-overflow -Wsign-compare -g -Og -Wall -O2 -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I./Include/internal/mimalloc -I. -I./Include -DPy_BUILD_CORE -o Modules/getpath_noop.o Modules/getpath_noop.c
--- python-config ---
LC_ALL=C sed -e 's,\$(\([A-Za-z0-9_]*\)),\$\{\1\},g' < Misc/python-config.sh >python-config
--- Include/pydtrace_probes.h ---
dtrace: option requires an argument -- s
Usage: dtrace [-32|-64] [-aACeFGhHlqSvVwZ] [-b bufsz] [-c cmd] [-D name[=def]]
[-I path] [-L path] [-o output] [-p pid] [-s script] [-U name]
[-x opt[=val]] [-X a|c|s|t]
[-P provider [[ predicate ] action ]]
[-m [ provider: ] module [[ predicate ] action ]]
[-f [[ provider: ] module: ] func [[ predicate ] action ]]
[-n [[[ provider: ] module: ] func: ] name [[ predicate ] action ]]
[-i probe-id [[ predicate ] action ]] [ args ... ]
predicate -> '/' D-expression '/'
action -> '{' D-statements '}'
-32 generate 32-bit D programs and ELF files
-64 generate 64-bit D programs and ELF files
-a claim anonymous tracing state
-A generate driver.conf(4) directives for anonymous tracing
-b set trace buffer size
-c run specified command and exit upon its completion
-C run cpp(1) preprocessor on script files
-D define symbol when invoking preprocessor
-e exit after compiling request but prior to enabling probes
-f enable or list probes matching the specified function name
-F coalesce trace output by function
-G generate an ELF file containing embedded dtrace program
-h generate a header file with definitions for static probes
-H print included files when invoking preprocessor
-i enable or list probes matching the specified probe id
-I add include directory to preprocessor search path
-l list probes matching specified criteria
-L add library directory to library search path
-m enable or list probes matching the specified module name
-n enable or list probes matching the specified probe name
-o set output file
-p grab specified process-ID and cache its symbol tables
-P enable or list probes matching the specified provider name
-q set quiet mode (only output explicitly traced data)
-s enable or list probes according to the specified D script
-S print D compiler intermediate code
-U undefine symbol when invoking preprocessor
-v set verbose mode (report stability attributes, arguments)
-V report DTrace API version
-w permit destructive actions
-x enable or modify compiler and tracing options
-X specify ISO C conformance settings for preprocessor
-Z permit probe descriptions that match zero probes
*** [Include/pydtrace_probes.h] Error code 2
make: stopped in /home/blue/Desktop/cpython
--- build/scripts-3.15/pydoc3.15 ---
sed -e "s,/usr/bin/env python3,/usr/local/bin/python3.15d," < ./Tools/scripts/pydoc3 > build/scripts-3.15/pydoc3.15
1 error
make: stopped in /home/blue/Desktop/cpython
Issue 1: System Library Conflicts
NetBSD dtrace requires -x nolibs flag to avoid conflicts with system dtrace libraries. Without this flag, dtrace fails with:
dtrace: failed to compile script: "/usr/lib/dtrace/psinfo.d", line 46: syntax error near "u_int"
Issue 2: Make Automatic Variable Expansion
NetBSD Make has issues with $<
automatic variable expansion in complex command lines. When the Makefile.pre.in uses:
CC="$(CC)" CFLAGS="$(CFLAGS)" $(DTRACE) $(DFLAGS) -o $@ -h -s $<
The $<
expands to nothing instead of $(srcdir)/Include/pydtrace.d
, causing:
dtrace: option requires an argument -- s
Issue 3: Configure Detection
The configure script's DTrace linking test fails on NetBSD, causing DTRACE_OBJS
to remain empty.
This results in DTRACE_OBJS=""
causing linking errors:
ld: Python/gc.o: in function `_PyGC_Collect':
/home/blue/Desktop/cpython/Python/gc.c:2048: undefined reference to `__dtraceenabled_python___gc__start'
ld: /home/blue/Desktop/cpython/Python/gc.c:2065: undefined reference to `__dtraceenabled_python___gc__done'
ld: /home/blue/Desktop/cpython/Python/gc.c:2066: undefined reference to `__dtrace_python___gc__done'
ld: /home/blue/Desktop/cpython/Python/gc.c:2065: undefined reference to `__dtraceenabled_python___gc__done'
ld: /home/blue/Desktop/cpython/Python/gc.c:2048: undefined reference to `__dtraceenabled_python___gc__start'
ld: /home/blue/Desktop/cpython/Python/gc.c:2049: undefined reference to `__dtrace_python___gc__start'
ld: Python/import.o: in function `import_find_and_load':
/home/blue/Desktop/cpython/Python/import.c:3725: undefined reference to `__dtraceenabled_python___import__find__load__start'
ld: /home/blue/Desktop/cpython/Python/import.c:3731: undefined reference to `__dtraceenabled_python___import__find__load__done'
ld: /home/blue/Desktop/cpython/Python/import.c:3732: undefined reference to `__dtrace_python___import__find__load__done'
ld: /home/blue/Desktop/cpython/Python/import.c:3726: undefined reference to `__dtrace_python___import__find__load__start'
ld: Python/sysmodule.o: in function `sys_audit_tstate':
/home/blue/Desktop/cpython/./Python/sysmodule.c:271: undefined reference to `__dtraceenabled_python___audit'
ld: Python/sysmodule.o: in function `should_audit':
/home/blue/Desktop/cpython/./Python/sysmodule.c:239: undefined reference to `__dtraceenabled_python___audit'
ld: Python/sysmodule.o: in function `sys_audit_tstate':
/home/blue/Desktop/cpython/./Python/sysmodule.c:304: undefined reference to `__dtrace_python___audit'
ld: Python/sysmodule.o: in function `should_audit':
/home/blue/Desktop/cpython/./Python/sysmodule.c:239: undefined reference to `__dtraceenabled_python___audit'
*** [Programs/_freeze_module] Error code 1
make: stopped in /home/blue/Desktop/cpython
1 error
make: stopped in /home/blue/Desktop/cpython
CPython versions tested on:
CPython main branch, 3.13, 3.14, 3.15
Operating systems tested on:
Other
Linked PRs
Metadata
Metadata
Assignees
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesOS-netbsdbuildThe build process and cross-buildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error