python / python/cpython

python3-config folder dependent result

未關閉
#101,735 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

build type-bug
主要語言
Python
星號
77.2k
分支
36k
PR 合併指標
PR 指標待擷取

描述

Bug report

Python is build into a manylinux_2_28 docker image with following commands (image is py3.11-latest from my dockerhub repo, created with this Dockerfile):

./configure --enable-shared --enable-optimizations --disable-test-modules --prefix=/opt/build_python/installed
make altinstall

the process ends correctly, at the end I found the content into expected folder

/opt/build_python/installed/lib
├── [lrwxrwxrwx root     root    ]  libpython3.11.so -> libpython3.11.so.1.0
├── [-rwxr-xr-x root     root    ]  libpython3.11.so.1.0
├── [-rwxr-xr-x root     root    ]  libpython3.so
/opt/build_python/installed/bin
├── [-rwxr-xr-x root     root    ]  2to3-3.11
├── [-rwxr-xr-x root     root    ]  idle3.11
├── [-rwxr-xr-x root     root    ]  pip3.11
├── [-rwxr-xr-x root     root    ]  pydoc3.11
├── [-rwxr-xr-x root     root    ]  python3.11
└── [-rwxr-xr-x root     root    ]  python3.11-config

and if I run python3.11-config FROM INSIDE that folder I obtain the expected result (look at the -L part)

[root@919ee1a66e62 opt]# /opt/build_python/installed/bin/python3.11-config --embed --ldflags
 -L/opt/build_python/installed/lib -lpython3.11 -lpthread -ldl  -lutil -lm

If I do link that executable into /usr/local/bin and then run the same command, the output at -L flag part is different:

[root@919ee1a66e62 opt]# ln -s /opt/build_python/installed/bin/python3.11-config /usr/local/bin/python3-config

[root@919ee1a66e62 opt]# file /usr/local/bin/python3-config
/usr/local/bin/python3-config: symbolic link to /opt/build_python/installed/bin/python3.11-config

[root@919ee1a66e62 opt]# ls -l /usr/local/bin/python3-config
lrwxrwxrwx 1 root root 49 Feb  9 10:05 /usr/local/bin/python3-config -> /opt/build_python/installed/bin/python3.11-config

[root@919ee1a66e62 opt]# /usr/local/bin/python3-config --embed --ldflags
 -L/usr/local/lib -lpython3.11 -lpthread -ldl  -lutil -lm

this difference, when building C extension, led to have an error on dl phase cannot find -lpython3.11: No such file or directory because of wrong lib folder used.

I expected that python3-config's output, even if executed via symlink, should be the same.

Please let me know if my expectation is not correct, thanks.

Your environment

A manylinux_2_28_86_x64 docker image used to build python 3.11.1 into.
Then doing the steps above into the docker container.

  • CPython versions tested on: 3.11.1
  • Operating system and architecture: manylinux (CentOS) , x64

Thanks for this awesome programming language.

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

先從回報的 configure 和 make altinstall 命令開始,接著檢查產生的 /opt/build_python/installed/bin/python3.11-config 和 Dockerfile_2_28_x64_py311。直接執行其 --embed --ldflags 形式,並透過符號連結 /usr/local/bin/python3-config 執行,然後判定兩次呼叫是否應該產生相同的函式庫路徑。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python, shell
領域
build-system
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。