litecoin-project / litecoin

Litecoin source tree
http://www.litecoin.org
MIT License
4.38k stars 3.03k forks source link

Unable to build litecoin 0.21.4 on Ubuntu 24.10 (oracular) #993

Open jhonny-oliveira opened 6 days ago

jhonny-oliveira commented 6 days ago

Expected behavior

Successful build

Actual behavior

Failed build. The build is successful on Ubuntu 24.04 and older versions.

net.cpp: In function ‘void ThreadMapPort()’:
net.cpp:1640:25: error: too few arguments to function ‘int UPNP_GetValidIGD(UPNPDev*, UPNPUrls*, IGDdatas*, char*, int, char*, int)’
 1640 |     r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
      |         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from net.cpp:40:
/usr/include/miniupnpc/miniupnpc.h:122:1: note: declared here
  122 | UPNP_GetValidIGD(struct UPNPDev * devlist,
      | ^~~~~~~~~~~~~~~~

To reproduce You can find attached to complete build log: Build_litecoin_0.21.4_on_Ubuntu_24.10_log.txt. The build recipe can be found here: https://launchpad.net/~xtradeb/+archive/ubuntu/apps/+packages?field.name_filter=litecoin&field.status_filter=published&field.series_filter=noble

System information Ubuntu 24.10

jhonny-oliveira commented 4 days ago

The problem is that Ubuntu 24.10 ships with miniupnpc 2.2.8. Previous version had 2.2.6.

To ensure fix the problem and maintain compatibility with both versions, I applied this patch:

Description: Ensure compat with miniupnpc 2.2.8
Author: Jhonny Oliveira <jhonny.oliveira@gmail.com>

--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1637,7 +1637,11 @@
     struct IGDdatas data;
     int r;

+#if defined(MINIUPNPC_API_VERSION) && MINIUPNPC_API_VERSION <= 17
     r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
+#else
+    r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr), NULL, 0);
+#endif
     if (r == 1)
     {
         if (fDiscover) {