tree-sitter / tree-sitter/tree-sitter-cpp

bug: installation fails with 3.15t interpreter on Windows

Open
#363 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
453
Forks
185
PR merge metrics
No merged PRs in 30d

Description

Did you check existing issues?
  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues of tree-sitter-cpp
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

0.25.2

Describe the bug

Collecting git+https://github.com/tree-sitter/tree-sitter-cpp
Cloning https://github.com/tree-sitter/tree-sitter-cpp to C:\Users\שזדס\AppData\Local\Temp\pip-req-build-5eaguw5n
Running command git clone --filter=blob:none --quiet https://github.com/tree-sitter/tree-sitter-cpp 'C:\Users\שזדס\AppData\Local\Temp\pip-req-build-5eaguw5n'
Resolved https://github.com/tree-sitter/tree-sitter-cpp to commit 8b5b49eb196bec7040441bee33b2c9a4838d6967
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: tree-sitter-cpp
Building wheel for tree-sitter-cpp (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building wheel for tree-sitter-cpp (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [84 lines of output]
C:\Users\שזדס\AppData\Local\Temp\pip-build-env-keq88ygn\overlay\Lib\site-packages\wheel\bdist_wheel.py:4: FutureWarning: The 'wheel' package is no longer the canonical location of the 'bdist_wheel' command, and will be removed in a future release. Please update to setuptools v70.1 or later which contains an integrated version of this command.
warn(
C:\Users\שזדס\AppData\Local\Temp\pip-build-env-keq88ygn\overlay\Lib\site-packages\setuptools\config_apply_pyprojecttoml.py:82: SetuptoolsDeprecationWarning: project.license as a TOML table is deprecated
!!

          ********************************************************************************
          Please use a simple string containing a SPDX expression for `project.license`. You can also use `project.license-files`. (Both options available on setuptools>=77.0.0).

          By 2027-Feb-18, you need to update your project and remove deprecated calls
          or your builds will no longer be supported.

          See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
          ********************************************************************************

  !!
    corresp(dist, value, root_dir)
  C:\Users\שזדס\AppData\Local\Temp\pip-build-env-keq88ygn\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py:61: SetuptoolsDeprecationWarning: License classifiers are deprecated.
  !!

          ********************************************************************************
          Please consider removing the following classifiers in favor of a SPDX license expression:

          License :: OSI Approved :: MIT License

          See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
          ********************************************************************************

  !!
    dist._finalize_license_expression()
  C:\Users\שזדס\AppData\Local\Temp\pip-build-env-keq88ygn\overlay\Lib\site-packages\setuptools\dist.py:765: SetuptoolsDeprecationWarning: License classifiers are deprecated.
  !!

          ********************************************************************************
          Please consider removing the following classifiers in favor of a SPDX license expression:

          License :: OSI Approved :: MIT License

          See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
          ********************************************************************************

  !!
    self._finalize_license_expression()
  running bdist_wheel
  running build
  creating build\lib.win-amd64-cpython-315t\tree_sitter_cpp\queries
  copying queries\highlights.scm -> build\lib.win-amd64-cpython-315t\tree_sitter_cpp\queries
  copying queries\injections.scm -> build\lib.win-amd64-cpython-315t\tree_sitter_cpp\queries
  copying queries\tags.scm -> build\lib.win-amd64-cpython-315t\tree_sitter_cpp\queries
  running build_py
  copying bindings\python\tree_sitter_cpp\__init__.py -> build\lib.win-amd64-cpython-315t\tree_sitter_cpp
  running egg_info
  writing bindings/python\tree_sitter_cpp.egg-info\PKG-INFO
  writing dependency_links to bindings/python\tree_sitter_cpp.egg-info\dependency_links.txt
  writing requirements to bindings/python\tree_sitter_cpp.egg-info\requires.txt
  writing top-level names to bindings/python\tree_sitter_cpp.egg-info\top_level.txt
  reading manifest file 'bindings/python\tree_sitter_cpp.egg-info\SOURCES.txt'
  adding license file 'LICENSE'
  writing manifest file 'bindings/python\tree_sitter_cpp.egg-info\SOURCES.txt'
  copying bindings\python\tree_sitter_cpp\__init__.pyi -> build\lib.win-amd64-cpython-315t\tree_sitter_cpp
  copying bindings\python\tree_sitter_cpp\binding.c -> build\lib.win-amd64-cpython-315t\tree_sitter_cpp
  copying bindings\python\tree_sitter_cpp\py.typed -> build\lib.win-amd64-cpython-315t\tree_sitter_cpp
  running build_ext
  building '_binding' extension
  creating build\temp.win-amd64-cpython-315t\Release\bindings\python\tree_sitter_cpp
  creating build\temp.win-amd64-cpython-315t\Release\src
  "C:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Tools\MSVC\14.51.36231\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPy_LIMITED_API=0x03090000 -DPY_SSIZE_T_CLEAN -DTREE_SITTER_HIDE_SYMBOLS -DPy_GIL_DISABLED=1 -Isrc -IC:\Users\שזדס\AppData\Local\Python\pythoncore-3.15t-64\include -IC:\Users\שזדס\AppData\Local\Python\pythoncore-3.15t-64\Include "-IC:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Tools\MSVC\14.51.36231\include" "-IC:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Tools\MSVC\14.51.36231\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.28000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.28000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.28000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.28000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.28000.0\\cppwinrt" /Tcbindings/python/tree_sitter_cpp/binding.c /Fobuild\temp.win-amd64-cpython-315t\Release\bindings\python\tree_sitter_cpp\binding.obj /std:c11 /utf-8
  binding.c
  C:\Users\שזדס\AppData\Local\Python\pythoncore-3.15t-64\include\object.h(375): warning C4013: 'Py_IS_TYPE' undefined; assuming extern returning int
  C:\Users\שזדס\AppData\Local\Python\pythoncore-3.15t-64\include\object.h(375): warning C4013: 'Py_TYPE' undefined; assuming extern returning int
  C:\Users\שזדס\AppData\Local\Python\pythoncore-3.15t-64\include\object.h(375): warning C4047: 'function': 'PyTypeObject *' differs in levels of indirection from 'int'
  C:\Users\שזדס\AppData\Local\Python\pythoncore-3.15t-64\include\object.h(375): warning C4024: 'PyType_IsSubtype': different types for formal and actual parameter 1
  C:\Users\שזדס\AppData\Local\Python\pythoncore-3.15t-64\include\object.h(763): warning C4047: 'function': 'PyTypeObject *' differs in levels of indirection from 'int'
  C:\Users\שזדס\AppData\Local\Python\pythoncore-3.15t-64\include\object.h(763): warning C4024: 'PyType_HasFeature': different types for formal and actual parameter 1
  bindings/python/tree_sitter_cpp/binding.c(17): error C2079: 'module' uses undefined struct 'PyModuleDef'
  bindings/python/tree_sitter_cpp/binding.c(18): error C2065: 'PyModuleDef_HEAD_INIT': undeclared identifier
  bindings/python/tree_sitter_cpp/binding.c(18): error C2224: left of '.m_base' must have struct/union type
  bindings/python/tree_sitter_cpp/binding.c(19): error C2224: left of '.m_name' must have struct/union type
  bindings/python/tree_sitter_cpp/binding.c(23): error C2078: too many initializers
  bindings/python/tree_sitter_cpp/binding.c(20): error C2224: left of '.m_doc' must have struct/union type
  bindings/python/tree_sitter_cpp/binding.c(21): error C2224: left of '.m_size' must have struct/union type
  bindings/python/tree_sitter_cpp/binding.c(22): error C2224: left of '.m_methods' must have struct/union type
  bindings/python/tree_sitter_cpp/binding.c(17): error C2099: initializer is not a constant
  bindings/python/tree_sitter_cpp/binding.c(26): warning C4133: 'function': incompatible types - from 'int *' to 'PyModuleDef *'
  error: command 'C:\\Program Files\\Microsoft Visual Studio\\18\\Insiders\\VC\\Tools\\MSVC\\14.51.36231\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for tree-sitter-cpp
Failed to build tree-sitter-cpp
error: failed-wheel-build-for-install

× Failed to build installable wheels for some pyproject.toml based projects
╰─> tree-sitter-cpp

Steps To Reproduce/Bad Parse Tree
  1. Install the 3.15t interpreter
  2. Install Microsoft Visual C++ 14.0 or greater
Expected Behavior/Parse Tree

Successful installation

Repro
// Example code that causes the issue
void foo() {
  // Code that fails to parse, or causes an error
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Windows install with the 3.15t interpreter and the toolchain described in the issue. Inspect bindings/python/tree_sitter_cpp/binding.c alongside the Python 3.15t headers, especially the reported PyModuleDef errors. Done means the package builds and installs successfully on that interpreter.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.