Compiling `--with-lto` results in `test_embed` failures on Darwin
オープン
まだ誰も着手していません。
build
OS-mac
type-bug
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
On Darwin, configure.ac:1998 sets:
LTOFLAGS="-flto=thin -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto"
Which gets expanded too early in Makefile.pre.in:130 into "".lto (notice the :=):
PY_CORE_EXE_LDFLAGS:= $(if $(CONFIGURE_EXE_LDFLAGS), $(CONFIGURE_EXE_LDFLAGS) $(PY_LDFLAGS_NODIST), $(PY_CORE_LDFLAGS))
Linking results in:
gcc -flto=thin -Wl,-export_dynamic -Wl,-object_path_lto,"".lto -g ...
Which happens to link Programs/_testembed as the interpreter, so that launching it results in:
$ ./Programs/_testembed
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
WARN: Could not find the standard library directory! sys.prefix is set to /usr/local, is this correct?
Python 3.16.0a0 (heads/main:4f39efc47de, Jul 7 2026, 17:34:29) [Clang 21.0.0 (clang-2100.1.1.101)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
And related tests in the test_embed suite fail:
$ ./python.exe -m test -v test_embed
== CPython 3.16.0a0 (heads/main:4f39efc47de, Jul 7 2026, 17:34:29) [Clang 21.0.0 (clang-2100.1.1.101)]
== macOS-26.5.1-arm64-arm-64bit-Mach-O little-endian
== Python build: release ThinLTO
== cwd: ***
== CPU count: 16
== encodings: locale=UTF-8 FS=utf-8
== resources: all test resources are disabled, use -u option to unskip tests
Using random seed: 2037373937
0:00:00 load avg: 2.73 mem: 31.0 MiB Run 1 test sequentially in a single process
0:00:00 load avg: 2.73 mem: 31.0 MiB [1/1] test_embed
test_audit (test.test_embed.AuditingTests.test_audit) ... --- ['***/cpython/Programs/_testembed', 'test_audit'] failed ---
stdout:
stderr:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
WARN: Could not find the standard library directory! sys.prefix is set to /usr/local, is this correct?
***/Programs/_testembed: can't open file '***/test_audit': [Errno 2] No such file or directory
------
FAIL
It seems to me this was introduced by 4e45c9c.
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
- gh-153532
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず configure.ac:1998 と Makefile.pre.in:130 を比較し、Darwin ビルド中に LTOFLAGS がどのように展開されるかに注目します。ThinLTO ビルドを再現し、./python.exe -m test -v test_embed を実行します。_testembed が正しく起動し、test_embed スイートがパスすれば完了です。関連付けられた PR gh-153532 は、作業がすでに進行中である可能性を示しています。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- macos, python
- 領域
- build-system, testing-qa
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100