curl_cffi
                                
                                 curl_cffi copied to clipboard
                                
                                    curl_cffi copied to clipboard
                            
                            
                            
                        [0.7.4] build failure with GCC 14 due to [-Wincompatible-pointer-types]
Please check the following items and answer all the questions when reporting a bug, otherwise it will be closed immediately.
- [x] This is NOT a site-related "bugs", e.g. some site blocks me when using curl_cffi, UNLESS it has been verified that the reason is missing pieces in the impersonation.
- [x] A code snippet that can reproduce this bug is provided, even if it's a one-liner.
- [x] Version information will be pasted as below.
Describe the bug Failure to build curl_cffi 0.7.4 with GCC >= 14 (14.2.0):
[...]
2025-01-09 23:03:33,371 root INFO building 'curl_cffi._wrapper' extension
2025-01-09 23:03:33,371 root INFO creating build/temp.linux-x86_64-cpython-312/build/temp.linux-x86_64-cpython-312
2025-01-09 23:03:33,372 root INFO creating build/temp.linux-x86_64-cpython-312/ffi
2025-01-09 23:03:33,372 root INFO x86_64-pc-linux-gnu-cc -march=native -O2 -pipe -march=native -O2 -pipe -fPIC -Iinclude -Iffi -I/usr/x86_64-pc-linux-gnu/include/python3.12 -c build/temp.linux-x86_64-cpython-312/curl_cffi._wrapper.c -o build/temp.linux-x86_64-cpython-312/build/temp.linux-x86_64-cpython-312/curl_cffi._wrapper.o
build/temp.linux-x86_64-cpython-312/curl_cffi._wrapper.c: In function '_cffi_d_curl_ws_recv':
build/temp.linux-x86_64-cpython-312/curl_cffi._wrapper.c:2071:35: error: passing argument 4 of 'curl_ws_recv' from incompatible pointer type [-Wincompatible-pointer-types]
 2071 |   return curl_ws_recv(x0, x1, x2, x3, x4);
      |                                   ^~
      |                                   |
      |                                   int *
In file included from include/curl/curl.h:3300,
                 from ffi/shim.h:5,
                 from build/temp.linux-x86_64-cpython-312/curl_cffi._wrapper.c:574:
include/curl/websockets.h:56:43: note: expected 'size_t *' {aka 'long unsigned int *'} but argument is of type 'int *'
   56 |                                   size_t *recv,
      |                                   ~~~~~~~~^~~~
build/temp.linux-x86_64-cpython-312/curl_cffi._wrapper.c:2071:39: error: passing argument 5 of 'curl_ws_recv' from incompatible pointer type [-Wincompatible-pointer-types]
 2071 |   return curl_ws_recv(x0, x1, x2, x3, x4);
      |                                       ^~
      |                                       |
      |                                       struct curl_ws_frame **
include/curl/websockets.h:57:64: note: expected 'const struct curl_ws_frame **' but argument is of type 'struct curl_ws_frame **'
   57 |                                   const struct curl_ws_frame **metap);
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
build/temp.linux-x86_64-cpython-312/curl_cffi._wrapper.c: In function '_cffi_f_curl_ws_recv':
build/temp.linux-x86_64-cpython-312/curl_cffi._wrapper.c:2137:39: error: passing argument 4 of 'curl_ws_recv' from incompatible pointer type [-Wincompatible-pointer-types]
 2137 |   { result = curl_ws_recv(x0, x1, x2, x3, x4); }
      |                                       ^~
      |                                       |
      |                                       int *
include/curl/websockets.h:56:43: note: expected 'size_t *' {aka 'long unsigned int *'} but argument is of type 'int *'
   56 |                                   size_t *recv,
      |                                   ~~~~~~~~^~~~
build/temp.linux-x86_64-cpython-312/curl_cffi._wrapper.c:2137:43: error: passing argument 5 of 'curl_ws_recv' from incompatible pointer type [-Wincompatible-pointer-types]
 2137 |   { result = curl_ws_recv(x0, x1, x2, x3, x4); }
      |                                           ^~
      |                                           |
      |                                           struct curl_ws_frame **
include/curl/websockets.h:57:64: note: expected 'const struct curl_ws_frame **' but argument is of type 'struct curl_ws_frame **'
   57 |                                   const struct curl_ws_frame **metap);
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
build/temp.linux-x86_64-cpython-312/curl_cffi._wrapper.c: In function '_cffi_d_curl_ws_send':
build/temp.linux-x86_64-cpython-312/curl_cffi._wrapper.c:2152:35: error: passing argument 4 of 'curl_ws_send' from incompatible pointer type [-Wincompatible-pointer-types]
 2152 |   return curl_ws_send(x0, x1, x2, x3, x4, x5);
      |                                   ^~
      |                                   |
      |                                   int *
include/curl/websockets.h:71:58: note: expected 'size_t *' {aka 'long unsigned int *'} but argument is of type 'int *'
   71 |                                   size_t buflen, size_t *sent,
      |                                                  ~~~~~~~~^~~~
build/temp.linux-x86_64-cpython-312/curl_cffi._wrapper.c: In function '_cffi_f_curl_ws_send':
build/temp.linux-x86_64-cpython-312/curl_cffi._wrapper.c:2219:39: error: passing argument 4 of 'curl_ws_send' from incompatible pointer type [-Wincompatible-pointer-types]
 2219 |   { result = curl_ws_send(x0, x1, x2, x3, x4, x5); }
      |                                       ^~
      |                                       |
      |                                       int *
include/curl/websockets.h:71:58: note: expected 'size_t *' {aka 'long unsigned int *'} but argument is of type 'int *'
   71 |                                   size_t buflen, size_t *sent,
      |                                                  ~~~~~~~~^~~~
[...]
To Reproduce
- Have GCC >= 14
- Try to build curl_cffi
Expected behavior No build failure.
Versions
- OS: linux x64
- curl_cffi version 0.7.4
Additional context
See the GCC 14 porting guide about -Werror=incompatible-pointer-types (https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types) with GCC 14 the warnings became errors:
GCC no longer allows implicitly casting all pointer types to all other pointer types.
Complete build log: curl-cffi-0.7.4.build.log