Skip to content

Fix definition of _Py_RemoteDebug_ symbols for static linking #135146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zanieb
Copy link
Contributor

@zanieb zanieb commented Jun 4, 2025

As noted at

If you need to add a new function ensure that is declared 'static'.
it's critical that these definitions are static. Otherwise, statically linking the module will fail (as I encountered downstream in python-build-standalone), e.g.:

cpython-3.14> ld64.lld: error: duplicate symbol: _Py_RemoteDebug_ClearCache
cpython-3.14> >>> defined in remote_debug.h:125 (Python/remote_debug.h:125)
cpython-3.14> >>>            Python/remote_debugging.o
cpython-3.14> >>> defined in remote_debug.h:125 (./Modules/../Python/remote_debug.h:125)
cpython-3.14> >>>            Modules/_remote_debugging_module.o

@zanieb
Copy link
Contributor Author

zanieb commented Jun 4, 2025

I'm happy to include a news entry and issue if desired, we chatted about this problem briefly in Discord and I figured I'd just quickly post the patch.

@zanieb
Copy link
Contributor Author

zanieb commented Jun 4, 2025

CI has some compiler warnings

Run python3 Tools/build/check_warnings.py --compiler-output-file-path=compiler_output_macos.txt --warning-ignore-file-path=Tools/build/.warningignore_macos --compiler-output-type=clang --fail-on-regression --fail-on-improvement --path-prefix="./"
Unexpected warnings:
Python/remote_debug.h expected 0 warnings, found 2
{'file': 'Python/remote_debug.h', 'line': '[13](https://github.com/python/cpython/actions/runs/15448318268/job/43483840500?pr=135146#step:10:14)5', 'column': '1', 'message': "unused function '_Py_RemoteDebug_ClearCache'", 'option': '-Wunused-function'}
{'file': 'Python/remote_debug.h', 'line': '993', 'column': '1', 'message': "unused function '_Py_RemoteDebug_PagedReadRemoteMemory'", 'option': '-Wunused-function'}

@pablogsal
Copy link
Member

Yeah this file is included in two places but they don't use all the functions. We must silence these warnings because they are false positives

@pablogsal
Copy link
Member

I'm happy to include a news entry and issue if desired, we chatted about this problem briefly in Discord and I figured I'd just quickly post the patch.

No need. This is not a user visible change and it doesn't really qualify as a bug fix (depends how you look at it). I am happy either way basically

@zanieb
Copy link
Contributor Author

zanieb commented Jun 5, 2025

@pablogsal I've silenced the warnings.

@pablogsal
Copy link
Member

Hummm, I still see the warnings in GitHub in the https://github.com/python/cpython/pull/135146/files page. Is this expected?

@zanieb
Copy link
Contributor Author

zanieb commented Jun 6, 2025

Yeah I think so? I'm not familiar with the warnings tooling, but I believe I've just followed the "standard" way to silence new warnings in a file. If there's another way, we'll need to hear from someone who's an owner of such things :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants