xmlsec/python-xmlsec

Failure to build and install with pip

catbyte-io opened this issue · 7 comments

xmlsec fails to build with command pip install xmlsec or pip install python3-saml in virtual environment in codespaces docker container.

Python version: Python 3.12

virtual environment: venv

My distribution version:
VERSION="22.04.3 LTS (Jammy Jellyfish)"

requested versions:
xmlsec 1.3.13
libxmlsec1 1.2.33-1build2
libxml2 2.9.13+dfsg-1ubuntu0.3

pkg-config --cflags xmlsec1 output:

-D__XMLSEC_FUNCTION__=__func__ -DXMLSEC_NO_SIZE_T -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_GOST2012=1 -DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1 -DXMLSEC_CRYPTO_OPENSSL=1 -I/usr/include/xmlsec1 -I/usr/include/libxml2

Error message:

Collecting python3-saml
  Downloading python3_saml-1.16.0-py3-none-any.whl.metadata (1.3 kB)
Collecting lxml!=4.7.0,>=4.6.5 (from python3-saml)
  Downloading lxml-4.9.3-cp312-cp312-manylinux_2_28_x86_64.whl.metadata (3.8 kB)
Collecting isodate>=0.6.1 (from python3-saml)
  Downloading isodate-0.6.1-py2.py3-none-any.whl (41 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.7/41.7 kB 3.4 MB/s eta 0:00:00
Collecting xmlsec>=1.3.9 (from python3-saml)
  Downloading xmlsec-1.3.13.tar.gz (64 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.6/64.6 kB 16.4 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting six (from isodate>=0.6.1->python3-saml)
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Downloading python3_saml-1.16.0-py3-none-any.whl (76 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 76.2/76.2 kB 223.7 MB/s eta 0:00:00
Downloading lxml-4.9.3-cp312-cp312-manylinux_2_28_x86_64.whl (8.0 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.0/8.0 MB 180.3 MB/s eta 0:00:00
Building wheels for collected packages: xmlsec
  Building wheel for xmlsec (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for xmlsec (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [28 lines of output]
      WARNING setuptools_scm.pyproject_reading toml section missing 'pyproject.toml does not contain a tool.setuptools_scm section'
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-312
      creating build/lib.linux-x86_64-cpython-312/xmlsec
      copying src/xmlsec/constants.pyi -> build/lib.linux-x86_64-cpython-312/xmlsec
      copying src/xmlsec/template.pyi -> build/lib.linux-x86_64-cpython-312/xmlsec
      copying src/xmlsec/tree.pyi -> build/lib.linux-x86_64-cpython-312/xmlsec
      copying src/xmlsec/__init__.pyi -> build/lib.linux-x86_64-cpython-312/xmlsec
      copying src/xmlsec/py.typed -> build/lib.linux-x86_64-cpython-312/xmlsec
      warning: build_py: byte-compiling is disabled, skipping.
      
      running build_ext
      building 'xmlsec' extension
      creating build/temp.linux-x86_64-cpython-312
      creating build/temp.linux-x86_64-cpython-312/tmp
      creating build/temp.linux-x86_64-cpython-312/tmp/pip-install-xv3vt6eb
      creating build/temp.linux-x86_64-cpython-312/tmp/pip-install-xv3vt6eb/xmlsec_6c89e061ef61437b88afa49c2c65fd06
      creating build/temp.linux-x86_64-cpython-312/tmp/pip-install-xv3vt6eb/xmlsec_6c89e061ef61437b88afa49c2c65fd06/src
      clang -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -ferror-limit=1 -gdwarf-4 -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-gnu-folding-constant -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-but-set-variable -Wshadow -fPIC -D__XMLSEC_FUNCTION__=__func__ -DXMLSEC_NO_SIZE_T -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_GOST2012=1 -DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1 -DXMLSEC_CRYPTO_OPENSSL=1 -DMODULE_NAME=xmlsec -DMODULE_VERSION=1.3.13 -I/usr/include/xmlsec1 -I/usr/include/libxml2 -I/tmp/pip-build-env-76x9tw6b/overlay/lib/python3.12/site-packages/lxml/includes -I/tmp/pip-build-env-76x9tw6b/overlay/lib/python3.12/site-packages/lxml -I/tmp/pip-build-env-76x9tw6b/overlay/lib/python3.12/site-packages/lxml/includes/libexslt -I/tmp/pip-build-env-76x9tw6b/overlay/lib/python3.12/site-packages/lxml/includes/__pycache__ -I/tmp/pip-build-env-76x9tw6b/overlay/lib/python3.12/site-packages/lxml/includes/libxml -I/tmp/pip-build-env-76x9tw6b/overlay/lib/python3.12/site-packages/lxml/includes/libxslt -I/tmp/pip-build-env-76x9tw6b/overlay/lib/python3.12/site-packages/lxml/includes/extlibs -I/workspaces/github/Catbyte/.venv/include -I/usr/local/include/python3.12 -c /tmp/pip-install-xv3vt6eb/xmlsec_6c89e061ef61437b88afa49c2c65fd06/src/constants.c -o build/temp.linux-x86_64-cpython-312/tmp/pip-install-xv3vt6eb/xmlsec_6c89e061ef61437b88afa49c2c65fd06/src/constants.o -g -std=c99 -fPIC -fno-strict-aliasing -Wno-error=declaration-after-statement -Werror=implicit-function-declaration -Os
      /tmp/pip-install-xv3vt6eb/xmlsec_6c89e061ef61437b88afa49c2c65fd06/src/constants.c:83:10: error: missing field 'get' initializer [-Werror,-Wmissing-field-initializers]
          {NULL} /* Sentinel */
               ^
      fatal error: too many errors emitted, stopping now [-ferror-limit=]
      2 errors generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for xmlsec
Failed to build xmlsec
ERROR: Could not build wheels for xmlsec, which is required to install pyproject.toml-based projects

@catbyte-io any hint here? Did you manage to solve it?

mxamin commented

I guess it's related to #254 which the fix has already been merged. You just have to wait for the next release.
You can also find the workaround solution in the comments if you don't want to wait :)

@gabrielakuhn, The issue was experienced when I was installing to pip in a .venv environment in Codespaces. However, when I spin up my docker containers within the environment, there are no issues. Since I don't have a need to run it in only a .venv environment, the issue can be closed unless anyone wants to investigate further. Thank you everyone.

@mxamin any estimated time of arrival for the next release? An rough estimate would be very helpful. Thanks

mxamin commented

@mxamin any estimated time of arrival for the next release? An rough estimate would be very helpful. Thanks

I don't have an ETA. You can follow #284 for the upcoming release.

mxamin commented

Apparantly the new release is not fully compatible with old xmlsec1 versions (1.2.x). We already have a issue to handle it probably in the next release (#314), so I'm closing this one