pupnp / pupnp

libupnp: Build UPnP-compliant control points, devices, and bridges on several operating systems.
https://pupnp.github.io/pupnp
BSD 3-Clause "New" or "Revised" License
352 stars 115 forks source link

Compile with openssl fails #284

Closed Vollstrecker closed 3 years ago

Vollstrecker commented 3 years ago

Hi,

just gave it a try. Maybe because this option defaults to off it never was tested (at least by me).

cd /home/werner/pupnp/upnp && /usr/bin/c++ -DDEBUG -DSTATS -DUPNP_STATIC_LIB -I/home/werner/VBox/pupnp/upnp/src/threadutil -I/home/werner/VBox/pupnp/upnp/inc -I/home/werner/VBox/pupnp/upnp/src/inc -I/home/werner/pupnp -I/home/werner/pupnp/upnp/inc -I/home/werner/VBox/pupnp/ixml/inc -I/home/werner/VBox/pupnp/ixml/src/inc -g -pthread -o CMakeFiles/upnp_static.dir/src/api/upnpapi.cpp.o -c /home/werner/VBox/pupnp/upnp/src/api/upnpapi.cpp
/home/werner/VBox/pupnp/upnp/src/api/upnpapi.cpp: In function ‘int UpnpInitSslContext(UpnpLib*, int, const SSL_METHOD*)’:
/home/werner/VBox/pupnp/upnp/src/api/upnpapi.cpp:443:14: error: invalid use of incomplete type ‘UpnpLib’ {aka ‘struct s_UpnpLib’}
  443 |         if (p->gSslCtx) {
      |              ^~
In file included from /home/werner/VBox/pupnp/upnp/src/inc/VirtualDir.h:4,
                 from /home/werner/VBox/pupnp/upnp/src/inc/upnpapi.h:40,
                 from /home/werner/VBox/pupnp/upnp/src/api/upnpapi.cpp:43:
/home/werner/VBox/pupnp/upnp/inc/upnp.h:409:16: note: forward declaration of ‘UpnpLib’ {aka ‘struct s_UpnpLib’}
  409 | typedef struct s_UpnpLib UpnpLib;
      |                ^~~~~~~~~
/home/werner/VBox/pupnp/upnp/src/api/upnpapi.cpp:451:10: error: invalid use of incomplete type ‘UpnpLib’ {aka ‘struct s_UpnpLib’}
  451 |         p->gSslCtx = SSL_CTX_new(sslMethod);
      |          ^~
In file included from /home/werner/VBox/pupnp/upnp/src/inc/VirtualDir.h:4,
                 from /home/werner/VBox/pupnp/upnp/src/inc/upnpapi.h:40,
                 from /home/werner/VBox/pupnp/upnp/src/api/upnpapi.cpp:43:
/home/werner/VBox/pupnp/upnp/inc/upnp.h:409:16: note: forward declaration of ‘UpnpLib’ {aka ‘struct s_UpnpLib’}
  409 | typedef struct s_UpnpLib UpnpLib;
      |                ^~~~~~~~~
/home/werner/VBox/pupnp/upnp/src/api/upnpapi.cpp:452:15: error: invalid use of incomplete type ‘UpnpLib’ {aka ‘struct s_UpnpLib’}
  452 |         if (!p->gSslCtx) {
      |               ^~
In file included from /home/werner/VBox/pupnp/upnp/src/inc/VirtualDir.h:4,
                 from /home/werner/VBox/pupnp/upnp/src/inc/upnpapi.h:40,
                 from /home/werner/VBox/pupnp/upnp/src/api/upnpapi.cpp:43:
/home/werner/VBox/pupnp/upnp/inc/upnp.h:409:16: note: forward declaration of ‘UpnpLib’ {aka ‘struct s_UpnpLib’}
  409 | typedef struct s_UpnpLib UpnpLib;
      |                ^~~~~~~~~
/home/werner/VBox/pupnp/upnp/src/api/upnpapi.cpp: In function ‘int UpnpFinish(UpnpLib*)’:
/home/werner/VBox/pupnp/upnp/src/api/upnpapi.cpp:526:13: error: ‘gSslCtx’ was not declared in this scope
  526 |         if (gSslCtx) {
      |             ^~~~~~~
make[2]: *** [upnp/CMakeFiles/upnp_static.dir/build.make:238: upnp/CMakeFiles/upnp_static.dir/src/api/upnpapi.cpp.o] Fehler 1
make[2]: Verzeichnis „/home/werner/pupnp“ wird verlassen
make[1]: *** [CMakeFiles/Makefile2:327: upnp/CMakeFiles/upnp_static.dir/all] Fehler 2
make[1]: Verzeichnis „/home/werner/pupnp“ wird verlassen
make: *** [Makefile:160: all] Fehler 2
Vollstrecker commented 3 years ago

Seems like spaces get swallowed.

The ^ points to -> in p lines and s_UpnpLib in the others.

whyman commented 3 years ago

If you wrap your code in triple backticks it should keep the whitespace:

```
your output here!
```
Vollstrecker commented 3 years ago

Tried that with the backticks on the first and last line. Now it's better

mrjimenez commented 3 years ago

Please check now after #286 .

Maybe it would be a good idea to include an openssl compilation in the workflow sanity checks.

Vollstrecker commented 3 years ago

Didn't change.

mrjimenez commented 3 years ago

You get the same error? The code you previously pasted no longer exists.

Vollstrecker commented 3 years ago

Maybe I pulled to early. Works now. Maybe we should just set all disabled option to on in the tests to get it all coverred.

mrjimenez commented 3 years ago

You've got a point. Do a test and a PR.

I did a test called "OpenSSL build (ubuntu-20.04)", but that is autotools based, maybe you can do the same, cmake based and with all options enabled.

Also be sure to include the sanitizer flags, we currently have no CMake sanitizer build, that could be the one. Maybe a "SANITIZER" option in CMakeLists.txt.

Vollstrecker commented 3 years ago

I'm sure that works the same way, I just don't think I have time for it today. Will be done asap.

mrjimenez commented 3 years ago

Closing because it seems to be compiling ok now.