This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: freeze searches libpython3.9.so in /usr/lib instead /usr/lib/x86_64-linux-gnu
Type: compile error Stage:
Components: Library (Lib) Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: chba, doko
Priority: normal Keywords:

Created on 2021-02-15 14:36 by chba, last changed 2022-04-11 14:59 by admin.

Messages (6)
msg387015 - (view) Author: Christian Bachmaier (chba) Date: 2021-02-15 14:36
Now that the patch from issue 42591 (https://bugs.python.org/issue42591), i.e., msg383154 from 12/16/20  has made it to Ubuntu 20.04 with packet version python3.9.1-1, there show some problems with that.

I did:
> freeze/freeze.py -o frozen helloworld.py
> cd frozen
> make

This delivers a linker error
...xml__parsers.o M_xml__parsers__expat.o M_xml__sax.o M_xml__sax___exceptions.o M_xml__sax__expatreader.o M_xml__sax__handler.o M_xml__sax__saxutils.o M_xml__sax__xmlreader.o M_xmlrpc.o M_xmlrpc__client.o M_zipfile.o M_zipimport.o /usr/lib/libpython3.9.so -lexpat                       -L/usr/lib -lz                        -lexpat  -lcrypt -lpthread -ldl  -lutil -lm -lm  -o helloworld
x86_64-linux-gnu-gcc: error: /usr/lib/libpython3.9.so: No such file or directory
make: *** [Makefile:1234: helloworld] Error 1

The linker searches libpython3.9 in /usr/lib instead in /usr/lib/x86_64-linux-gnu . The "hot-fix"
> ln -s /usr/lib/x86_64-linux-gnu/libpython3.9.so /usr/lib/libpython3.9.so
fixes that, but brings another error:

> freeze/freeze.py -o frozen helloworld.py
> cd frozen
> make
 
...xml__parsers.o M_xml__parsers__expat.o M_xml__sax.o M_xml__sax___exceptions.o M_xml__sax__expatreader.o M_xml__sax__handler.o M_xml__sax__saxutils.o M_xml__sax__xmlreader.o M_xmlrpc.o M_xmlrpc__client.o M_zipfile.o M_zipimport.o /usr/lib/libpython3.9.so -lexpat                       -L/usr/lib -lz                        -lexpat  -lcrypt -lpthread -ldl  -lutil -lm -lm  -o helloworld
/usr/bin/ld: config.o:(.data.rel+0x278): undefined reference to `PyInit_lazr'
collect2: error: ld returned 1 exit status
make: *** [Makefile:1234: helloworld] Error 1

@Victor: I know there are alternatives to freeze, however, I have to keep a larger legacy project running, and I am not that expert. Maybe you could have a look on the above.
msg387016 - (view) Author: Christian Bachmaier (chba) Date: 2021-02-15 14:46
Sorry, my Ubuntu version I mentioned above is the development version of 21.04 and not 20.04.

I you would like or this would be a comfortable option for you, I can show this live/interactively in a shell of my test system to track down the error, say via a skype session.
msg387576 - (view) Author: Christian Bachmaier (chba) Date: 2021-02-23 15:31
The same situation in Ubuntu development branch's package python3.9.2-0ubuntu2 .

Inserting the follwing

    if sysconfig.get_config_var('MULTIARCH'):
        masd = sysconfig.get_config_var('multiarchsubdir')
        if masd.startswith(os.sep):
            masd = masd[len(os.sep):]
        libdir = os.path.join(libdir, masd)

directly after line ~ 247 in freeze.py

    libdir = sysconfig.get_config_var('LIBDIR')

seems to fix the first problem.
msg387843 - (view) Author: Christian Bachmaier (chba) Date: 2021-03-01 06:40
Anyone?
msg388359 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2021-03-09 12:07
Please could you edit
/usr/lib/python3.9/_sysconfigdata__x86_64-linux-gnu.py
setting LIBDIR to /usr/lib/x86_64-linux-gnu
and see if that fixes the freeze issue?

that could also be fixed by configuring with --libdir=/usr/lib/x86_64-linux-gnu

but that also moves lib-dynload into the new libdir.

# Detailed destination directories
BINLIBDEST=     $(LIBDIR)/python$(VERSION)
LIBDEST=        $(SCRIPTDIR)/python$(VERSION)
DESTSHARED=     $(BINLIBDEST)/lib-dynload
msg388363 - (view) Author: Christian Bachmaier (chba) Date: 2021-03-09 13:59
As for some time now, first I have to manually fix https://bugs.python.org/issue40350 first, i.e., use the recommended workaround not None check for spec.loader in /usr/lib/python3.9/modulefinder.py.


Setting LIBDIR to /usr/lib/x86_64-linux-gnu in /usr/lib/python3.9/_sysconfigdata__x86_64-linux-gnu.py
setting seams to fixe the issue linking issue of libpython3.9.so .


However, then the missing PyInit_lazr problem (as indicated in my first posting) stays:

...ml__sax__handler.o M_xml__sax__saxutils.o M_xml__sax__xmlreader.o M_xmlrpc.o M_xmlrpc__client.o M_zipfile.o M_zipimport.o /usr/lib/x86_64-linux-gnu/libpython3.9.so -lexpat                       -L/usr/lib -lz                        -lexpat  -lcrypt -lpthread -ldl  -lutil -lm -lm  -o helloworld
/usr/bin/ld: config.o:(.data.rel+0x278): undefined reference to `PyInit_lazr'
collect2: error: ld returned 1 exit status
make: *** [Makefile:900: helloworld] Error 1
History
Date User Action Args
2022-04-11 14:59:41adminsetgithub: 87395
2021-03-09 13:59:05chbasetmessages: + msg388363
2021-03-09 12:07:23dokosetmessages: + msg388359
2021-03-01 06:40:12chbasetmessages: + msg387843
2021-02-23 21:16:54ned.deilysetnosy: + doko
2021-02-23 15:45:01chbasettype: compile error
2021-02-23 15:31:18chbasetmessages: + msg387576
2021-02-15 14:46:02chbasetmessages: + msg387016
2021-02-15 14:36:35chbacreate