python / python/cpython

macOS built Python3.11b5 can't find lib-dynload in relocatable framework if framework is relocated and python run from external symlink

Aberta
#95,400 3 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

build OS-mac type-bug
Linguagem predominante
Python
Estrelas
77.2k
Forks
36k
Métricas de merge de PRs
Métricas de PR pendentes

Descrição

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
.

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece reproduzindo os comandos de execução direta e symlink externo no macOS, comparando a importação bem-sucedida com o caso em que lib-dynload está ausente. Em seguida, inspecione o arquivo anexado relocated_framework.patch.gz e o tratamento de inicialização e caminhos do framework que ele altera. Está concluído quando a importação de math funciona ao executar o framework realocado por meio do symlink externo.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
operating-systems
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.