I am referencing this Medium article, https://medium.com/@lupiel/installing-python-from-a-tgz-file-a-step-by-step-guide-4cf5f4a17a86, and it recommends tagging on the following option to the ./configure script when installing python on linux.
LDFLAGS=-Wl,-rpath=/opt/python/${PYTHON_VERSION}/lib,--disable-new-dtags
I've looked at the man page for python-configure and it is relatively short. I didn't find anything in python3-config --help either. It tells me that LDFLAGS "print the flags that should be passed to the linker." I read that a linker is a symlink? Regardless, this is the extent of information I've been able to find. I don't understand what the rest does.
These configure options will build a shared library, which means that the Python interpreter will be contained mostly in an external
libpython3.sofile, and thepythonexecutable will just be a small shim (maybe 15 kb) that will link to the libpython shared object.These LDFLAGS, combined with the
--enable-sharedoption the article mentioned, means that thepythonexecutable will be configured with a run-time search path of/opt/python/${PYTHON_ VERSION}/libto find this shared object, i.e. at startup time it will look for alibpython3.sofile in there to dynamically link against.This is not the default way to build CPython. By default the interpreter is burnt into the Python executable, i.e. the
pythonexe will be much bigger (megabytes) and an externallibpython3.sofile will not be generated at all. Doing it this way, without--enable-shared, will result in a slightly faster and more memory-efficient build of CPython.I do not recommend using
--enable-shared, unless you specifically need it (for e.g. embedding). If you don't know what it's for, you don't need it.