Title: Python fails to build on WASM: _testcapi/vectorcall_limited.c is built with Py_BUILD_CORE_BUILTIN · Issue #109723 · python/cpython · GitHub
Open Graph Title: Python fails to build on WASM: _testcapi/vectorcall_limited.c is built with Py_BUILD_CORE_BUILTIN · Issue #109723 · python/cpython
X Title: Python fails to build on WASM: _testcapi/vectorcall_limited.c is built with Py_BUILD_CORE_BUILTIN · Issue #109723 · python/cpython
Description: My PR #109690 broke WASM buildbots. Example with wasm32-emscripten node (dynamic linking) 3.x: https://buildbot.python.org/all/#/builders/1056/builds/3142 /opt/emsdk/upstream/emscripten/emcc -DNDEBUG -g -O3 (...) -DPy_BUILD_CORE_BUILTIN ...
Open Graph Description: My PR #109690 broke WASM buildbots. Example with wasm32-emscripten node (dynamic linking) 3.x: https://buildbot.python.org/all/#/builders/1056/builds/3142 /opt/emsdk/upstream/emscripten/emcc -DNDEB...
X Description: My PR #109690 broke WASM buildbots. Example with wasm32-emscripten node (dynamic linking) 3.x: https://buildbot.python.org/all/#/builders/1056/builds/3142 /opt/emsdk/upstream/emscripten/emcc -DNDEB...
Opengraph URL: https://github.com/python/cpython/issues/109723
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Python fails to build on WASM: _testcapi/vectorcall_limited.c is built with Py_BUILD_CORE_BUILTIN","articleBody":"My PR #109690 broke WASM buildbots.\r\n\r\nExample with wasm32-emscripten node (dynamic linking) 3.x: https://buildbot.python.org/all/#/builders/1056/builds/3142\r\n\r\n```\r\n/opt/emsdk/upstream/emscripten/emcc -DNDEBUG -g -O3 (...) -DPy_BUILD_CORE_BUILTIN -c ../../Modules/_testcapi/vectorcall_limited.c -o Modules/_testcapi/vectorcall_limited.o\r\n\r\nIn file included from ../../Modules/_testcapi/vectorcall_limited.c:2:\r\nIn file included from ../../Modules/_testcapi/parts.h:7:\r\nIn file included from ../../Include/Python.h:44:\r\n../../Include/pyport.h:52:4: error: \"Py_LIMITED_API is not compatible with Py_BUILD_CORE\"\r\n# error \"Py_LIMITED_API is not compatible with Py_BUILD_CORE\"\r\n ^\r\n1 error generated.\r\n```\r\n\r\nI'm not sure how ``-DPy_BUILD_CORE_BUILTIN`` landed in the command building ``Modules/_testcapi/vectorcall_limited.c``.\r\n\r\nI don't think that it's correct that ``vectorcall_limited.c`` which tests the limited C API on purpose it built with ``Py_BUILD_CORE``.\r\n\r\nOn my Linux machine, Makefile contains:\r\n\r\n```\r\nModules/_testcapi/vectorcall_limited.o: $(srcdir)/Modules/_testcapi/vectorcall_limited.c $(MODULE__TESTCAPI_DEPS) $(MODULE_DEPS_SHARED) $(PYTHON_HEADERS); $(CC) $(MODULE__TESTCAPI_CFLAGS) $(PY_STDMODULE_CFLAGS) $(CCSHARED) -c $(srcdir)/Modules/_testcapi/vectorcall_limited.c -o Modules/_testcapi/vectorcall_limited.o\r\n```\r\n\r\nSo it gets two groups of compiler flags:\r\n\r\n* ``MODULE__TESTCAPI_CFLAGS``: not defined (empty)\r\n* ``PY_STDMODULE_CFLAGS``: ``-fno-strict-overflow -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -Og -Wall -O0 -std=c11 -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I. -I./Include``\r\n\r\nI don't see ``-DPy_BUILD_CORE_BUILTIN`` here.\r\n\r\nI can reproduce the issue locally with this custom ``Modules/Setup.local``:\r\n\r\n```\r\n*static*\r\n_testcapi _testcapimodule.c _testcapi/vectorcall.c _testcapi/vectorcall_limited.c _testcapi/heaptype.c _testcapi/abstract.c _testcapi/unicode.c _testcapi/dict.c _testcapi/getargs.c _testcapi/datetime.c _testcapi/docstring.c _testcapi/mem.c _testcapi/watchers.c _testcapi/long.c _testcapi/float.c _testcapi/structmember.c _testcapi/exceptions.c _testcapi/code.c _testcapi/buffer.c _testcapi/pyatomic.c _testcapi/pyos.c _testcapi/immortal.c _testcapi/heaptype_relative.c _testcapi/gc.c\r\n```\r\n\r\nmake fails with:\r\n\r\n```\r\nIn file included from ./Include/Python.h:44,\r\n from ./Modules/_testcapi/parts.h:7,\r\n from ./Modules/_testcapi/vectorcall_limited.c:2:\r\n./Include/pyport.h:52:4: error: #error \"Py_LIMITED_API is not compatible with Py_BUILD_CORE\"\r\n 52 | # error \"Py_LIMITED_API is not compatible with Py_BUILD_CORE\"\r\n | ^~~~~\r\nmake: *** [Makefile:2982: Modules/_testcapi/vectorcall_limited.o] Error 1\r\nmake: *** Waiting for unfinished jobs....\r\nIn file included from ./Include/Python.h:44,\r\n from ./Modules/_testcapi/parts.h:7,\r\n from ./Modules/_testcapi/heaptype_relative.c:2:\r\n./Include/pyport.h:52:4: error: #error \"Py_LIMITED_API is not compatible with Py_BUILD_CORE\"\r\n 52 | # error \"Py_LIMITED_API is not compatible with Py_BUILD_CORE\"\r\n | ^~~~~\r\nmake: *** [Makefile:3001: Modules/_testcapi/heaptype_relative.o] Error 1\r\n```\r\n\r\n``Modules/makesetup`` uses ``$(PY_STDMODULE_CFLAGS)`` if ``$doconfig`` is no, but uses ``$(PY_BUILTIN_MODULE_CFLAGS)`` otherwise. In the second case, $(PY_BUILTIN_MODULE_CFLAGS) adds ``-DPy_BUILD_CORE_BUILTIN`` to compiler command used to build ``_testcapi`` C files.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-109727\n* gh-109842\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2023-09-22T12:22:03.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/109723/cpython/issues/109723"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7ccdb5bb-e714-c471-02fc-ac7c8925536d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A9BE:2D2FEF:18E104F:216D200:6969AD4E |
| html-safe-nonce | 4fe50bb99a6ac95ebaef36d2fe794d38401fc9a73c5298445c12e2ba4209e04a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOUJFOjJEMkZFRjoxOEUxMDRGOjIxNkQyMDA6Njk2OUFENEUiLCJ2aXNpdG9yX2lkIjoiMzY3NTQyMjI5Mzk5OTg1Njk3NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6f951ad57dc7ece6681d4b3a781f0d2cf6bb4114d01b11ca8837b87f6011445e |
| hovercard-subject-tag | issue:1908807608 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/109723/issue_layout |
| twitter:image | https://opengraph.githubassets.com/65a51704c7868240241b5bcbb38abcb9001531aca339e17e075dea654129d5df/python/cpython/issues/109723 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/65a51704c7868240241b5bcbb38abcb9001531aca339e17e075dea654129d5df/python/cpython/issues/109723 |
| og:image:alt | My PR #109690 broke WASM buildbots. Example with wasm32-emscripten node (dynamic linking) 3.x: https://buildbot.python.org/all/#/builders/1056/builds/3142 /opt/emsdk/upstream/emscripten/emcc -DNDEB... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vstinner |
| hostname | github.com |
| expected-hostname | github.com |
| None | 24c4c97a2d520cb286b35e1a4c22d7a4df3c26a2fa28dd7cdf0e65db327b4de7 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 124667f43168afb6c9c03b7c02eb5b1d2e1be3d9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width