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: make install DESTDIR= uses /lib/python3.10/lib-dynload out of DESTDIR
Type: Stage: resolved
Components: Build Versions: Python 3.10
process
Status: closed Resolution: duplicate
Dependencies: Superseder: 'make install' fails when the configure 'prefix' is '/' and DESTDIR is used
View: 31114
Assigned To: Nosy List: dilyan.palauzov, ned.deily
Priority: normal Keywords:

Created on 2022-03-01 22:16 by dilyan.palauzov, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg414303 - (view) Author: Дилян Палаузов (dilyan.palauzov) Date: 2022-03-01 22:16
With most recent 3.10 (v3.10.2-169-g98e2ee60) I call

./configure --prefix=/  && make && make DESTDIR=/home/d/A install

It fails with:

running build
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers

Python build finished successfully!
The necessary bits to build these optional modules were not found:
_gdbm                 _tkinter              nis                
readline                                                       
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc                  pwd                   time               

running build_scripts
copying and adjusting /git/cpython/Tools/scripts/pydoc3 -> build/scripts-3.10
copying and adjusting /git/cpython/Tools/scripts/idle3 -> build/scripts-3.10
copying and adjusting /git/cpython/Tools/scripts/2to3 -> build/scripts-3.10
changing mode of build/scripts-3.10/pydoc3 from 644 to 755
changing mode of build/scripts-3.10/idle3 from 644 to 755
changing mode of build/scripts-3.10/2to3 from 644 to 755
renaming build/scripts-3.10/pydoc3 to build/scripts-3.10/pydoc3.10
renaming build/scripts-3.10/idle3 to build/scripts-3.10/idle3.10
renaming build/scripts-3.10/2to3 to build/scripts-3.10/2to3-3.10
running install_lib
creating /lib/python3.10/lib-dynload
error: could not create '/lib/python3.10/lib-dynload': Permission denied
make: *** [Makefile:1761: sharedinstall] Error 1
msg414306 - (view) Author: Дилян Палаузов (dilyan.palauzov) Date: 2022-03-01 22:18
Once I create /lib/python3.10/lib-dynload/, the next error is:

changing mode of /lib/python3.10/lib-dynload/__pycache__ to 755
running install_scripts
copying build/scripts-3.10/pydoc3.10 -> /bin
error: could not delete '/bin/pydoc3.10': Permission denied
make: *** [Makefile:1761: sharedinstall] Error 1

'/bin/pydoc3.10 is not under DESTDIR
msg414388 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2022-03-02 22:23
Why are you using --prefix=/ ? Or better yet, please explain you are trying to accomplish. A normal case would be --prefix=/some/path other than / and not use DESTDIR. You won't be able to install into / on a current macOS system anyway.
msg414435 - (view) Author: Дилян Палаузов (dilyan.palauzov) Date: 2022-03-03 12:05
I want to compile and install python for a chrooted environment.  --prefix are the path within the chrooted-environment.  DESTDIR is the location of the root of the chrooted-environment.

When I glue DESTDIR with --prefix= (thus use no DESTDIR) this happens:

/lib/python3.10/_sysconfigdata__linux_x86_64-linux-gnu.py contains the value of --prefix.  When python is executed within the chrooted environment, this value is just wrong.

`strings python` also prints the value of --prefix.  Within the chrooted environment, that value is not correct.
msg414472 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2022-03-03 20:58
My apologies: I'm not sure where I got the idea you were building on macOS!

In any case, this problem has come up a few times in the past, no doubt for a similar reason, most recently in open issue Issue31114. I'm closing this issue as a duplicate of that. But be aware that Distutils is now deprecated in general and in the upcoming 3.11 feature release, there are major changes to getpath and also to begin the process of eliminating the use of Distutils when building Python itself, so it is unlikely that any bug fixes for this minor wart will be forthcoming for current releases.

But a very simple workaround should be to use --prefix=/usr/local or some other path within your chroot environment rather than trying to install in / of the chroot.
History
Date User Action Args
2022-04-11 14:59:56adminsetgithub: 91050
2022-03-03 20:58:30ned.deilysetstatus: open -> closed
superseder: 'make install' fails when the configure 'prefix' is '/' and DESTDIR is used
messages: + msg414472

resolution: duplicate
stage: resolved
2022-03-03 12:05:08dilyan.palauzovsetmessages: + msg414435
2022-03-02 22:23:49ned.deilysetnosy: + ned.deily
messages: + msg414388
2022-03-01 22:18:13dilyan.palauzovsetmessages: + msg414306
2022-03-01 22:16:00dilyan.palauzovcreate