arm-none-eabi-gdbが起動しないとき

# 環境
| 項目 | 内容 |
|-|-|
|OS | fedora39 |
| toolchain | Arm GNU Toolchain 13.2.rel1 |

# やりたいこと
```
$ arm-none-eabi-gdb --version
```

<details>
<summary>こんなエラーが表示される</summary>

```
tyano@dell3020 ~$ arm-none-eabi-gdb --version
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/usr/local/bld-tools/bld-tools-virtual-env/bin/python'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/usr/local/bld-tools/bld-tools-virtual-env/bin/python'
  sys.base_prefix = '/usr'
  sys.base_exec_prefix = '/usr'
  sys.executable = '/usr/local/bld-tools/bld-tools-virtual-env/bin/python'
  sys.prefix = '/usr'
  sys.exec_prefix = '/usr'
  sys.path = [
    '/usr/lib/python38.zip',
    '/usr/lib/python3.8',
    '/usr/lib/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f6af1c57c00 (most recent call first):
<no Python frame>

```

</details>


# pyenvをインストールして回避を試みる
```shell
curl https://pyenv.run | bash

pyenv install --list

pyenv install 3.8.19
```

インストールに失敗する。

<details>
<summary>こんなエラーが出る</summary>

```
BUILD FAILED (Fedora Linux 39 using python-build 20180424)

Inspect or clean up the working tree at /tmp/python-build.20240528102739.9938
Results logged to /tmp/python-build.20240528102739.9938.log

Last 10 log lines:
  File "/tmp/python-build.20240528102739.9938/Python-3.8.19/Lib/ensurepip/__init__.py", line 209, in _main
    return _bootstrap(
  File "/tmp/python-build.20240528102739.9938/Python-3.8.19/Lib/ensurepip/__init__.py", line 128, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/tmp/python-build.20240528102739.9938/Python-3.8.19/Lib/ensurepip/__init__.py", line 37, in _run_pip
    return subprocess.run(cmd, check=True).returncode
  File "/tmp/python-build.20240528102739.9938/Python-3.8.19/Lib/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/tmp/python-build.20240528102739.9938/Python-3.8.19/python', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmp0bh24s9r/setuptools-56.0.0-py3-none-any.whl\', \'/tmp/tmp0bh24s9r/pip-23.0.1-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmp0bh24s9r\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
make: *** [Makefile:1198: install] Error 1

```

</details>

## 先にpythonをインストールするためのライブラリをインストール

```
sudo yum install zlib-devel ncurses-devel openssl-devel readline-devel libffi-devel bzip2-devel xz-devel sqlite-devel tk-devel
```

## 再度チャレンジ
```
pyenv install 3.8.19
```

今度は成功
```
Installed Python-3.8.19 to /home/tyano/.pyenv/versions/3.8.19
```
3.8系に変更
```
pyenv local 3.8.19
```
```
$ pyenv versions
  system
* 3.8.19 (set by /home/tyano/.python-version)
```


# 環境変数を設定して再チャレンジ
```
export PYTHONHOME=/home/tyano/.pyenv/versions/3.8.19/
```
起動した
```
arm-none-eabi-gdb --version
GNU gdb (Arm GNU Toolchain 13.2.rel1 (Build arm-13.7)) 13.2.90.20231008-git
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
```

# 参考
- https://stackoverflow.com/questions/72187185/arm-none-eabi-gdb-cannot-start-because-of-some-python-error  
- https://qiita.com/ysd_marrrr/items/472162288b9c131f5427