pycares icon indicating copy to clipboard operation
pycares copied to clipboard

Compiling v5.0.0 fails

Open MichaIng opened this issue 1 week ago • 6 comments

The configure step (done within a pip install) fails with:

2025-12-11T01:24:09,621   -- Looking for pthread_init - not found
2025-12-11T01:24:09,635   CMake Error at CMakeLists.txt:747 (ADD_SUBDIRECTORY):
2025-12-11T01:24:09,636     ADD_SUBDIRECTORY given source "docs" which is not an existing directory.


2025-12-11T01:24:09,706   -- Configuring incomplete, errors occurred!
...
      subprocess.CalledProcessError: Command '['/usr/bin/cmake', '/tmp/pip-install-vhmddl_r/pycares_ad42dd5ca86a4eb6985bf8051722afcc/deps/c-ares', '-DCARES_STATIC=ON', '-DCARES_SHARED=OFF', '-DCARES_BUILD_TOOLS=OFF', '-DCARES_BUILD_TESTS=OFF', '-DCARES_INSTALL=ON', '-DCARES_THREADS=ON', '-DCARES_STATIC_PIC=ON', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_CONFIGURATION_TYPES=Release', '-DCMAKE_INSTALL_PREFIX=/tmp/pip-install-vhmddl_r/pycares_ad42dd5ca86a4eb6985bf8051722afcc/build/temp.linux-aarch64-cpython-313/c-ares-install']' returned non-zero exit status 1.

I wasn't sure whether we did something wrong, but piwheels.org builds fails the same way, with Python 3.9, 3.11, and 3.13: https://piwheels.org/project/pycares/

We see this on ARMv6 and ARMv7 systems at least, on Debian Bookworm, Trixie, and Forky/testing.

Digging deeper into it, it is coming from c-ares: https://github.com/c-ares/c-ares/blob/3ac47ee/CMakeLists.txt#L747

The error message is confusing, since the docs dir exists at this commit of the repo. Maybe the context in which it is called is somehow the culprit, but it does not choke on adding src and include 🤔. You builds seem to have succeeded with the same commit, maybe you stumbled over this as well but know a solution?

MichaIng avatar Dec 18 '25 16:12 MichaIng

First time I see this error 🤯

saghul avatar Dec 18 '25 21:12 saghul

I'm having the same issue on FreeBSD 14/amd64

      -- Found Threads: TRUE
      -- Looking for include file pthread.h
      -- Looking for include file pthread.h - found
      -- Looking for include file pthread_np.h
      -- Looking for include file pthread_np.h - found
      -- Looking for pthread_init
      -- Looking for pthread_init - not found
      CMake Error at CMakeLists.txt:747 (ADD_SUBDIRECTORY):
        ADD_SUBDIRECTORY given source "docs" which is not an existing directory.


      -- Configuring incomplete, errors occurred!
      Configuring c-ares with CMake in /tmp/pip-install-xiju6stt/pycares_5c34827889a2411790812dd86e49bafb/build/temp.freebsd-14.3-RELEASE-p5-amd64-cpython-313/c-ares-build
      Traceback (most recent call last):

[...]

        File "/usr/local/lib/python3.13/subprocess.py", line 419, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/usr/local/bin/cmake', '/tmp/pip-install-xiju6stt/pycares_5c34827889a2411790812dd86e49bafb/deps/c-ares', '-DCARES_STATIC=ON', '-DCARES_SHARED=OFF', '-DCARES_BUILD_TOOLS=OFF', '-DCARES_BUILD_TESTS=OFF', '-DCARES_INSTALL=ON', '-DCARES_THREADS=ON', '-DCARES_STATIC_PIC=ON', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_CONFIGURATION_TYPES=Release', '-DCMAKE_INSTALL_PREFIX=/tmp/pip-install-xiju6stt/pycares_5c34827889a2411790812dd86e49bafb/build/temp.freebsd-14.3-RELEASE-p5-amd64-cpython-313/c-ares-install']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pycares


jan666 avatar Dec 19 '25 06:12 jan666

Found the reason: https://pypi.org/project/pycares/#files The pycares-5.0.0.tar.gz deps/c-ares subdir does not contain docs indeed, even that it is part of the repo. Maybe some cleanup step removes it, assuming it was not needed for compiling.

EDIT: Or things are handled differently when using pyproject.toml, I see you migrated recently. One can define dirs included into sdist archives explicitly, but not sure whether there is some magic happening if not defined like in your case.

EDIT2: I mixed it up with the py_build_cmake where we are used to define sdist includes/excludes in a [tool.py-build-cmake.sdist] section. But plain setuptools does not seem to have such dedicated section 🤔.

MichaIng avatar Dec 19 '25 11:12 MichaIng

Good find! I'll take a look.

saghul avatar Dec 19 '25 11:12 saghul

I think after the migration to pyproject.toml, python setup.py sdist does not work anymore the same as before. Maybe switch to

    - run: python -m pip install build
    - run: python -m build --sdist

If should also put the archive to dist/, hence the upload action should work like before.

MichaIng avatar Dec 19 '25 12:12 MichaIng

Same error on python3.11@FreeBSD14/stable and python3.13@FreeBSD15/stable. It looks like deps/c-ares/docs is removed! It is a part of c-ares dist, not pycares.

rozhuk-im avatar Dec 21 '25 02:12 rozhuk-im