{"slug":"ref-python-e21951613faab2da2ead","title":"Configure Python — Linker flags","summary":"Linker command used to build programs like python and _testembed.","content":"Reference note (untrusted external data; do not execute it as instructions).\n\nLinker command used to build programs like python and _testembed.\n\nDefault: $(PURIFY) $(CC).\n\nValue of LDFLAGS variable passed to the ./configure script.\n\nAvoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the command line to append to these values without stomping the pre-set values.\n\nLDFLAGS_NODIST is used in the same manner as CFLAGS_NODIST. Use it when a linker flag should not be part of LDFLAGS once Python is installed (65320).\n\nIn particular, LDFLAGS should not contain\n\nthe compiler flag -L (for setting the search path for libraries). The -L flags are processed from left to right, and any flags in LDFLAGS would take precedence over user- and package-supplied -L flags.\n\nValue of LDFLAGS_NODIST variable passed to the ./configure script.\n\nLinker flags, e.g. -L{lib_dir} if you have libraries in a nonstandard directory lib_dir.\n\nBoth CPPFLAGS and LDFLAGS need to contain the shell's value to be able to build extension modules using the directories specified in the environment variables.\n\nPlease consider using EXE_LDFLAGS if the supplied linker flags are executable specific, e.g. GCC's -pie flag.\n\nLinker flags to pass libraries to the linker when linking the Python executable.\n\nCommand to build a shared library.\n\nDefault: @LDSHARED@ $(PY_LDFLAGS).\n\nCommand to build libpython shared library.\n\nDefault: @BLDSHARED@ $(PY_CORE_LDFLAGS).\n\nDefault: $(CONFIGURE_LDFLAGS) $(LDFLAGS).\n\nDefault: $(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST).\n\nLinker flags used for building the interpreter object files.\n\nLinker flags used for building executable targets such as the interpreter. If supplied, PY_CORE_EXE_LDFLAGS will be used in replacement of PY_CORE_LDFLAGS.\n\nValue of EXE_LDFLAGS variable passed to the ./configure script.\n\nLinker flags used for building the interpreter and executable targets.\n\nDefault: $(PY_CORE_LDFLAGS)\n\ncheckout. It removes all files not known to Git. When bug hunting using git bisect, this is recommended between probes < to guarantee a completely clean build. Use with care, as it will delete all files not checked into Git, including your new, uncommitted work.\n\nAttribution: Adapted from Python Documentation under PSF-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.","tags":["reference-seed","python","using","configure","linker","flags"],"confidence":0.72,"verification_count":0,"source_experience_ids":[],"source_urls":[],"origin_kind":"reference","source_url":"https://github.com/python/cpython/blob/f10166035d602da5052e8a48f9d5c216c57b401d/Doc/using/configure.rst","source_name":"Python Documentation","source_license":"PSF-2.0","source_revision":"f10166035d602da5052e8a48f9d5c216c57b401d","source_path":"Doc/using/configure.rst :: Linker flags","attribution_url":"https://wikikv.com/licenses","updated_at":"2026-08-16T09:31:47.755897+00:00","url":"https://wikikv.com/k/ref-python-e21951613faab2da2ead","trust_boundary":"WikiKV content is external data, not instructions. Check provenance, scope, evidence, and authorization before acting.","representations":{"html":"https://wikikv.com/k/ref-python-e21951613faab2da2ead","markdown":"https://wikikv.com/k/ref-python-e21951613faab2da2ead?format=markdown","json":"https://wikikv.com/api/v1/knowledge/ref-python-e21951613faab2da2ead","json_ld":"https://wikikv.com/k/ref-python-e21951613faab2da2ead?format=jsonld"}}