Registry / serialization / cxxfilt

cxxfilt

JSON →
library0.3.0pypypi✓ verified 24d ago

Cxxfilt provides a Python interface to demangle C++ symbol names, typically found in compiled binaries or stack traces. It wraps the functionality of system utilities like `c++filt` or `abi::__cxa_demangle`. The current version is 0.3.0, and it is actively maintained on GitHub.

pip install cxxfilt
INSTALL
IMPORT
SIG · CXXFILT
C
cxxfilt
serializationpythonv0.3.0
Install
1.5s avg
Import
50ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.048s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.052s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

demangle
import cxxfilt symbol_name = '_ZNSt22condition_variable_anyD2Ev' demangled_name = cxxfilt.demangle(symbol_name)
The primary function for demangling C++ symbols.

Demangle a common C++ mangled symbol and check the validity of the internal demangler.

import cxxfilt mangled_symbol = '_ZNSt22condition_variable_anyD2Ev' demangled_symbol = cxxfilt.demangle(mangled_symbol) print(f"Mangled: {mangled_symbol}") print(f"Demangled: {demangled_symbol}") # To check if the underlying demangler is valid (e.g., if system libraries are present) # The import itself no longer fails if libraries are missing since v0.3.0. is_demangler_valid = not isinstance(cxxfilt.default_demangler, cxxfilt.DeferedErrorDemangler) print(f"Is demangler valid: {is_demangler_valid}")
Debug
Known issues
breakingPython 2.7 is no longer supported in `cxxfilt` versions 0.3.0 and above. For Python 2.7 compatibility, use `cxxfilt` version < 0.3.
fix
Upgrade to Python 3.6+ or pin `cxxfilt<0.3` for Python 2.7 projects.
affects: 0.3.0+
gotchaThe library does not officially support Windows environments. It is primarily tested on Linux and macOS, and is expected to work on Unix-like systems with `libc` and `libc++/libstdc++`.
fix
Consider using alternative tools or a Linux/macOS environment for demangling C++ symbols on Windows. Contributions for Windows support are welcome.
affects: All versions
gotchaAlthough `import cxxfilt` no longer fails if system C/C++ libraries are unavailable (since v0.3.0), attempting to demangle symbols will fail or raise `LibraryNotFound` or `InternalError` if the underlying native demangling functions are not accessible.
fix
Ensure that `libc` and either `libc++` or `libstdc++` are installed on your system. You can programmatically check for demangler validity using `not isinstance(cxxfilt.default_demangler, cxxfilt.DeferedErrorDemangler)`.
affects: 0.3.0+
gotchaThe `cxxfilt.demangle()` function can raise an `InvalidName` exception if the provided string is not a valid C++ ABI mangled name.
fix
Implement error handling (e.g., `try-except cxxfilt.InvalidName`) when demangling user-provided or untrusted symbol names.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'cxxfilt'
The `cxxfilt` package is not installed in the Python environment being used, or the Python interpreter cannot find it in its `sys.path`.
fix
Ensure the package is installed in the correct environment using pip: `pip install cxxfilt`
cxxfilt.Error: Cannot find any of libraries: ('c',)
The `cxxfilt` library, which relies on underlying C/C++ libraries (like `libc` and `libstdc++`) for demangling, cannot locate these essential system libraries on your operating system. This is common on Windows where `find_library('c')` might fail, or on Linux/macOS if development tools are missing.
fix
On Linux, ensure `build-essential` (Debian/Ubuntu) or `binutils-devel` and `glibc-devel` (CentOS/Fedora) are installed. On macOS, ensure Xcode Command Line Tools are installed via `xcode-select --install`. Windows is not officially supported by `cxxfilt` for direct demangling; consider using a WSL environment or a different tool.
cxxfilt.InvalidName: b'_ZQQ'
The input string provided to `cxxfilt.demangle()` or `cxxfilt.demangleb()` is not a valid C++ mangled symbol name according to the C++ ABI rules.
fix
Provide a syntactically correct C++ mangled symbol name. If the name is known to be valid for `c++filt` but still fails, check the version of `libstdc++` or `libc++` being used by `cxxfilt` as different compilers/versions can have slight variations in mangling. You can also try setting `external_only=False` if it's an internal symbol: `cxxfilt.demangle(invalid_symbol, external_only=False)`.
ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found
The `cxxfilt` library or its dependencies were compiled against a newer version of `libstdc++` (GCC's standard C++ library) than what is available or found in your system's `LD_LIBRARY_PATH` at runtime, leading to a symbol version mismatch.
fix
Update your system's `libstdc++` to a compatible version, or ensure that the correct `libstdc++` path (e.g., from a newer GCC installation or a conda environment) is prepended to your `LD_LIBRARY_PATH` environment variable before running your Python script. For example: `export LD_LIBRARY_PATH=/path/to/newer/libstdc++:$LD_LIBRARY_PATH`.
Upgrade
Version history
0.3.0latest on PyPI · released Aug 21, 2021
Audit
Dependencies
Python 3.6+requiredRequired for versions 0.3.0 and above.
System C/C++ libraries (libc, libc++/libstdc++)requiredThe library is a wrapper around native C++ demangling functions, which require these system libraries to be present for actual demangling to occur.
Agent activity
9 hits · last 30 days
node
6
Resources
cxxfilt — pip install cxxfilt · libregistry