zeromq / pyzmq

PyZMQ: Python bindings for zeromq
http://zguide.zeromq.org/py:all
BSD 3-Clause "New" or "Revised" License
3.62k stars 635 forks source link

BUG: Build failure with PyPy3.10 and GCC 14, due to `error: initialization of ‘void **’ from incompatible pointer type ‘mutex_t **’` #1988

Closed mgorny closed 1 month ago

mgorny commented 2 months ago

This is a pyzmq bug

What pyzmq version?

b771427b54bdc5df431c3f1875fe5453afc0f6f5

What libzmq version?

n/a

Python version (and how it was installed)

PyPy 3.10 7.3.16; Gentoo package

OS

Gentoo Linux amd64

What happened?

When building with GCC 14 and PyPy3.10, the CFFI sources fail to build with an error:

* Building wheel...
*** scikit-build-core 0.9.3 using CMake 3.29.3 (wheel)
*** Configuring CMake...
2024-05-09 16:38:37,410 - scikit_build_core - WARNING - Can't find a Python library, got libdir=/usr/bin, ldlibrary=libpypy3.9-c.so, multiarch=x86_64-linux-gnu, masd=None
loading initial cache file /tmp/tmp8_vvg8mg/build/CMakeInit.txt
-- The C compiler identification is GNU 13.2.1
-- The CXX compiler identification is GNU 13.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python: /tmp/build-env-socmms5_/bin/python (found version "3.10.14") found components: Interpreter Development.Module
-- Looking for libzmq
-- Looking for libzmq with pkg-config
-- Checking for module 'libzmq'
--   Found libzmq, version 4.3.5
-- Looking for libzmq with pkg-config - found: -L/usr/lib64 -lzmq
-- Using Python PyPy /tmp/build-env-socmms5_/bin/python
-- Building CFFI backend
-- Linking libzmq target PkgConfig::libzmq
-- Configuring done (0.8s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/tmp8_vvg8mg/build
*** Building project with Ninja...
[1/3] Generating _src/_cffi.c
generating /tmp/tmp8_vvg8mg/build/_src/_cffi.c
[2/3] Building C object CMakeFiles/_cffi.dir/_src/_cffi.c.o
FAILED: CMakeFiles/_cffi.dir/_src/_cffi.c.o 
/usr/bin/cc -D_cffi_EXPORTS -I/tmp/build-via-sdist-jveunolw/pyzmq-26.0.3/zmq/utils -isystem /usr/include/pypy3.10 -Werror=incompatible-pointer-types -O3 -DNDEBUG -fPIC -DZMQ_BUILD_DRAFT_API=1 -MD -MT CMakeFiles/_cffi.dir/_src/_cffi.c.o -MF CMakeFiles/_cffi.dir/_src/_cffi.c.o.d -o CMakeFiles/_cffi.dir/_src/_cffi.c.o -c /tmp/tmp8_vvg8mg/build/_src/_cffi.c
/tmp/tmp8_vvg8mg/build/_src/_cffi.c: In function ‘_cffi_checkfld__zhint’:
/tmp/tmp8_vvg8mg/build/_src/_cffi.c:2664:19: error: initialization of ‘void **’ from incompatible pointer type ‘mutex_t **’ [-Werror=incompatible-pointer-types]
 2664 |   { void * *tmp = &p->mutex; (void)tmp; }
      |                   ^
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.

*** CMake build failed

ERROR Backend subprocess exited when trying to invoke build_wheel

Code to reproduce bug

# Reproducer that works with earlier GCC versions
export CFLAGS='-Werror=incompatible-pointer-types'
pypy3 -m build

Traceback, if applicable

No response

More info

It seems to be caused by mutex being declared as void * in _cdefs.h, but as mutex_t * in _cffi_src.c. If I change the latter file to use a void * instead, it seems to compile, but I don't know whether this is the correct solution.

minrk commented 1 month ago

appears to be fixed by #1990

mgorny commented 1 month ago

Thanks. I can confirm that the change fixes it for me.