macOS built Python3.11b5 can't find lib-dynload in relocatable framework if framework is relocated and python run from external symlink
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 36k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
A build of Python 3.11b5's fails to find lib-dynload path if the following normally ok combination of criteria are met:
- The framework is made or modified in such a away to be relocatable (dynamic links are relative using @loader_path, etc) instead of absolute path
- The framework is installed in a location it wasn't built at
- python is executed by a symlink from elsewhere
Your environment
To reproduce this easily, I decompressed the installable package into my home directory, making a framework structure that would normally run. I do have to modify the linking to work relocated, using the following commands:
install_name_tool -change /Library/Frameworks/Python.framework/Versions/3.11/Python @loader_path/../Python Python.framework/Versions/3.11/bin/python3.11
install_name_tool -change /Library/Frameworks/Python.framework/Versions/3.11/Python @loader_path/../../../../Python Python.framework/Versions/3.11/Resources/Python.app/Contents/MacOS/Python
I then symlink the python executable.
ln -s Python.framework/Versions/3.11/bin/python3.11 python3.11
the following command works fine
./Python.framework/Versions/3.11/bin/python3.11 -c "import math"
while this does not
./python3.11 -c "import math"
Could not find platform dependent libraries <exec_prefix>
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'math'
even though the shell itself works normally, just the lib-dynload is not being found.
I can make it work with the attached patch, but I don't assume it is the correct way to fix it
relocated_framework.patch.gz
.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、macOS で直接実行と外部 symlink のコマンドを再現し、インポートが成功する場合と lib-dynload がない場合を比較します。次に、添付された relocated_framework.patch.gz と、それが変更する framework の起動およびパス処理を調べます。移動先の framework を外部 symlink 経由で実行したときに math のインポートが機能すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- operating-systems
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100