godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.86k stars 21.01k forks source link

Error compiling against system miniupnpc after major bump to 18 (API breakage) #93907

Closed jujpenabe closed 1 week ago

jujpenabe commented 3 months ago

Tested versions

System information

Artix (Arch) Linux

Issue description

Hi, I was trying to update and build Godot from Master but due to recent update in arch repositories of UPNP (libminiupnp.17 -> libminiupnp.18) cant finish the compilation step.

Complete building log:

scons: Reading SConscript files ...
Auto-detected 4 CPU cores available for build parallelism. Using 4 cores by default. You can override it with the -j argument.
Using linker program: mold
Building for platform "linuxbsd", architecture "x86_64", target "editor".
Using LTO: full
Checking for C header file mntent.h... (cached) yes
scons: done reading SConscript files.
scons: Building targets ...
[ 33%] Compiling modules/upnp/upnp.cpp ...
[ 34%] Compiling modules/webp/webp_common.cpp ...
[ 34%] Compiling modules/webrtc/register_types.cpp ...
[ 34%] Compiling modules/webrtc/webrtc_data_channel.cpp ...
modules/upnp/upnp.cpp:134:10: error: no matching function for call to 'UPNP_GetValidIGD'
  134 |         int i = UPNP_GetValidIGD(devlist, &urls, &data, (char *)&addr, 16);
      |                 ^~~~~~~~~~~~~~~~
/usr/include/miniupnpc/miniupnpc.h:122:1: note: candidate function not viable: requires 7 arguments, but 5 were provided
  122 | UPNP_GetValidIGD(struct UPNPDev * devlist,
      | ^                ~~~~~~~~~~~~~~~~~~~~~~~~~
  123 |                  struct UPNPUrls * urls,
      |                  ~~~~~~~~~~~~~~~~~~~~~~~
  124 |                  struct IGDdatas * data,
      |                  ~~~~~~~~~~~~~~~~~~~~~~~
  125 |                  char * lanaddr, int lanaddrlen,
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  126 |                  char * wanaddr, int wanaddrlen);
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
scons: *** [modules/upnp/upnp.linuxbsd.editor.x86_64.llvm.o] Error 1
scons: building terminated because of errors.
[Time elapsed: 00:00:12.30]

What should I do? Downgrade the library or is planning to update it soon?

Steps to reproduce

  1. Update libraries in arch repository
  2. git pull latest Godot changes (master)
  3. Start building Godot

Minimal reproduction project (MRP)

N/A

alvinhochun commented 3 months ago

The signature of the function UPNP_GetValidIGD has been changed for the latest version of miniupnpc: https://github.com/miniupnp/miniupnp/commit/c0a50ce33e3b99ce8a96fd43049bb5b53ffac62f#diff-5a0d7cff00628c2c64a617edb347c0f283e3a75e7df910e7e8438fc6db23f610L122-R126

FabioLolix commented 2 months ago

just for the records, this is happening when setting builtin_miniupnpc=no like in the godot-mono-git AUR pkgbuild, godot-git is not affected

akien-mga commented 2 months ago

I'll see if there's a define we can check to support both versions, but otherwise the solution is to use Godot"s built-in copy of miniupnpc (which is the default behavior).

david-geiger commented 1 month ago

this following command fixes build with new miniupnpc api 18:

sed -i 's/addr, 16/addr, 16, nullptr, 0/g' modules/upnp/upnp.cpp