Fix build with libupnp 1.18 - #432
Conversation
|
the ci says the build fails with libupnp 1.14.18 |
|
Interesting.. Debian/Ubuntu are using a different version scheme for libupnp based on library soname. |
|
For example:
which results in
which results in |
And this is actually a difference between autotools and cmake builds of libupnp. What a mess. =( |
|
So this one is not fixed? |
|
I don't know how to properly fix this for certain libupnp versions built with cmake (including those currently shipped by Debian and Ubuntu). libupnp upstream fixed this at some point, so both cmake and autotools builds now generate consistent version info. E.g. latest 1.18.4 built via cmake has this in the which results in |
|
So we could check and require just a recent enough version. If someone compiles amule, getting a recent libupnp shouldn't be asked too much. |
This has been fixed. The const event thing was my mistake. As a result, some 1.14.x releases have a broken API. My suggestion is to use only the last 1.14.x or 1.18.x. Otherwise you will have to figure out at what point I broke 1.14.x API and ifdef it. Not hard too, but ugly since it is not amule's fault.
Exactly. |
|
I've added a workaround for Debian/Ubuntu and co. Not an elegant solution, but should work. |
Not everyone will like it. And this will break current CI builds. |
|
I broke the 1.14.30 should also compile. |
|
I guess @mrjimenez is the expert here. My solution would be to require 1.18.x on don't work around stuff. Thanks to Christian Marrilat this should be available. |
|
OK. I reverted my patch to the previous version. CI build failure is expected. |
Yes I know this. But this is not the issue. Most distros are likely skipped this release. The issue is that Debian and Ubuntu (at least LTS) are still shipping even older libupnp where pupnp/pupnp#277 is not fixed. |
Some distro packages (observed on Ubuntu 25.10 with libupnp-dev 1.14.24) ship a UPNP.cmake that lists non-existent paths (/usr/COMPONENT, /usr/UPNP_Development) in INTERFACE_INCLUDE_DIRECTORIES, causing CMake to abort at generation time: CMake Error: Imported target "UPNP::Shared" includes non-existent path "/usr/COMPONENT" in its INTERFACE_INCLUDE_DIRECTORIES. This is a packaging bug unrelated to the callback signature issue discussed in amule-project#432. Work around it by inspecting the UPNP targets file before loading it, and falling back to pkg-config if the broken path pattern is detected. pkg-config correctly finds libupnp on all affected systems.
|
Ran into a separate but related issue on Ubuntu 25.10 with libupnp 1.14.24: the distro's This is a packaging bug independent of the callback signature issue being fixed here. Just opened #439 with a workaround that detects the broken config before loading it and falls back to pkg-config, which works correctly on all affected systems. |
Some distro packages (observed on Ubuntu 25.10 with libupnp-dev 1.14.24) ship a UPNP.cmake that lists non-existent paths (/usr/COMPONENT, /usr/UPNP_Development) in INTERFACE_INCLUDE_DIRECTORIES, causing CMake to abort at generation time: CMake Error: Imported target "UPNP::Shared" includes non-existent path "/usr/COMPONENT" in its INTERFACE_INCLUDE_DIRECTORIES. This is a packaging bug unrelated to the callback signature issue discussed in #432. Work around it by inspecting the UPNP targets file before loading it, and falling back to pkg-config if the broken path pattern is detected. pkg-config correctly finds libupnp on all affected systems.
|
@got3nks , try to push a trivial change to the PR, to trigger a new CI test. When I do it locally, it compiles, but when GitHub does it, it seems like it does on a previous version. |
|
@mrjimenez did you mean to tag the PR author @puleglot ? |
Sorry, I meant @puleglot :D |
CI is using ubuntu-latest image, which is 24.04 |
config.status: executing denoiser commands
Configure script has finished system check.
Configured aMule SVN (rev. g8e9c518) for 'x86_64-pc-linux-gnu'.
aMule enabled options:
**** aMule Core ****
Prefix where aMule should be installed? /usr/local
Should aMule be compiled with i18n support? yes
Should aMule be compiled in debug mode? yes
Should aMule be compiled with profiling? no
Should aMule be compiled with optimizations? no
Should aMule be compiled with UPnP support? yes
Should aMule be compiled with IP2country support? yes
Should aMule monolithic application be built? yes
Should aMule daemon version be built? yes
Should aMule remote gui be built? yes
**** aMule TextClient ****
Should aMule Command Line Client be built? yes
**** aMule WebServer ****
Should aMule WebServer be built? yes
**** aMule ED2K Links Handler ****
Should aMule ED2K Links Handler be built? yes
**** aMuleLinkCreator ****
Should aMuleLinkCreator GUI version (alc) be built? yes
Should aMuleLinkCreator for console (alcc) be built? yes
**** aMule Statistics ****
Should C aMule Statistics (CAS) be built? yes
Should aMule GUI Statistics (wxCas) be built? yes
Should xas XChat2 plugin be installed? no
Should plasmaMule plasma-applet be built? no
**** General Libraries and Tools ****
Should ccache support be enabled? no
Should aMule file viewer for console be built? no
Libraries aMule will use to build:
wxWidgets 3.2.4 (gtk3,shared)
boost Not detected
crypto++ 8.9 (in /usr)
libupnp 1.14.18
libintl system
libGeoIP system
libpng 1.6.43
libgd 2.3.3
zlib 1.3
*** Warnings during configuration ***
* Boost support has been disabled because of insufficient Boost version.libupnp is 1.14.18 Somehow the test is faling. g++ -I. -I.. -D__DEBUG__ -DUSE_WX_EXTENSIONS -I/usr/lib/x86_64-linux-gnu/wx/include/gtk3-unicode-3.2 -I/usr/include/wx-3.2 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -DwxUSE_GUI=0 -I./libs -I./include -I/usr/include/upnp -DENABLE_UPNP=1 -g -W -Wall -Wshadow -Wundef -ggdb -fno-inline -fmessage-length=0 -MT libmuleappcore_a-UPnPBase.o -MD -MP -MF .deps/libmuleappcore_a-UPnPBase.Tpo -c -o libmuleappcore_a-UPnPBase.o `test -f 'UPnPBase.cpp' || echo './'`UPnPBase.cpp
UPnPBase.cpp: In constructor ‘CUPnPControlPoint::CUPnPControlPoint(short unsigned int)’:
UPnPBase.cpp:845:17: error: invalid ‘static_cast’ from type ‘int (*)(Upnp_EventType_e, void*, void*)’ to type ‘Upnp_FunPtr’ {aka ‘int (*)(Upnp_EventType_e, const void*, void*)’}
845 | static_cast<Upnp_FunPtr>(&CUPnPControlPoint::Callback),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[3]: *** [Makefile:1824: libmuleappcore_a-UPnPBase.o] Error 1
make[3]: Leaving directory '/home/runner/work/amule/amule/src'
make[2]: *** [Makefile:3102: all-recursive] Error 1
make[2]: Leaving directory '/home/runner/work/amule/amule/src'
make[1]: *** [Makefile:613: all-recursive] Error 1
make[1]: Leaving directory '/home/runner/work/amule/amule'
make: *** [Makefile:502: all] Error 2
Error: Process completed with exit code 2.``` |
|
There should be a test for versions between 1.14.26 until 1.14.30, and a test for versions 1.14.25 and before.
In other words, 1.14.26 to 1.14.29 are |
|
@puleglot , change your patch to the one I have attached here and force push. I am not a maintainer, so I cannot push to the PR. |
|
Nevermind, it did not work on Ubuntu. A reinterpret_cast may put an end to this madness. |
g++ -I. -I.. -D__DEBUG__ -DUSE_WX_EXTENSIONS -I/usr/lib/x86_64-linux-gnu/wx/include/gtk3-unicode-3.2 -I/usr/include/wx-3.2 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -DwxUSE_GUI=0 -I./libs -I./include -I/usr/include/upnp -DENABLE_UPNP=1 -g -W -Wall -Wshadow -Wundef -ggdb -fno-inline -fmessage-length=0 -MT libmuleappcore_a-UPnPBase.o -MD -MP -MF .deps/libmuleappcore_a-UPnPBase.Tpo -c -o libmuleappcore_a-UPnPBase.o `test -f 'UPnPBase.cpp' || echo './'`UPnPBase.cpp
UPnPBase.cpp:48:2: error: #error UPNP_VERSION is set to: STR(UPNP_VERSION)
48 | #error UPNP_VERSION is set to: STR(UPNP_VERSION)
| ^~~~~
UPnPBase.cpp:47:53: note: ‘#pragma message: UPNP_VERSION is: ( (17 * 10000) + (1 * 100) + (9))’Cmake version numbers are broken for this version of PUPnP. |
|
mrjimenez thank you. I've already mentioned an issue with PUPnP version in Ubuntu/Debian and got mixed signals about whether or not it should be worked around. :) Glad it's finally resolved. |
Fixes #431