canonical / charmcraft

Collaborate, build and publish charmed operators for Kubernetes, Linux and Windows.
Apache License 2.0
65 stars 69 forks source link

Build failing due to rpds-py dependency #1722

Closed phvalguima closed 2 months ago

phvalguima commented 2 months ago

Bug Description

I have a build that was working a couple of days ago but now is failing with:

2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.557 ::    ::   × Building wheel for rpds-py (pyproject.toml) did not run successfully.
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.557 ::    ::   │ exit code: 1
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.557 ::    ::   ╰─> [13 lines of output]
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.557 ::    ::       Running `maturin pep517 build-wheel -i /root/parts/charm/build/staging-venv/bin/python3 --compatibility off`
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.557 ::    ::       📦 Including license file "/tmp/pip-install-jdyyzdzu/rpds-py_efffa35cc1d6461e81faeb438a938b26/LICENSE"
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.557 ::    ::       🔗 Found pyo3 bindings
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.557 ::    ::       🐍 Found CPython 3.10 at /root/parts/charm/build/staging-venv/bin/python3
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.557 ::    ::       📡 Using build options features from pyproject.toml
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.557 ::    ::       error: package `triomphe v0.1.13` cannot be built because it requires rustc 1.76 or newer, while the currently active rustc version is 1.75.0
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.557 ::    ::       Either upgrade to rustc 1.76 or newer, or use
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.558 ::    ::       cargo update triomphe@0.1.13 --precise ver
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.558 ::    ::       where `ver` is the latest version of `triomphe` supporting rustc 1.75.0
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.558 ::    ::       💥 maturin failed
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.558 ::    ::         Caused by: Failed to build a native library through cargo
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.558 ::    ::         Caused by: Cargo build finished with "exit status: 101": `env -u CARGO PYO3_ENVIRONMENT_SIGNATURE="cpython-3.10-64bit" PYO3_PYTHON="/root/parts/charm/build/staging-venv/bin/python3" PYTHON_SYS_EXECUTABLE="/root/parts/charm/build/staging-venv/bin/python3" "cargo" "rustc" "--features" "pyo3/extension-module" "--message-format" "json-render-diagnostics" "--manifest-path" "/tmp/pip-install-jdyyzdzu/rpds-py_efffa35cc1d6461e81faeb438a938b26/Cargo.toml" "--release" "--lib"`
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.558 ::    ::       Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/root/parts/charm/build/staging-venv/bin/python3', '--compatibility', 'off'] returned non-zero exit status 1
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.558 ::    ::       [end of output]
2024-07-09 07:32:33.069 :: 2024-07-09 07:32:32.558 ::    ::

Full logs: https://pastebin.canonical.com/p/HTshpkPmgJ/

Currently seeing this happening on PR: https://github.com/canonical/opensearch-dashboards-operator/pull/88

To Reproduce

First, install:

pip3 install charmcraftcache
sudo snap install charmcraft --classic

Pull the PR above and run:

tox -e build-production

Environment

build on 24.04 and 22.04

Env.: using 22.04 and core22

charmcraft.yaml

# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

type: charm
parts:
  charm:
    override-pull: |
      craftctl default
      if [[ ! -f requirements.txt ]]
      then
          echo 'ERROR: Use "tox run -e build-dev" instead of calling "charmcraft pack" directly' >&2
          exit 1
      fi
    charm-strict-dependencies: true
    charm-entrypoint: src/charm.py
    build-packages:
      - pkg-config
      - libffi-dev
      - libssl-dev
      - rustc
      - cargo
bases:
  - build-on:
      - name: "ubuntu"
        channel: "22.04"
    run-on:
      - name: "ubuntu"
        channel: "22.04"

Relevant log output

Check the main bug description
carlcsaposs-canonical commented 2 months ago

also seeing this with rpds-py 0.19.0

don't think this is a charmcraft issue (other than its cause is likely from building wheels from souce)

phvalguima commented 2 months ago

yes, thanks @carlcsaposs-canonical

Sorry for the noise charmcraft team. I thought this was a requirement from charmcraft itself but after looking into my poetry.lock, I can see the rpds-py comes from there instead.

ca-scribner commented 1 month ago

To clarify for anyone coming to this later, rustc available via apt at time of posting is 1.75, which is why charmcraft pack hits into this limitation. Once 1.76 is available via apt, this issue goes away

carlcsaposs-canonical commented 1 month ago

for anyone encountering this, you can also use this now https://github.com/canonical/opensearch-operator/blob/c3f2773a1bb115a302b728cf5d9b7392c14c9ee6/charmcraft.yaml#L29-L34 https://github.com/canonical/opensearch-operator/blob/c3f2773a1bb115a302b728cf5d9b7392c14c9ee6/charmcraft.yaml#L21-L23