错误:命令“/usr/bin/arm-linux-gnueabihf-gcc”失败,退出代码为 1

错误:命令“/usr/bin/arm-linux-gnueabihf-gcc”失败,退出代码为 1

我想在树莓派操作系统(bullseye)上安装 pycodec2 模块。我的目标是能够使用 Python 中的 Codec2 库。我尝试了命令(sudo apt install codec2),然后是(pip install pycodec2)。我尝试使用(python setup.py install)从源代码构建它,但在这两种情况下它都返回了此错误。

Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pycodec2
  Using cached pycodec2-2.1.0.tar.gz (62 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pycodec2
  Building wheel for pycodec2 (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pycodec2 (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [33 lines of output]
      running bdist_wheel
      running build
      running build_py
      running build_ext
      building 'pycodec2' extension
      creating build
      creating build/temp.linux-armv7l-cpython-39
      creating build/temp.linux-armv7l-cpython-39/pycodec2
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DNPY_NO_DEPRECATED_API=NPY_1_23_API_VERSION -I/tmp/pip-build-env-mwt03on3/overlay/lib/python3.9/site-packages/numpy/core/include -I/usr/include/python3.9 -c pycodec2/pycodec2.c -o build/temp.linux-armv7l-cpython-39/pycodec2/pycodec2.o
      pycodec2/pycodec2.c: In function ‘__pyx_pf_8pycodec2_6Codec2_14bytes_per_frame’:
      pycodec2/pycodec2.c:3379:36: warning: implicit declaration of function ‘codec2_bytes_per_frame’; did you mean ‘codec2_bits_per_frame’? [-Wimplicit-function-declaration]
       3379 |   __pyx_t_1 = __Pyx_PyInt_From_int(codec2_bytes_per_frame(__pyx_v_self->_c_codec2_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error)
            |                                    ^~~~~~~~~~~~~~~~~~~~~~
            |                                    codec2_bits_per_frame
      pycodec2/pycodec2.c: In function ‘__pyx_pf_8pycodec2_6Codec2_20rebuild_spare_bit’:
      pycodec2/pycodec2.c:3647:93: warning: passing argument 2 of ‘codec2_rebuild_spare_bit’ from incompatible pointer type [-Wincompatible-pointer-types]
       3647 |   __pyx_t_1 = __Pyx_PyInt_From_int(codec2_rebuild_spare_bit(__pyx_v_self->_c_codec2_state, ((char *)PyArray_DATA(((PyArrayObject *)__pyx_v_unpacked_bits))))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
            |                                                                                            ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            |                                                                                             |
            |                                                                                             char *
      In file included from pycodec2/pycodec2.c:776:
      /usr/include/codec2/codec2.h:110:64: note: expected ‘int *’ but argument is of type ‘char *’
        110 | int  codec2_rebuild_spare_bit(struct CODEC2 *codec2_state, int unpacked_bits[]);
            |                                                            ~~~~^~~~~~~~~~~~~~~
      pycodec2/pycodec2.c: In function ‘__pyx_pf_8pycodec2_6Codec2_28open_mlfeat’:
      pycodec2/pycodec2.c:3995:3: error: too many arguments to function ‘codec2_open_mlfeat’
       3995 |   codec2_open_mlfeat(__pyx_v_self->_c_codec2_state, __pyx_t_1, __pyx_t_2);
            |   ^~~~~~~~~~~~~~~~~~
      In file included from pycodec2/pycodec2.c:776:
      /usr/include/codec2/codec2.h:116:6: note: declared here
        116 | void codec2_open_mlfeat(struct CODEC2 *codec2_state, char *filename);
            |      ^~~~~~~~~~~~~~~~~~
      error: command '/usr/bin/arm-linux-gnueabihf-gcc' 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 pycodec2
Failed to build pycodec2
ERROR: Could not build wheels for pycodec2, which is required to install pyproject.toml-based projects


答案1

原来是兼容性问题使用编解码器2版本。命令(pip 安装 pycodec2-old)解决了问题。

相关内容