Commit d5a595c
fix: Add
When targeting the Python Stable ABI on Windows (by setting the
Py_LIMITED_API macro to a Python minimum version hex), the unversioned
python3.lib needs to be linked instead of the versioned one (e.g.
python38.lib for Python 3.8).
Python's own config sets the library to link by default in a header
called pyconfig.h
(https://github.com/python/cpython/blob/9cc9e277254023c0ca08e1a9e379fd89475ca9c2/PC/pyconfig.h#L270),
which prompts the linker to search for python3.lib if a stable ABI
extension is built using `@rules_python` toolchains.
Since this library is not exported on Windows in the
`python_repository()` rule, building Python C++ extensions with
rules_python toolchains fails in the linking step, because the library
is never copied. Consequently, it is added now to allow Python SABI
extensions to be built (and linked) on Windows with `@rules_python`.
Since Python takes responsibility for linking the correct lib on
Windows, and never both at the same time, no other changes are made.
---------
Co-authored-by: Richard Levasseur <[email protected]>
Co-authored-by: Richard Levasseur <[email protected]>libs/python3.lib to libpython target for SABI builds on Windows (#1820)1 parent 25aeb40 commit d5a595c
File tree
4 files changed
+40
-4
lines changed- python/private
- tests/cc/current_py_cc_libs
4 files changed
+40
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
98 | 101 | | |
99 | 102 | | |
100 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
92 | 100 | | |
93 | 101 | | |
94 | 102 | | |
| |||
97 | 105 | | |
98 | 106 | | |
99 | 107 | | |
100 | | - | |
| 108 | + | |
101 | 109 | | |
102 | 110 | | |
103 | 111 | | |
| |||
156 | 164 | | |
157 | 165 | | |
158 | 166 | | |
159 | | - | |
| 167 | + | |
| 168 | + | |
160 | 169 | | |
| 170 | + | |
161 | 171 | | |
162 | 172 | | |
163 | 173 | | |
164 | 174 | | |
165 | 175 | | |
166 | 176 | | |
167 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
168 | 183 | | |
169 | 184 | | |
170 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
0 commit comments