[clang] [clang][python][test] Check if libclang.so is loadable (PR #142353)
Rainer Orth via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 4 05:39:48 PDT 2025
rorth wrote:
> @rorth Now that #142371 is merged, can you re-evaluate this PR and update the description?
This PR changed the output from completely silent to excessively verbose: I now get
```
FAILED: tools/clang/bindings/python/tests/CMakeFiles/check-clang-python /var/llvm/local-i386-release-stage2-A-openmp/tools/clang/stage2-bins/tools/clang/bindings/python/tests/CMakeFiles/check-clang-python
cd /vol/llvm/src/llvm-project/local/clang/bindings/python && /usr/bin/cmake -E env CLANG_NO_DEFAULT_CONFIG=1 CLANG_LIBRARY_PATH=/var/llvm/local-i386-release-stage2-A-openmp/tools/clang/stage2-bins/lib /usr/bin/python3.11 -m unittest discover
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE.E.EEEEEEEEE..EEEEEE.EEEEEEEEEEEEEE...EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
======================================================================
ERROR: test_access_specifiers (tests.cindex.test_access_specifiers.TestAccessSpecifiers.test_access_specifiers)
Ensure that C++ access specifiers are available on cursors
----------------------------------------------------------------------
Traceback (most recent call last):
File "/vol/llvm/src/llvm-project/local/clang/bindings/python/clang/cindex.py", line 4371, in get_cindex_library
library = cdll.LoadLibrary(self.get_filename())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/ctypes/__init__.py", line 454, in LoadLibrary
return self._dlltype(name)
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/ctypes/__init__.py", line 376, in __init__
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: ld.so.1: python3.11: /var/llvm/local-i386-release-stage2-A-openmp/tools/clang/stage2-bins/lib/libclang.so: wrong ELF class: ELFCLASS32
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/vol/llvm/src/llvm-project/local/clang/bindings/python/tests/cindex/test_access_specifiers.py", line 17, in test_access_specifiers
tu = get_tu(
^^^^^^^
File "/vol/llvm/src/llvm-project/local/clang/bindings/python/tests/cindex/util.py", line 30, in get_tu
return TranslationUnit.from_source(name, args, unsaved_files=[(name, source)])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/vol/llvm/src/llvm-project/local/clang/bindings/python/clang/cindex.py", line 3317, in from_source
index = Index.create()
^^^^^^^^^^^^^^
File "/vol/llvm/src/llvm-project/local/clang/bindings/python/clang/cindex.py", line 3189, in create
return Index(conf.lib.clang_createIndex(excludeDecls, 0))
^^^^^^^^
File "/vol/llvm/src/llvm-project/local/clang/bindings/python/clang/cindex.py", line 250, in __get__
value = self.wrapped(instance)
^^^^^^^^^^^^^^^^^^^^^^
File "/vol/llvm/src/llvm-project/local/clang/bindings/python/clang/cindex.py", line 4343, in lib
lib = self.get_cindex_library()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/vol/llvm/src/llvm-project/local/clang/bindings/python/clang/cindex.py", line 4378, in get_cindex_library
raise LibclangError(msg)
clang.cindex.LibclangError: ld.so.1: python3.11: /var/llvm/local-i386-release-stage2-A-openmp/tools/clang/stage2-bins/lib/libclang.so: wrong ELF class: ELFCLASS32. To provide a path to libclang use Config.set_library_path() or Config.set_library_file().
```
158 times total. While one can see what's going on, there's no way to avoid the issue.
https://github.com/llvm/llvm-project/pull/142353
More information about the cfe-commits
mailing list