Bug report
Bug description:
The Makefile build target for the shared Python library in a macOS framework build can include an incorrect library install name if the DESTDIR Makefile variable is set. The symptom is that launching the installed python3.x binary will result in a crash with the system unable to find the Python shared library; the path of the library will mistakenly include the DESTDIR path prefix.
The DESTDIR variable is often used in Makefile-based build pipelines to allow build artifacts to be installed temporarily in a directory tree other than the intended system installation location which could otherwise affect the system environment on the build platform. For a long time now, the value of DESTDIR, if specified, has been included in the install name path of the framework library. That hasn't caused a problem as long as the build is done in multiple make steps, for example:
./configure --enable-framework ...
make ...
make install DESTDIR=release_directory
But if the first make were skipped such that the make install step causes the Python library to be linked, the DESTDIR path prefix will be include in the install name and the installed framework will not work. This could also happen if the make install step causes the library to be relinked due to a Makefile dependency issue, which is how this problem was discovered.
The solution is simple: don't include DESTDIR in the -install_name argument. Note that the very similar iOS framework build rule does not have this problem.
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
Bug report
Bug description:
The Makefile build target for the shared Python library in a macOS framework build can include an incorrect library install name if the
DESTDIRMakefile variable is set. The symptom is that launching the installed python3.x binary will result in a crash with the system unable to find the Python shared library; the path of the library will mistakenly include theDESTDIRpath prefix.The
DESTDIRvariable is often used in Makefile-based build pipelines to allow build artifacts to be installed temporarily in a directory tree other than the intended system installation location which could otherwise affect the system environment on the build platform. For a long time now, the value ofDESTDIR, if specified, has been included in the install name path of the framework library. That hasn't caused a problem as long as the build is done in multiple make steps, for example:But if the first make were skipped such that the
make installstep causes the Python library to be linked, theDESTDIRpath prefix will be include in the install name and the installed framework will not work. This could also happen if themake installstep causes the library to be relinked due to a Makefile dependency issue, which is how this problem was discovered.The solution is simple: don't include
DESTDIRin the-install_nameargument. Note that the very similar iOS framework build rule does not have this problem.CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs