You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
clang.cindex.TranslationUnitLoadError: Error parsing translation unit #28
Hi, I'm trying to run the pybind11_mkdoc in a single file called score.h, but I got this error below:
C:\Users\nyck\Desktop\maialib>python -m pybind11_mkdoc maiacore\include\maiacore\score.h
Processing "'maiacore\include\maiacore\score.h'" ..
Waiting for jobs to finish ..
error: error reading ''maiacore\include\maiacore\score.h''
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Users\nyck\AppData\Roaming\Python\Python310\site-packages\pybind11_mkdoc\mkdoc_lib.py", line 246, in run
tu = index.parse(self.filename, self.parameters)
File "C:\Users\nyck\AppData\Roaming\Python\Python310\site-packages\clang\cindex.py", line 2722, in parse
return TranslationUnit.from_source(path, args, unsaved_files, options,
File "C:\Users\nyck\AppData\Roaming\Python\Python310\site-packages\clang\cindex.py", line 2837, in from_source
raise TranslationUnitLoadError("Error parsing translation unit.")
clang.cindex.TranslationUnitLoadError: Error parsing translation unit.
The file score.h is a valid C++ header that contains a valid Doxygen documentation in it.
@nyckmaia I'm going through old issues and trying to close them out. Are you able to share the score.h file that you were having trouble with? It will be hard to help if I can't reproduce the error.
I'm not currently using pybind11_mkdoc. When I made that post, I was just testing the tool and seeing if it could easily integrate with my maialib project.
Unfortunately, I don't have time to continue testing, but I'll leave the link to the code in my score.h file on GitHub here, okay?
I'm not currently using pybind11_mkdoc. When I made that post, I was just testing the tool and seeing if it could easily integrate with my maialib project.
Unfortunately, I don't have time to continue testing, but I'll leave the link to the code in my score.h file on GitHub here, okay?
@nyckmaia That's perfect, thank you! I'm pretty busy the next couple of weeks, but hoping to test it out afterward and see if I can re-create (and then hopefully fix) the issue.
Unfortunatley, I do not have acccess to a Windows 10 machine, so reproducing will likely be difficult. I did run this in a clean Ubuntu docker image using:
FROM ubuntu:24.04
# Update package lists and install sudoRUN apt update
RUN apt install -y sudo python3-dev python3-pip git llvm clang
I then set up a Python virtual environment for 3.10 and installed the following:
This produces a docs.h file with no errors that looks like it contains all the intended docstrings. My hunch is that the translational unit parsing error comes either from the clang version used (the Ubuntu container has 18, while 15 was used when the error was reported) or this is an issue with Windows which is not explicitly supported.
I'll leave this issue open. Maybe someone else who has access to a Windows 10 machine can test this with the LLVM version specified and see if they can reproduce the same issue.
Activity
leakec commentedon Nov 15, 2025
@nyckmaia I'm going through old issues and trying to close them out. Are you able to share the
score.hfile that you were having trouble with? It will be hard to help if I can't reproduce the error.nyckmaia commentedon Nov 17, 2025
Hi @leakec ,
I'm not currently using pybind11_mkdoc. When I made that post, I was just testing the tool and seeing if it could easily integrate with my maialib project.
Unfortunately, I don't have time to continue testing, but I'll leave the link to the code in my score.h file on GitHub here, okay?
https://github.com/nyckmaia/maialib/blob/main/maiacore/include/maiacore/score.h
leakec commentedon Nov 17, 2025
@nyckmaia That's perfect, thank you! I'm pretty busy the next couple of weeks, but hoping to test it out afterward and see if I can re-create (and then hopefully fix) the issue.
leakec commentedon Nov 30, 2025
Unfortunatley, I do not have acccess to a Windows 10 machine, so reproducing will likely be difficult. I did run this in a clean Ubuntu docker image using:
I then set up a Python virtual environment for 3.10 and installed the following:
and from
maialib/maiacore/includeI ranpython -m pybind11_mkdoc -I. -I../external/sqlitecpp/include -Iexternal/cpptrace/include -Iexternal -std=c++17 -o do cs.h maiacore/score.hThis produces a
docs.hfile with no errors that looks like it contains all the intended docstrings. My hunch is that the translational unit parsing error comes either from the clang version used (the Ubuntu container has 18, while 15 was used when the error was reported) or this is an issue with Windows which is not explicitly supported.I'll leave this issue open. Maybe someone else who has access to a Windows 10 machine can test this with the LLVM version specified and see if they can reproduce the same issue.