pybind11_mkdoc icon indicating copy to clipboard operation
pybind11_mkdoc copied to clipboard

clang not correctly detected

Open tdegeus opened this issue 6 months ago • 1 comments

In a new conda environment, I've installed

conda install -c conda-forge python
python -m pip install .

which outputs

Processing /Users/tdegeus/Downloads/pybind11_mkdoc
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting clang (from pybind11_mkdoc==2.6.2.dev1)
  Using cached clang-16.0.1.1-py3-none-any.whl (31 kB)
Building wheels for collected packages: pybind11_mkdoc
  Building wheel for pybind11_mkdoc (pyproject.toml) ... done
  Created wheel for pybind11_mkdoc: filename=pybind11_mkdoc-2.6.2.dev1-py3-none-any.whl size=9378 sha256=b8feb15bae6058b1dfe3085aef3d28bfb96a33aa4df57c21192383ac86085198
  Stored in directory: /private/var/folders/4z/74x3z8gs7pq77drzss82p5mc0000gq/T/pip-ephem-wheel-cache-89cdsw8p/wheels/57/8e/75/8ef6e06a545a06d229053aff7b0d90101be8b484c73921802b
Successfully built pybind11_mkdoc
Installing collected packages: clang, pybind11_mkdoc
Successfully installed clang-16.0.1.1 pybind11_mkdoc-2.6.2.dev1

Yet I'm getting

python -m pybind11_mkdoc -o python/docstrings.h include/GooseEYE/GooseEYE.h
Processing "include/GooseEYE/GooseEYE.h" ..
Waiting for jobs to finish ..
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/Users/tdegeus/miniforge3/envs/doc/lib/python3.12/site-packages/clang/cindex.py", line 4136, in register_function
    func = getattr(lib, item[0])
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tdegeus/miniforge3/envs/doc/lib/python3.12/ctypes/__init__.py", line 392, in __getattr__
    func = self.__getitem__(name)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tdegeus/miniforge3/envs/doc/lib/python3.12/ctypes/__init__.py", line 397, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: dlsym(0x846d0020, clang_CXXMethod_isCopyAssignmentOperator): symbol not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/tdegeus/miniforge3/envs/doc/lib/python3.12/threading.py", line 1052, in _bootstrap_inner
    self.run()
  File "/Users/tdegeus/miniforge3/envs/doc/lib/python3.12/site-packages/pybind11_mkdoc/mkdoc_lib.py", line 248, in run
    cindex.conf.lib.clang_createIndex(False, True))
    ^^^^^^^^^^^^^^^
  File "/Users/tdegeus/miniforge3/envs/doc/lib/python3.12/site-packages/clang/cindex.py", line 212, in __get__
    value = self.wrapped(instance)
            ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tdegeus/miniforge3/envs/doc/lib/python3.12/site-packages/clang/cindex.py", line 4217, in lib
    register_functions(lib, not Config.compatibility_check)
  File "/Users/tdegeus/miniforge3/envs/doc/lib/python3.12/site-packages/clang/cindex.py", line 4164, in register_functions
    register(f)
  File "/Users/tdegeus/miniforge3/envs/doc/lib/python3.12/site-packages/clang/cindex.py", line 4161, in register
    return register_function(lib, item, ignore_errors)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tdegeus/miniforge3/envs/doc/lib/python3.12/site-packages/clang/cindex.py", line 4142, in register_function
    raise LibclangError(msg)
clang.cindex.LibclangError: dlsym(0x846d0020, clang_CXXMethod_isCopyAssignmentOperator): symbol not found. Please ensure that your python bindings are compatible with your libclang.so version.

Further information:

$ mamba list
# packages in environment at /Users/tdegeus/miniforge3/envs/doc:
#
# Name                    Version                   Build  Channel
bzip2                     1.0.8                h93a5062_5    conda-forge
ca-certificates           2023.11.17           hf0a4a13_0    conda-forge
clang                     16.0.1.1                 pypi_0    pypi
libexpat                  2.5.0                hb7217d7_1    conda-forge
libffi                    3.4.2                h3422bc3_5    conda-forge
libsqlite                 3.44.2               h091b4b1_0    conda-forge
libzlib                   1.2.13               h53f4e23_5    conda-forge
ncurses                   6.4                  h463b476_2    conda-forge
openssl                   3.2.0                h0d3ecfb_1    conda-forge
pip                       23.3.1             pyhd8ed1ab_0    conda-forge
pybind11-mkdoc            2.6.2.dev1               pypi_0    pypi
python                    3.12.0          h47c9636_0_cpython    conda-forge
readline                  8.2                  h92ec313_1    conda-forge
setuptools                68.2.2             pyhd8ed1ab_0    conda-forge
tk                        8.6.13               h5083fa2_1    conda-forge
tzdata                    2023c                h71feb2d_0    conda-forge
wheel                     0.42.0             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h57fd34a_0    conda-forge

$ mamba info

          mamba version : 1.5.3
     active environment : doc
    active env location : /Users/tdegeus/miniforge3/envs/doc
            shell level : 2
       user config file : /Users/tdegeus/.condarc
 populated config files : /Users/tdegeus/miniforge3/.condarc
                          /Users/tdegeus/.condarc
          conda version : 23.10.0
    conda-build version : not installed
         python version : 3.11.6.final.0
       virtual packages : __archspec=1=m1
                          __osx=14.0=0
                          __unix=0=0
       base environment : /Users/tdegeus/miniforge3  (writable)
      conda av data dir : /Users/tdegeus/miniforge3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/osx-arm64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-arm64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/tdegeus/miniforge3/pkgs
                          /Users/tdegeus/.conda/pkgs
       envs directories : /Users/tdegeus/miniforge3/envs
                          /Users/tdegeus/.conda/envs
               platform : osx-arm64
             user-agent : conda/23.10.0 requests/2.31.0 CPython/3.11.6 Darwin/23.0.0 OSX/14.0 solver/libmamba conda-libmamba-solver/23.11.1 libmambapy/1.5.3
                UID:GID : 503:20
             netrc file : None
           offline mode : False

The problem is persistent when I install clang from conda-forge

In addition, the problem is persistent in my CI: https://github.com/tdegeus/GooseEYE/pull/105

I guess that that the issue could be that I'm not installing directly using

python -m pip install git+git://github.com/pybind/pybind11_mkdoc.git@master

However, that command times-out (also on the CI)

tdegeus avatar Dec 13 '23 09:12 tdegeus