pybind11/tools
Wenzel Jakob e076c4513d macOS: disable fixup chains when linking extension modules
On macOS, extension library builds usually rely on the flag ``-undefined
dynamic_lookup`` to get the linker to temporarily accept missing CPython
API symbols. As the name implies, those symbols are then dynamically
resolved when Python imports such an extension library. Binaries
produced in this way are more portable since they don't contain a
hardcoded path to the CPython library. This is critical when
distributing binary wheels on PyPI, etc..

When targeting macOS>=12, XCode recently started to generate a somewhat
ominous warning:

``-undefined dynamic_lookup may not work with chained fixups``

For further detail on what chained fixups are, see the following
informative WWDC
https://developer.apple.com/videos/play/wwdc2022/110362/ (the relevant
part starts about 20mins into the video)

The message that the dynamic resolution functionality became broken.
I reported this to Apple via feedback request FB11767124.

Apple investigated the request and updated the behavior of ``ld``
starting with XCode 14.3b1+: it now disables the fixup chain linker
optimization whenever ``-undefined dynamic_lookup`` is specified. The
feedback from Apple also stated that the parameter
``-Wl,-no_fixup_chains`` should be specified on pre-14.3 XCode versions
to ensure correct behavior.

This commit realizes those changes by passing a flag to *always* disable
fixup chains. Related discussion is available in the CPython repository
(https://github.com/python/cpython/issues/97524).
2023-02-27 13:32:16 +01:00
..
FindCatch.cmake Revert "Go back to CMake 3.25.2 (#4496)" (#4503) 2023-02-16 10:54:57 -05:00
FindEigen3.cmake style: avoid using unintialized variables (#2806) 2021-01-19 18:48:22 -05:00
FindPythonLibsNew.cmake fix(cmake): support Windows ARM cross-compilation (#4406) 2022-12-19 14:36:39 -05:00
JoinPaths.cmake feat(cmake): add installation support for pkg-config dependency detection (#4077) 2022-08-09 00:02:45 -04:00
check-style.sh Add shellcheck style checking (#3114) 2021-07-14 16:52:13 -04:00
cmake_uninstall.cmake.in format: include .in files 2020-08-06 11:54:41 -04:00
codespell_ignore_lines_from_errors.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
libsize.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
make_changelog.py chore: prepare for 2.10.3 (#4437) 2023-01-03 11:34:22 -05:00
pybind11.pc.in feat(cmake): add installation support for pkg-config dependency detection (#4077) 2022-08-09 00:02:45 -04:00
pybind11Common.cmake macOS: disable fixup chains when linking extension modules 2023-02-27 13:32:16 +01:00
pybind11Config.cmake.in chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
pybind11NewTools.cmake Fix multi-context new Python linking mode (#4401) 2022-12-14 14:03:37 -05:00
pybind11Tools.cmake fix pybind11Tools.cmake typo causing Unknown arguments (#4327) 2022-11-11 17:52:57 -08:00
pyproject.toml ci: releases (#2530) 2020-09-30 15:48:08 -04:00
setup_global.py.in First draft of Eigen::Tensor support (#4201) 2022-10-18 16:54:16 -07:00
setup_main.py.in Revert "feat: add entrypoint for cmake modules dir" (#4270) 2022-10-21 17:25:53 -04:00