Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miniupnpc build failure with -Wincompatible-pointer-types with Fedora 40's MinGW / GCC 14 #88471

Closed
SomeDudeNamedAnthony opened this issue Feb 18, 2024 · 1 comment · Fixed by #91636

Comments

@SomeDudeNamedAnthony
Copy link

SomeDudeNamedAnthony commented Feb 18, 2024

Tested versions

Reproduced in SCons v4.x and Godot v4.1.3 Stable and v4.2.1 Stable.

System information

Fedora 40 "Rawhide" - Godot 4.1.3 Stable/Godot 4.2.1

Issue description

During the compilation of Godot 4, the build will run fine until it reaches the compiling of the upnp module which will fail due to a incompatible pointer type error.

Here is the error:

thirdparty/miniupnpc/src/connecthostport.c: In function 'connecthostport':
thirdparty/miniupnpc/src/connecthostport.c:213:59: error: passing argument 4 of 'setsockopt' from incompatible pointer type [-Wincompatible-pointer-types]
  213 |                 if(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(struct timeval)) < 0)
      |                                                           ^~~~~~~~
      |                                                           |
      |                                                           struct timeval *
In file included from thirdparty/miniupnpc/src/connecthostport.c:18:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:1035:88: note: expected 'const char *' but argument is of type 'struct timeval *'
 1035 |   WINSOCK_API_LINKAGE int WSAAPI setsockopt(SOCKET s,int level,int optname,const char *optval,int optlen);
      |                                                                            ~~~~~~~~~~~~^~~~~~
thirdparty/miniupnpc/src/connecthostport.c:219:59: error: passing argument 4 of 'setsockopt' from incompatible pointer type [-Wincompatible-pointer-types]
  219 |                 if(setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(struct timeval)) < 0)
      |                                                           ^~~~~~~~
      |                                                           |
      |                                                           struct timeval *
/usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:1035:88: note: expected 'const char *' but argument is of type 'struct timeval *'
 1035 |   WINSOCK_API_LINKAGE int WSAAPI setsockopt(SOCKET s,int level,int optname,const char *optval,int optlen);
      |                                                                            ~~~~~~~~~~~~^~~~~~
[Initial build] Compiling thirdparty/vhacd/src/vhacdICHull.cpp ...
scons: *** [thirdparty/miniupnpc/src/connecthostport.windows.editor.x86_64.o] Error 1
scons: building terminated because of errors.
[Time elapsed: 00:02:55.764]

I don't know if this is a MinGW issue or a bug.

Here is the version of MinGW I'm using:

Using built-in specs.
COLLECT_GCC=i686-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-w64-mingw32/14.0.1/lto-wrapper
Target: i686-w64-mingw32
Configured with: ../configure --prefix=/usr --bindir=/usr/bin --includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --with-gnu-as --with-gnu-ld --verbose --without-newlib --disable-multilib --disable-plugin --with-system-zlib --disable-nls --without-included-gettext --disable-win32-registry --enable-languages=c,c++,objc,obj-c++,fortran --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-threads=posix --without-isl --enable-libgomp --target=i686-w64-mingw32 --with-sysroot=/usr/i686-w64-mingw32/sys-root --with-gxx-include-dir=/usr/i686-w64-mingw32/sys-root/mingw/include/c++ --disable-sjlj-exceptions --with-dwarf2
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.1 20240127 (Fedora MinGW 14.0.1-1.fc40) (GCC)

Steps to reproduce

  • Use a Fedora 40 "Rawhide" Docker container. (Image id: 7f1be82d412f)
  • Follow the documentation and build the editor.

Minimal reproduction project (MRP)

N/A, compile issue.

@akien-mga akien-mga changed the title Godot 4.x will not build with MinGW via cross-compilation. (Linux -> Windows) miniupnpc build failure with -Wincompatible-pointer-types with Fedora 40's MinGW / GCC 14 Feb 18, 2024
@akien-mga akien-mga added this to the 4.3 milestone Feb 18, 2024
@bruvzg
Copy link
Member

bruvzg commented Feb 18, 2024

WINAPI have this function defined with the buffer argument as const char * instead const void * on Linux, should be enough to add casts (which most of the code do). But I'm not sure why it was not an issue before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment