marcelotduarte / cx_Freeze

cx_Freeze creates standalone executables from Python scripts, with the same performance, is cross-platform and should work on any platform that Python itself works on.
https://marcelotduarte.github.io/cx_Freeze/
Other
1.33k stars 217 forks source link

Build failure due to implicit-function-declaration and int-conversion #2568

Open mattiaverga opened 2 weeks ago

mattiaverga commented 2 weeks ago

Describe the bug Trying to build cx_Freeze on Fedora Linux Rawhide results in several errors:

  gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -O3 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fPIC -I/usr/include/python3.13 -c source/bases/console.c -o build/temp.linux-x86_64-cpython-313/source/bases/console.o
  In file included from source/bases/console.c:43:
  source/bases/common.c: In function ‘InitializePython’:
  source/bases/common.c:289:5: warning: ‘Py_NoSiteFlag’ is deprecated [-Wdeprecated-declarations]
    289 |     Py_NoSiteFlag = 1;
        |     ^~~~~~~~~~~~~
  In file included from /usr/include/python3.13/Python.h:72,
                   from source/bases/console.c:7:
  /usr/include/python3.13/cpython/pydebug.h:14:37: note: declared here
     14 | Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_NoSiteFlag;
        |                                     ^~~~~~~~~~~~~
  source/bases/common.c:290:5: warning: ‘Py_FrozenFlag’ is deprecated [-Wdeprecated-declarations]
    290 |     Py_FrozenFlag = 1;
        |     ^~~~~~~~~~~~~
  /usr/include/python3.13/cpython/pydebug.h:16:37: note: declared here
     16 | Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_FrozenFlag;
        |                                     ^~~~~~~~~~~~~
  source/bases/common.c:291:5: warning: ‘Py_IgnoreEnvironmentFlag’ is deprecated [-Wdeprecated-declarations]
    291 |     Py_IgnoreEnvironmentFlag = 1;
        |     ^~~~~~~~~~~~~~~~~~~~~~~~
  /usr/include/python3.13/cpython/pydebug.h:17:37: note: declared here
     17 | Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_IgnoreEnvironmentFlag;
        |                                     ^~~~~~~~~~~~~~~~~~~~~~~~
  source/bases/common.c:292:5: warning: ‘Py_SetProgramName’ is deprecated [-Wdeprecated-declarations]
    292 |     Py_SetProgramName(wexecutable);
        |     ^~~~~~~~~~~~~~~~~
  In file included from /usr/include/python3.13/Python.h:119:
  /usr/include/python3.13/pylifecycle.h:37:38: note: declared here
     37 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *);
        |                                      ^~~~~~~~~~~~~~~~~
  source/bases/common.c:293:5: error: implicit declaration of function ‘Py_SetPath’; did you mean ‘Py_GetPath’? [-Wimplicit-function-declaration]
    293 |     Py_SetPath(wpath);
        |     ^~~~~~~~~~
        |     Py_GetPath
  source/bases/common.c:295:5: warning: ‘PySys_SetArgvEx’ is deprecated [-Wdeprecated-declarations]
    295 |     PySys_SetArgvEx(argc, argv, 0);
        |     ^~~~~~~~~~~~~~~
  In file included from /usr/include/python3.13/Python.h:121:
  /usr/include/python3.13/sysmodule.h:11:38: note: declared here
     11 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetArgvEx(int, wchar_t **, int);
        |                                      ^~~~~~~~~~~~~~~
  source/bases/console.c: In function ‘main’:
  source/bases/console.c:75:14: error: implicit declaration of function ‘_PyMem_RawStrdup’; did you mean ‘PyMem_RawFree’? [-Wimplicit-function-declaration]
     75 |     oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL));
        |              ^~~~~~~~~~~~~~~~
        |              PyMem_RawFree
  source/bases/console.c:75:12: error: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
     75 |     oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL));
        |            ^
  error: command '/usr/bin/gcc' failed with exit code 1
  error: subprocess-exited-with-error

  × Building wheel for cx_Freeze (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /usr/bin/python3 /usr/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /builddir/build/BUILD/cx_freeze-7.2.1-build/cx_Freeze-7.2.1/.pyproject-builddir/tmp37lgia8a
  cwd: /builddir/build/BUILD/cx_freeze-7.2.1-build/cx_Freeze-7.2.1
  Building wheel for cx_Freeze (pyproject.toml): finished with status 'error'
  ERROR: Failed building wheel for cx_Freeze
Failed to build cx_Freeze
ERROR: Failed to build one or more wheels

Desktop (please complete the following information):

Additional context -Wimplicit-function-declaration and -Wint-conversion are threated as errors in default Fedora compiler flags.

marcelotduarte commented 2 weeks ago

Support for Python 3.13 in the next minor release (7.3.0). You can test it: pip install git+https://github.com/marcelotduarte/cx_Freeze.git@develop