saltstack / gdbdbg

Debug a running salt process
Apache License 2.0
3 stars 1 forks source link

How to install it? #1

Open max-arnold opened 10 months ago

max-arnold commented 10 months ago

Trying to install the tool (Ubuntu 22.04, Salt 3006.5 onedir installed via salt-bootstrap.sh):

apt install gdb salt-dbg
salt-pip install git+https://github.com/saltstack/relenv-gdb-debug

Collecting git+https://github.com/saltstack/relenv-gdb-debug
  Cloning https://github.com/saltstack/relenv-gdb-debug to /tmp/pip-req-build-kvu8t_rc
  Running command git clone --filter=blob:none --quiet https://github.com/saltstack/relenv-gdb-debug /tmp/pip-req-build-kvu8t_rc
  Resolved https://github.com/saltstack/relenv-gdb-debug to commit e589e4547c88771c1bcc888665864fb96eb4fb55
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: relenv-gdb
  Building wheel for relenv-gdb (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for relenv-gdb (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      Traceback (most recent call last):
        File "/opt/saltstack/salt/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
          main()
        File "/opt/saltstack/salt/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/opt/saltstack/salt/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 249, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/tmp/pip-req-build-kvu8t_rc/src/relenv_gdb/build.py", line 130, in build_wheel
          relenv.create.create(str(relenvdir))
        File "/tmp/pip-build-env-bxxu4sos/overlay/lib/python3.10/site-packages/relenv/create.py", line 120, in create
          raise CreateException(
      relenv.create.CreateException: Error, build archive for x86_64 doesn't exist: /root/.local/relenv/build/3.10.13-x86_64-linux-gnu.tar.xz
      You might try relenv fetch to resolve this.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for relenv-gdb
Failed to build relenv-gdb
ERROR: Could not build wheels for relenv-gdb, which is required to install pyproject.toml-based projects

[notice] A new release of pip available: 22.3.1 -> 23.3.2
[notice] To update, run: /opt/saltstack/salt/bin/python3.10 -m pip install --upgrade pip
/opt/saltstack/salt/bin/relenv fetch

Downloading https://repo.saltproject.io/relenv/0.14.2/build/3.10.13-x86_64-linux-gnu.tar.xz -> /root/.local/relenv/build/3.10.13-x86_64-linux-gnu.tar.xz
salt-pip install git+https://github.com/saltstack/relenv-gdb-debug

Collecting git+https://github.com/saltstack/relenv-gdb-debug
  Cloning https://github.com/saltstack/relenv-gdb-debug to /tmp/pip-req-build-rfnbdkdf
  Running command git clone --filter=blob:none --quiet https://github.com/saltstack/relenv-gdb-debug /tmp/pip-req-build-rfnbdkdf
  Resolved https://github.com/saltstack/relenv-gdb-debug to commit e589e4547c88771c1bcc888665864fb96eb4fb55
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: relenv-gdb
  Building wheel for relenv-gdb (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for relenv-gdb (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      Traceback (most recent call last):
        File "/opt/saltstack/salt/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
          main()
        File "/opt/saltstack/salt/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/opt/saltstack/salt/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 249, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/tmp/pip-req-build-rfnbdkdf/src/relenv_gdb/build.py", line 131, in build_wheel
          build_gdb(relenvdir)
        File "/tmp/pip-req-build-rfnbdkdf/src/relenv_gdb/build.py", line 41, in build_gdb
          relenv.common.download_url(
      AttributeError: module 'relenv' has no attribute 'common'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for relenv-gdb
Failed to build relenv-gdb
ERROR: Could not build wheels for relenv-gdb, which is required to install pyproject.toml-based projects

[notice] A new release of pip available: 22.3.1 -> 23.3.2
[notice] To update, run: /opt/saltstack/salt/bin/python3.10 -m pip install --upgrade pip
dwoz commented 10 months ago

Looks like you need to do a relenv fetch before the build will work. The intent here is to publish wheels but I have not had time to finish the release pipelines for this repository.

max-arnold commented 10 months ago

I did the relenv fetch (see the above log), but the install fails with module 'relenv' has no attribute 'common'

madhura22-code commented 10 months ago

Check if relenv-gdb has any specific dependencies you need to install.

thinkst-marco commented 5 months ago

To get this installed and working on Ubuntu 22.04 & Salt 3006, I needed to:

  1. $ apt install patchelf m4
  2. Apply the patch in https://gist.github.com/thinkst-marco/89c35c85d7246b1b42e1e58069295569

The patch hacks around broken imports with local imports. It also uses the main branch of saltstack/relative-environment-for-python, since the buildenv branch wants to pull in Python 3.10.12 which 3006.8 doesn't use. Finally, it make a super ugly patch against gdb's python-config.py script, which leaves out a linker flag for readline for some reason. The upshot is a working relenv-dbg on 22.04 for Salt 3006.8.

dmurphy18 commented 5 months ago

@max-arnold FYI just found using the gh tool on Ubuntu 22.04 to be lacking, it's version is 2.4, while on 24.04 it is 2.45.0, a lot of minor revisions, found on 22.04 that gh auth token didn't work correctly, unlike in 24.04.

Wonder what other tools fail to function correctly on 22.04, just a heads up.

dwoz commented 2 months ago

Wheels are now uploaded to pypi. See https://pypi.org/project/gdbdbg/