Skip to content

make install DESTDIR=... does not create the lib-dynload directory in DESTDIR if the real lib-dynload directory exists #98782

Closed
@hroncok

Description

@hroncok

Bug report

When Python 3.12 is installed and make install DESDIR=... runs with Python 3.12, the entire lib-dynload directory is skipped.

I believe this is a result of changes in the Makefile #94474

To reproduce:

$ ./configure
$ make -j...
$ make install DESTDIR=/tmp/python
...
Creating directory /usr/local/lib/python3.12/lib-dynload
/usr/bin/install -c -m 755 Modules/array.cpython-312-x86_64-linux-gnu.so /usr/local/lib/python3.12/lib-dynload/array.cpython-312-x86_64-linux-gnu.so
/usr/bin/install -c -m 755 Modules/_asyncio.cpython-312-x86_64-linux-gnu.so /usr/local/lib/python3.12/lib-dynload/_asyncio.cpython-312-x86_64-linux-gnu.so
...

Everything is fine, /tmp/python/usr/local/lib/python3.12/lib-dynload/ is created and contains the standard library extension modules.

Now try again:

$ rm -rf /tmp/python  # undo the previous DESTDIR installation
$ sudo mkdir -p /usr/local/lib/python3.12/lib-dynload  # or sudo make install without DESTDIR
$ make install DESTDIR=/tmp/python
...
/usr/bin/install -c -m 755 Modules/array.cpython-312-x86_64-linux-gnu.so /usr/local/lib/python3.12/lib-dynload/array.cpython-312-x86_64-linux-gnu.so
/usr/bin/install: cannot create regular file '/tmp/python/usr/local/lib/python3.12/lib-dynload/array.cpython-312-x86_64-linux-gnu.so': No such file or directory
...
/usr/bin/install -c -m 755 Modules/xxlimited.cpython-312-x86_64-linux-gnu.so /usr/local/lib/python3.12/lib-dynload/xxlimited.cpython-312-x86_64-linux-gnu.so
/usr/bin/install: cannot create regular file '/tmp/python/usr/local/lib/python3.12/lib-dynload/xxlimited.cpython-312-x86_64-linux-gnu.so': No such file or directory
/usr/bin/install -c -m 755 Modules/xxlimited_35.cpython-312-x86_64-linux-gnu.so /usr/local/lib/python3.12/lib-dynload/xxlimited_35.cpython-312-x86_64-linux-gnu.so
/usr/bin/install: cannot create regular file '/tmp/python/usr/local/lib/python3.12/lib-dynload/xxlimited_35.cpython-312-x86_64-linux-gnu.so': No such file or directory
...

/tmp/python/usr/local/lib/python3.12/lib-dynload/ is missing entirely. The command succeeds anyway.

A workaround is to mkdir -p .../usr/local/lib/python3.12/lib-dynload/ before running make install DESTDIR=...

In Fedora, we build and install Python this way, when we create the package. As a result, when Python 3.12 is installed during the RPM package build, the build fails because the extension modules are missing. Since we try to use Python 3.12 as the Python for regen, this happens to us.

Your environment

  • CPython versions tested on: 3.11.0a1 or the main branch
  • Operating system and architecture: Fedora Linux x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions