Brightcells / screen

Console/Screen/Terminal width and so on
https://pypi.python.org/pypi/screen
0 stars 1 forks source link

gcc failed with exit code 1 during pip install #1

Open MrClon opened 3 months ago

MrClon commented 3 months ago

Arch linux, python 3.12, gcc 14.1.1. When i trying to install screen by pip this error occurs

$ python -m venv ./delme
$ ./delme/bin/pip install screen
Collecting screen
  Using cached screen-1.0.1.tar.gz (8.6 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: screen
  Building wheel for screen (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for screen (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [32 lines of output]
      running bdist_wheel
      The [wheel] section is deprecated. Use [bdist_wheel] instead.
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-312
      creating build/lib.linux-x86_64-cpython-312/screen
      copying screen/__init__.py -> build/lib.linux-x86_64-cpython-312/screen
      copying screen/compat.py -> build/lib.linux-x86_64-cpython-312/screen
      copying screen/old_str_util.py -> build/lib.linux-x86_64-cpython-312/screen
      running build_ext
      building 'screen.str_util' extension
      creating build/temp.linux-x86_64-cpython-312
      creating build/temp.linux-x86_64-cpython-312/source
      gcc -fno-strict-overflow -DNDEBUG -g -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -ffat-lto-objects -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -fPIC -I/mnt/ssd-trash/delme/include -I/usr/include/python3.12 -c source/str_util.c -o build/temp.linux-x86_64-cpython-312/source/str_util.o
      source/str_util.c: In function ‘Py_IsWideChar’:
      source/str_util.c:484:16: error: implicit declaration of function ‘PyUnicode_AS_UNICODE’; did you mean ‘PyUnicode_AsUCS4’? [-Wimplicit-function-declaration]
        484 |         ustr = PyUnicode_AS_UNICODE(text);
            |                ^~~~~~~~~~~~~~~~~~~~
            |                PyUnicode_AsUCS4
      source/str_util.c:484:14: error: assignment to ‘Py_UNICODE *’ {aka ‘int *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
        484 |         ustr = PyUnicode_AS_UNICODE(text);
            |              ^
      source/str_util.c: In function ‘Py_CalcWidth’:
      source/str_util.c:663:14: error: assignment to ‘Py_UNICODE *’ {aka ‘int *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
        663 |         ustr = PyUnicode_AS_UNICODE(text);
            |              ^
      source/str_util.c: In function ‘Py_CalcTextPos’:
      source/str_util.c:755:14: error: assignment to ‘Py_UNICODE *’ {aka ‘int *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
        755 |         ustr = PyUnicode_AS_UNICODE(text);
            |              ^
      error: command '/usr/bin/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 screen
Failed to build screen
ERROR: Could not build wheels for screen, which is required to install pyproject.toml-based projects
$ python -V
Python 3.12.3
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.1.1 20240507 (GCC) 
gdespirito commented 3 months ago

Same here in mac os 14.5 (Sonoma) using python 3.12 and poetry 1.8.3

poetry install
Installing dependencies from lock file

Package operations: 63 installs, 0 updates, 0 removals

  - Installing screen (1.0.1): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel

  running bdist_wheel
  The [wheel] section is deprecated. Use [bdist_wheel] instead.
  running build
  running build_py
  creating build
  creating build/lib.macosx-14.0-arm64-cpython-312
  creating build/lib.macosx-14.0-arm64-cpython-312/screen
  copying screen/old_str_util.py -> build/lib.macosx-14.0-arm64-cpython-312/screen
  copying screen/compat.py -> build/lib.macosx-14.0-arm64-cpython-312/screen
  copying screen/__init__.py -> build/lib.macosx-14.0-arm64-cpython-312/screen
  running build_ext
  building 'screen.str_util' extension
  creating build/temp.macosx-14.0-arm64-cpython-312
  creating build/temp.macosx-14.0-arm64-cpython-312/source
  clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -I/private/var/folders/xt/1kj60tqd4p38zv53gvkt0q040000gn/T/tmpm0z43jrf/.venv/include -I/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c source/str_util.c -o build/temp.macosx-14.0-arm64-cpython-312/source/str_util.o
  source/str_util.c:484:16: error: call to undeclared function 'PyUnicode_AS_UNICODE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
          ustr = PyUnicode_AS_UNICODE(text);
                 ^
  source/str_util.c:484:14: error: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
          ustr = PyUnicode_AS_UNICODE(text);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
  source/str_util.c:663:16: error: call to undeclared function 'PyUnicode_AS_UNICODE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
          ustr = PyUnicode_AS_UNICODE(text);
                 ^
  source/str_util.c:663:14: error: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
          ustr = PyUnicode_AS_UNICODE(text);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
  source/str_util.c:755:16: error: call to undeclared function 'PyUnicode_AS_UNICODE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
          ustr = PyUnicode_AS_UNICODE(text);
                 ^
  source/str_util.c:755:14: error: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
          ustr = PyUnicode_AS_UNICODE(text);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
  6 errors generated.
  error: command '/usr/bin/clang' failed with exit code 1

  at /opt/homebrew/Cellar/poetry/1.8.3/libexec/lib/python3.12/site-packages/poetry/installation/chef.py:164 in _prepare
      160│
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│
      163│             if error is not None:
    → 164│                 raise error from None
      165│
      166│             return path
      167│
      168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with screen (1.0.1) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "screen (==1.0.1)"'.
mdayaram commented 3 months ago

I am also getting the same issue, using python 3.12.3.

It seems that the function PyUnicode_AS_UNICODE was removed in Python 3.12 as per notes here: https://peps.python.org/pep-0623/#python-3-12

julesterrien commented 3 weeks ago

Curious if you have found a fix for this? 🙏

MrClon commented 3 weeks ago

Nope