• Home
  • Raw
  • Download

Lines Matching +full:build +full:- +full:with +full:- +full:python

2 Configure Python
5 .. _configure-options:
12 ./configure --help
14 See also the :file:`Misc/SpecialBuilds.txt` in the Python source distribution.
17 ---------------
19 .. cmdoption:: --enable-loadable-sqlite-extensions
29 .. cmdoption:: --disable-ipv6
34 .. cmdoption:: --enable-big-digits=[15|30]
36 Define the size in bits of Python :class:`int` digits: 15 or 30 bits.
44 .. cmdoption:: --with-cxx-main
45 .. cmdoption:: --with-cxx-main=COMPILER
47 Compile the Python ``main()`` function and link Python executable with C++
50 .. cmdoption:: --with-suffix=SUFFIX
52 Set the Python executable suffix to *SUFFIX*.
54 The default suffix is ``.exe`` on Windows and macOS (``python.exe``
56 ``.wasm`` on WASI, and an empty string on other platforms (``python``
63 .. cmdoption:: --with-tzpath=<list of absolute paths separated by pathsep>
66 See the :ref:`Compile-time configuration
75 .. cmdoption:: --without-decimal-contextvar
77 Build the ``_decimal`` extension module using a thread-local context rather
78 than a coroutine-local context (default), see the :mod:`decimal` module.
84 .. cmdoption:: --with-dbmliborder=<list of backend names>
88 A valid value is a colon (``:``) separated string with the backend names:
94 .. cmdoption:: --without-c-locale-coercion
96 Disable C locale coercion to a UTF-8 based locale (enabled by default).
102 .. cmdoption:: --with-platlibdir=DIRNAME
104 Python library directory name (default is ``lib``).
106 Fedora and SuSE use ``lib64`` on 64-bit platforms.
112 .. cmdoption:: --with-wheel-pkg-dir=PATH
119 ``/usr/share/python-wheels/`` directory and don't install the
124 .. cmdoption:: --with-pkg-config=[check|yes|no]
126 Whether configure should use :program:`pkg-config` to detect build
129 * ``check`` (default): :program:`pkg-config` is optional
130 * ``yes``: :program:`pkg-config` is mandatory
131 * ``no``: configure does not use :program:`pkg-config` even when present
135 .. cmdoption:: --enable-pystats
147 -------------------
149 .. cmdoption:: --with-emscripten-target=[browser|node]
151 Set build flavor for ``wasm32-emscripten``.
158 .. cmdoption:: --enable-wasm-dynamic-linking
167 .. cmdoption:: --enable-wasm-pthreads
175 ---------------
177 .. cmdoption:: --prefix=PREFIX
179 Install architecture-independent files in PREFIX. On Unix, it
184 As an example, one can use ``--prefix="$HOME/.local/"`` to install
185 a Python in its home directory.
187 .. cmdoption:: --exec-prefix=EPREFIX
189 Install architecture-dependent files in EPREFIX, defaults to :option:`--prefix`.
193 .. cmdoption:: --disable-test-modules
195 Don't build nor install test modules, like the :mod:`test` package or the
200 .. cmdoption:: --with-ensurepip=[upgrade|install|no]
202 Select the :mod:`ensurepip` command run on Python installation:
204 * ``upgrade`` (default): run ``python -m ensurepip --altinstall --upgrade``
206 * ``install``: run ``python -m ensurepip --altinstall`` command;
213 -------------------
215 Configuring Python using ``--enable-optimizations --with-lto`` (PGO + LTO) is
218 .. cmdoption:: --enable-optimizations
223 The C compiler Clang requires ``llvm-profdata`` program for PGO. On
226 Disable also semantic interposition in libpython if ``--enable-shared`` and
227 GCC is used: add ``-fno-semantic-interposition`` to the compiler and linker
233 Use ``-fno-semantic-interposition`` on GCC.
237 Environment variable used in the Makefile: Python command line arguments for
240 Default: ``-m test --pgo --timeout=$(TESTTIMEOUT)``.
244 .. cmdoption:: --with-lto=[full|thin|no|yes]
246 Enable Link Time Optimization (LTO) in any build (disabled by default).
248 The C compiler Clang requires ``llvm-ar`` for LTO (``ar`` on macOS), as well
249 as an LTO-aware linker (``ld.gold`` or ``lld``).
254 To use ThinLTO feature, use ``--with-lto=thin`` on Clang.
256 .. cmdoption:: --with-computed-gotos
261 .. cmdoption:: --without-pymalloc
263 Disable the specialized Python memory allocator :ref:`pymalloc <pymalloc>`
268 .. cmdoption:: --without-doc-strings
271 by default). Documentation strings defined in Python are not affected.
277 .. cmdoption:: --enable-profiling
279 Enable C-level code profiling with ``gprof`` (disabled by default).
282 .. _debug-build:
284 Python Debug Build
285 ------------------
287 A debug build is Python built with the :option:`--with-pydebug` configure
290 Effects of a debug build:
296 * Add :option:`-X showrefcount <-X>` command line option.
298 * Add support for the ``__lltrace__`` variable: enable low-level tracing in the
300 * Install :ref:`debug hooks on memory allocators <default-memory-allocators>`
305 the ``NDEBUG`` macro (see also the :option:`--with-assertions` configure
309 * Unicode and int objects are created with their memory filled with a pattern
312 not called with an exception raised.
319 See also the :ref:`Python Development Mode <devmode>` and the
320 :option:`--with-trace-refs` configure option.
325 :option:`--with-trace-refs` option), which introduces the only ABI
330 -------------
332 .. cmdoption:: --with-pydebug
334 :ref:`Build Python in debug mode <debug-build>`: define the ``Py_DEBUG``
337 .. cmdoption:: --with-trace-refs
347 This build is not ABI compatible with release build (default build) or debug
348 build (``Py_DEBUG`` and ``Py_REF_DEBUG`` macros).
352 .. cmdoption:: --with-assertions
354 Build with C assertions enabled (default is no): ``assert(...);`` and
360 See also the :option:`--with-pydebug` option (:ref:`debug build
361 <debug-build>`) which also enables assertions.
365 .. cmdoption:: --with-valgrind
369 .. cmdoption:: --with-dtrace
373 See :ref:`Instrumenting CPython with DTrace and SystemTap
378 .. cmdoption:: --with-address-sanitizer
384 .. cmdoption:: --with-memory-sanitizer
390 .. cmdoption:: --with-undefined-behavior-sanitizer
399 --------------
401 .. cmdoption:: --enable-shared
403 Enable building a shared Python library: ``libpython`` (default is no).
405 .. cmdoption:: --without-static-libpython
407 Do not build ``libpythonMAJOR.MINOR.a`` and do not install ``python.o``
414 -----------------
416 .. cmdoption:: --with-libs='lib1 ...'
420 .. cmdoption:: --with-system-expat
422 Build the :mod:`pyexpat` module using an installed ``expat`` library
425 .. cmdoption:: --with-system-ffi
427 Build the :mod:`_ctypes` extension module using an installed ``ffi``
428 library, see the :mod:`ctypes` module (default is system-dependent).
430 .. cmdoption:: --with-system-libmpdec
432 Build the ``_decimal`` extension module using an installed ``mpdec``
437 .. cmdoption:: --with-readline=editline
445 .. cmdoption:: --without-readline
447 Don't build the :mod:`readline` module (built by default).
453 .. cmdoption:: --with-libm=STRING
455 Override ``libm`` math library to *STRING* (default is system-dependent).
457 .. cmdoption:: --with-libc=STRING
459 Override ``libc`` C library to *STRING* (default is system-dependent).
461 .. cmdoption:: --with-openssl=DIR
467 .. cmdoption:: --with-openssl-rpath=[no|auto|DIR]
472 * ``auto``: auto-detect rpath from :option:`--with-openssl` and
473 ``pkg-config``;
480 ----------------
482 .. cmdoption:: --with-hash-algorithm=[fnv|siphash13|siphash24]
484 Select hash algorithm for use in ``Python/pyhash.c``:
495 .. cmdoption:: --with-builtin-hashlib-hashes=md5,sha1,sha256,sha512,sha3,blake2
497 Built-in hash modules:
503 * ``sha3`` (with shake);
508 .. cmdoption:: --with-ssl-default-suites=[python|openssl|STRING]
512 * ``python`` (default): use Python's preferred selection;
522 The settings ``python`` and *STRING* also set TLS 1.2 as minimum
526 -------------
530 .. cmdoption:: --enable-universalsdk
531 .. cmdoption:: --enable-universalsdk=SDKDIR
533 Create a universal binary build. *SDKDIR* specifies which macOS SDK should
534 be used to perform the build (default is no).
536 .. cmdoption:: --enable-framework
537 .. cmdoption:: --enable-framework=INSTALLDIR
539 Create a Python.framework rather than a traditional Unix install. Optional
542 .. cmdoption:: --with-universal-archs=ARCH
545 only valid when :option:`--enable-universalsdk` is set.
550 * ``32-bit``;
551 * ``64-bit``;
552 * ``3-way``;
554 * ``intel-32``;
555 * ``intel-64``;
558 .. cmdoption:: --with-framework-name=FRAMEWORK
560 Specify the name for the python framework on macOS only valid when
561 :option:`--enable-framework` is set (default: ``Python``).
565 -----------------------
567 Cross compiling, also known as cross building, can be used to build Python
568 for another CPU architecture or platform. Cross compiling requires a Python
569 interpreter for the build platform. The version of the build Python must match
570 the version of the cross compiled host Python.
572 .. cmdoption:: --build=BUILD
574 configure for building on BUILD, usually guessed by :program:`config.guess`.
576 .. cmdoption:: --host=HOST
578 cross-compile to build programs to run on HOST (target platform)
580 .. cmdoption:: --with-build-python=path/to/python
582 path to build ``python`` binary for cross compiling
588 An environment variable that points to a file with configure overrides.
592 # config.site-aarch64
600 CONFIG_SITE=config.site-aarch64 ../configure \
601 --build=x86_64-pc-linux-gnu \
602 --host=aarch64-unknown-linux-gnu \
603 --with-build-python=../x86_64/python
606 Python Build System
609 Main files of the build system
610 ------------------------------
619 Main build steps
620 ----------------
624 * ``python.o`` and the static ``libpython`` library are linked into the
625 final ``python`` program.
627 and ``python setup.py build``.
630 ---------------------
632 * ``make``: Build Python with the standard library.
633 * ``make platform:``: build the ``python`` program, but don't build the
635 * ``make profile-opt``: build Python using Profile Guided Optimization (PGO).
636 You can use the configure :option:`--enable-optimizations` option to make
639 * ``make buildbottest``: Build Python and run the Python test suite, the same
640 way than buildbots test Python. Set ``TESTTIMEOUT`` variable (in seconds)
642 * ``make install``: Build and install Python.
643 * ``make regen-all``: Regenerate (almost) all generated files;
644 ``make regen-stdlib-module-names`` and ``autoconf`` must be run separately
651 ------------
653 Some C extensions are built as built-in modules, like the ``sys`` module.
654 They are built with the ``Py_BUILD_CORE_BUILTIN`` macro defined.
655 Built-in modules have no ``__file__`` attribute::
659 <module 'sys' (built-in)>
666 They are built with the ``Py_BUILD_CORE_MODULE`` macro defined.
667 Example on Linux x86-64::
671 …<module '_asyncio' from '/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'>
673 '/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'
675 :file:`Modules/Setup` is used to generate Makefile targets to build C extensions.
676 At the beginning of the files, C extensions are built as built-in modules.
701 ------------------
711 (Objective) C/C++ preprocessor flags, e.g. ``-I<include dir>`` if you have
715 value for setup.py to be able to build extension modules using the
726 Default: ``$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)``.
731 --------------
737 Example: ``gcc -pthread``.
741 C compiler command used to build the ``main()`` function of programs like
742 ``python``.
744 Variable set by the :option:`--with-cxx-main` option of the configure
753 Used if the :option:`--with-cxx-main` option is used.
755 Example: ``g++ -pthread``.
765 distutils :envvar:`CFLAGS` once Python is installed (:issue:`21121`).
769 * the compiler flag ``-I`` (for setting the search path for include files).
770 The ``-I`` flags are processed from left to right, and any flags in
771 :envvar:`CFLAGS` would take precedence over user- and package-supplied ``-I``
774 * hardening flags such as ``-Werror`` because distributions cannot control
808 Strict or non-strict aliasing flags used to compile ``Python/dtoa.c``.
814 Compiler flags used to build a shared library.
816 For example, ``-fPIC`` is used on Linux and on BSD.
822 Default: ``$(CCSHARED)`` when :option:`--enable-shared` is used, or an empty
831 Default: ``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/internal``.
845 Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``.
851 Compiler flags to build a standard library extension module as a built-in
854 Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``.
866 ------------
870 Linker command used to build programs like ``python`` and ``_testembed``.
880 pre-set values.
888 the distutils :envvar:`LDFLAGS` once Python is installed (:issue:`35257`).
892 * the compiler flag ``-L`` (for setting the search path for libraries).
893 The ``-L`` flags are processed from left to right, and any flags in
894 :envvar:`LDFLAGS` would take precedence over user- and package-supplied ``-L``
906 Linker flags, e.g. ``-L<lib dir>`` if you have libraries in a nonstandard
910 value for setup.py to be able to build extension modules using the
915 Linker flags to pass libraries to the linker when linking the Python
918 Example: ``-lrt``.
922 Command to build a shared library.
928 Command to build ``libpython`` shared library.