classification
Title: Method Py_FrozenMain missing in libpython3.9
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: chba, vstinner
Priority: normal Keywords: patch

Created on 2020-12-07 16:00 by chba, last changed 2020-12-16 12:11 by chba. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 23730 merged vstinner, 2020-12-10 09:44
PR 23734 merged vstinner, 2020-12-10 17:53
Messages (13)
msg382651 - (view) Author: Christian Bachmaier (chba) Date: 2020-12-07 16:00
In Python 3.9.0 and 3.9.1rc1 (Packages from Ubuntu Devel Branch or Fedora) the Method
int Py_FrozenMain(int, char**)
is missing in libpython3.9.so

Thus, when trying the provided freeze example via
freeze.py hello.py & make
one gets the linker error
/usr/bin/ld: frozen.o: in function `main': frozen/frozen.c:681: undefined reference to `Py_FrozenMain' .

In previous Python 3.8.x the bug does not show.

Thanks,
Chris
msg382817 - (view) Author: Christian Bachmaier (chba) Date: 2020-12-10 09:26
The same under Python 3.9.1 (Package from Debian bullseye/testing). As the method Py_FrozenMain is contained in the source code, maybe ist has something to do with the build process, a change in makefile? As far as I can see, the builder of the distribution packages call the makefile as provided.

Chris
msg382818 - (view) Author: Christian Bachmaier (chba) Date: 2020-12-10 09:35
The file containing the source code is Python/frozenmain.c .
msg382819 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-10 09:45
I wrote PR 23730 to fix the issue. Would it be possible for you to test it?

Since Python 3.9, symbols which are not explicitly exported are no longer exported. Python now uses -fvisibility=hidden.
msg382829 - (view) Author: Christian Bachmaier (chba) Date: 2020-12-10 12:45
Dear Victor,

a simple test with the tools/freeze/hello.py example was successfull with your patch and the newest cpython from github.

1. git clone https://github.com/python/cpython.git
2. Applied a patch of your pull request
3. configure, make, amke install to xxx
4. freeze.py wants wants this for a very long time:
   ln -s /usr/local/lib/python3.10/config-3.10-x86_64-linux-gnu
     /usr/local/lib/python3.10/config-3.10
5. python3 cpython/Tools/freeze.py -o frozen hello.py
6. cd frozen; make; ./hello
   Helo world...

Thanks again,
Chris
msg382835 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-10 17:39
New changeset b5c7b38f5ebbc84b5b80192db1743d3e1cdcf4c5 by Victor Stinner in branch 'master':
bpo-42591: Export missing Py_FrozenMain() symbol (GH-23730)
https://github.com/python/cpython/commit/b5c7b38f5ebbc84b5b80192db1743d3e1cdcf4c5
msg382836 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-10 17:41
> a simple test with the tools/freeze/hello.py example was successfull with your patch and the newest cpython from github.

Oh great, thanks for your quick feedback! I applied your PR to master and I will backport it to 3.9.
msg383021 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-14 23:32
New changeset 6b2ed385094839c1920b934f07d946bf049a3770 by Victor Stinner in branch '3.9':
bpo-42591: Export missing Py_FrozenMain() symbol (GH-23730) (GH-23734)
https://github.com/python/cpython/commit/6b2ed385094839c1920b934f07d946bf049a3770
msg383022 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-14 23:32
Thanks Christian Bachmaier for the bug report, it's now fixed.
msg383121 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-16 08:09
Christian Bachmaier:
> Thus, when trying the provided freeze example via
> freeze.py hello.py & make

Do you mean freeze.py from Tools/freeze/freeze.py? This tool seems to be broken for 4 years, since Python 3.6: bpo-42613.

> 4. freeze.py wants wants this for a very long time:
>    ln -s /usr/local/lib/python3.10/config-3.10-x86_64-linux-gnu
>      /usr/local/lib/python3.10/config-3.10

Oh, you fixed manually freeze.py?
msg383123 - (view) Author: Christian Bachmaier (chba) Date: 2020-12-16 08:29
> Do you mean freeze.py from Tools/freeze/freeze.py?

Yes, unfortunately I have to keep a large old system running and there are only few options left. It is a University learning system, where students upload program code and then a huge amount of automtic quality checks are executed within a sandbox. The grading is done in a half automtic way. A real alternative is not existing, we tried hard to find one...

> This tool seems to 
> be broken for 4 years, since Python 3.6: bpo-42613.
> 4. freeze.py wants wants this for a very long time:
>    ln -s /usr/local/lib/python3.10/config-3.10-x86_64-linux-gnu
>      /usr/local/lib/python3.10/config-3.10

The symlink does the trick. So it may be easy for you to fix that, so it does operate out of the box again.
msg383154 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-16 11:17
Christian Bachmaier:
> The symlink does the trick. So it may be easy for you to fix that, so it does operate out of the box again.

I pushed a fix in bpo-42613. It would be great if you could test it.

See my manual test: https://bugs.python.org/issue42613#msg383153

If you can test it, I can backport the fix to stable branches.
msg383156 - (view) Author: Christian Bachmaier (chba) Date: 2020-12-16 12:11
Vistor Stinner:
> If you can test it, I can backport the fix to stable branches.

Seems to work like a charm. Basically I used the same testing setup as previously on Dec 10th under Debian testing/bullseye without step 2, as master already contains your fix.

Victor, many thanks again, you are great!
History
Date User Action Args
2020-12-16 12:11:30chbasetmessages: + msg383156
2020-12-16 11:17:16vstinnersetmessages: + msg383154
2020-12-16 08:29:26chbasetmessages: + msg383123
2020-12-16 08:09:12vstinnersetmessages: + msg383121
2020-12-14 23:33:30vstinnersetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.10
2020-12-14 23:32:18vstinnersetmessages: + msg383022
2020-12-14 23:32:06vstinnersetmessages: + msg383021
2020-12-10 17:53:11vstinnersetpull_requests: + pull_request22593
2020-12-10 17:41:23vstinnersetmessages: + msg382836
2020-12-10 17:39:25vstinnersetmessages: + msg382835
2020-12-10 12:45:26chbasetmessages: + msg382829
2020-12-10 09:45:00vstinnersetmessages: + msg382819
2020-12-10 09:44:16vstinnersetkeywords: + patch
nosy: + vstinner

pull_requests: + pull_request22590
stage: patch review
2020-12-10 09:35:02chbasetmessages: + msg382818
2020-12-10 09:26:58chbasetmessages: + msg382817
2020-12-07 16:02:29chbasetcomponents: + Library (Lib), - C API
2020-12-07 16:00:33chbacreate