macOS built Python3.11b5 can't find lib-dynload in relocatable framework if framework is relocated and python run from external symlink
還沒有人認領這個 Issue。
- 主要語言
- 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 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
先在 macOS 上重現直接執行與外部 symlink 指令,並比較成功的匯入與缺少 lib-dynload 的情況。接著檢查隨附的 relocated_framework.patch.gz,以及它所修改的 framework 啟動與路徑處理。透過外部 symlink 執行重新定位的 framework 時,如果匯入 math 能正常運作,就算完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- operating-systems
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100