cmusphinx/pocketsphinx

Cannot build manylinux wheels

Crozzers opened this issue · 4 comments

Using the PyPA manylinux docker images, I am unable to build the wheels for this package. Running the command python3.10 -m pip wheel . generates the following error:

running bdist_wheel
running build
running build_ext

==> Configuring:
$ cmake -S /pocketsphinx-build/pocketsphinx -B /pocketsphinx-build/pocketsphinx/build/temp.linux-x86_64-cpython-310_pocketsphinx5 -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/pocketsphinx-build/pocketsphinx/build/lib.linux-x86_64-cpython-310/pocketsphinx5 -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja -DPython3_ROOT_DIR=/opt/_internal/cpython-3.10.5 -DCALL_FROM_SETUP_PY:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF

==> Building:
$ cmake --build /pocketsphinx-build/pocketsphinx/build/temp.linux-x86_64-cpython-310_pocketsphinx5 --config Release

==> Installing:
$ cmake --install /pocketsphinx-build/pocketsphinx/build/temp.linux-x86_64-cpython-310_pocketsphinx5

-- SIZEOF_LONG="8" ; SIZEOF_LONG_LONG="8"
-- WORDS_BIGENDIAN="0"
-- SPHINX_DEBUG="" ; DEBUG_ENDIAN=""
-- FIXED_POINT="OFF" ; DEFAULT_RADIX="12"
-- Could NOT find Python3 (missing: Python3_INCLUDE_DIRS Python3_LIBRARIES Development Development.Module Development.Embed) (found version "3.11.0")
-- Configuring done
CMake Error at /opt/_internal/pipx/venvs/cmake/lib/python3.9/site-packages/cmake/data/share/cmake-3.22/Modules/UseSWIG.cmake:905 (add_library):
  Target "bindings" links to target "Python3::Python" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  swig/python/CMakeLists.txt:16 (swig_add_library)


-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

I have tried adding arguments to the cmake_configure_options in setup.py like:

-DPython3_EXECUTABLE=/opt/python/cp310-cp310/bin/python
-DPython3_INCLUDE_DIRS=/opt/python/cp310-cp310/include
-DPython3_LIBRARIES=/opt/python/cp310-cp310/lib

But none of these had any effect.
Here are the commands I ran in the latest x86_64 manylinux docker container:

mkdir pocketsphinx-build && cd pocketsphinx-build
git clone https://github.com/cmusphinx/pocketsphinx && cd pocketsphinx
apt update && apt install swig autoconf automake make pulseaudio tk libasound2-dev libpulse-dev python3-dev python-dev ninja-build -y
python3.10 -m pip install -r requirements.dev.txt
python3.10 -m pip wheel .

I think this is a problem with the manylinux Docker images, actually. I can't seem to find a solution to it, I reported a bug there:

pypa/manylinux#1347

The build system has changed completely so this is understandable- there is no more automake, etc. Instead we just build with pip.

I was just including all of the old dependencies just in case :)

I think this is a problem with the manylinux Docker images, actually. I can't seem to find a solution to it, I reported a bug there:

pypa/manylinux#1347

In this issue, the respondent says:

You shall not depend on Development / Python3::Python when building an extension module.
Instead, you should use Development.Module / Python3::Module

And following these steps worked for me! I was able to build manylinux wheels for Python 3.6-3.11. I've submitted a PR with the changes that made this possible

fixed in 40945b9