SIDN / spin

SPIN Core Software
https://spin.sidnlabs.nl
GNU General Public License v2.0
77 stars 9 forks source link

Build error spinweb #85

Closed frankvandenhurk closed 2 years ago

frankvandenhurk commented 2 years ago

When I try to build on Debian 11, I get:

Making all in spinweb
make[2]: Entering directory '/root/spin/src/build/spinweb'
  CC       spinweb-spinweb.o
../../spinweb/spinweb.c: In function 'start_daemon':
../../spinweb/spinweb.c:621:35: warning: passing argument 5 of 'MHD_start_daemon' from incompatible pointer type [-Wincompatible-pointer-types]
  621 |                                   &answer_to_connection, NULL,
      |                                   ^~~~~~~~~~~~~~~~~~~~~
      |                                   |
      |                                   int (*)(void *, struct MHD_Connection *, const char *, const char *, const char *, const char *, size_t *, void **) {aka int (*)(void *, struct MHD_Connection *, const char *, const char *, const char *, const char *, long unsigned int *, void **)}
In file included from ../../spinweb/spinweb.c:4:
/usr/include/microhttpd.h:2443:45: note: expected 'MHD_AccessHandlerCallback' {aka 'enum MHD_Result (*)(void *, struct MHD_Connection *, const char *, const char *, const char *, const char *, long unsigned int *, void **)'} but argument is of type 'int (*)(void *, struct MHD_Connection *, const char *, const char *, const char *, const char *, size_t *, void **)' {aka 'int (*)(void *, struct MHD_Connection *, const char *, const char *, const char *, const char *, long unsigned int *, void **)'}
 2443 |                   MHD_AccessHandlerCallback dh, void *dh_cls,
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
../../spinweb/spinweb.c:630:35: warning: passing argument 5 of 'MHD_start_daemon' from incompatible pointer type [-Wincompatible-pointer-types]
  630 |                                   &answer_to_connection, NULL,
      |                                   ^~~~~~~~~~~~~~~~~~~~~
      |                                   |
      |                                   int (*)(void *, struct MHD_Connection *, const char *, const char *, const char *, const char *, size_t *, void **) {aka int (*)(void *, struct MHD_Connection *, const char *, const char *, const char *, const char *, long unsigned int *, void **)}
In file included from ../../spinweb/spinweb.c:4:
/usr/include/microhttpd.h:2443:45: note: expected 'MHD_AccessHandlerCallback' {aka 'enum MHD_Result (*)(void *, struct MHD_Connection *, const char *, const char *, const char *, const char *, long unsigned int *, void **)'} but argument is of type 'int (*)(void *, struct MHD_Connection *, const char *, const char *, const char *, const char *, size_t *, void **)' {aka 'int (*)(void *, struct MHD_Connection *, const char *, const char *, const char *, const char *, long unsigned int *, void **)'}
 2443 |                   MHD_AccessHandlerCallback dh, void *dh_cls,
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
  CC       spinweb-traffic_capture.o
  CC       spinweb-rpc_client.o
  CC       spinweb-files.o
  CC       ../spind/spinweb-cJSON.o
  CCLD     spinweb
make[2]: Leaving directory '/root/spin/src/build/spinweb'
Making all in tools
make[2]: Entering directory '/root/spin/src/build/tools'
make[3]: Entering directory '/root/spin/src/build/tools'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/root/spin/src/build/tools'
make[2]: Leaving directory '/root/spin/src/build/tools'
make[2]: Entering directory '/root/spin/src/build'
make[2]: Leaving directory '/root/spin/src/build'
make[1]: Leaving directory '/root/spin/src/build'

When I try to build on Debian 9, I get:

Making all in spinweb
make[2]: Entering directory '/root/spin/src/build/spinweb'
  CC       spinweb-spinweb.o
../../spinweb/spinweb.c: In function 'start_daemon':
../../spinweb/spinweb.c:614:65: error: 'MHD_USE_INTERNAL_POLLING_THREAD' undeclared (first use in this function)
     unsigned int daemon_flags = MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD;
                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../spinweb/spinweb.c:614:65: note: each undeclared identifier is reported only once for each function it appears in
Makefile:402: recipe for target 'spinweb-spinweb.o' failed
make[2]: *** [spinweb-spinweb.o] Error 1
make[2]: Leaving directory '/root/spin/src/build/spinweb'
Makefile:432: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/spin/src/build'
Makefile:338: recipe for target 'all' failed
make: *** [all] Error 2

Anything I can do to avoid this? Maybe it has something to do with the fact that I am running this debian versions in containers?

(background: I am using tcpdump on my router to create pcap files that I would like to use as a source for SPIN. That's why a container would fit my goal perfectly.)

frankvandenhurk commented 2 years ago

With alpine linux (also in a container) the same problem:

make[2]: Entering directory '/usr/local/spin/src/build/spinweb'                                                                                                                                             
  CC       spinweb-spinweb.o                                                                                                                                                                                
../../spinweb/spinweb.c: In function 'start_daemon':                                                                                                                                                        
../../spinweb/spinweb.c:621:35: warning: passing argument 5 of 'MHD_start_daemon' from incompatible pointer type [-Wincompatible-pointer-types]                                                             
  621 |                                   &answer_to_connection, NULL,                                                                                                                                      
      |                                   ^~~~~~~~~~~~~~~~~~~~~                                                                                                                                             
      |                                   |                                                                                                                                                                 
      |                                   int (*)(void *, struct MHD_Connection *, const char *, const char *, const char *, const char *, size_t *, void **) {aka int (*)(void *, struct MHD_Connection *, 
const char *, const char *, const char *, const char *, long unsigned int *, void **)}                                                                                                                      
In file included from ../../spinweb/spinweb.c:4:                                                                                                                                                            
/usr/include/microhttpd.h:2480:45: note: expected 'MHD_AccessHandlerCallback' {aka 'enum MHD_Result (*)(void *, struct MHD_Connection *, const char *, const char *, const char *, const char *, long unsign
ed int *, void **)'} but argument is of type 'int (*)(void *, struct MHD_Connection *, const char *, const char *, const char *, const char *, size_t *, void **)' {aka 'int (*)(void *, struct MHD_Connecti
on *, const char *, const char *, const char *, const char *, long unsigned int *, void **)'}                                                                                                               
 2480 |                   MHD_AccessHandlerCallback dh, void *dh_cls,                                                                                                                                       
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~                                                                                                                                                      
../../spinweb/spinweb.c:630:35: warning: passing argument 5 of 'MHD_start_daemon' from incompatible pointer type [-Wincompatible-pointer-types]                                                             
  630 |                                   &answer_to_connection, NULL,                                                                                                                                      
      |                                   ^~~~~~~~~~~~~~~~~~~~~                                                                                                                                             
      |                                   |                                                                                                                                                                 
      |                                   int (*)(void *, struct MHD_Connection *, const char *, const char *, const char *, const char *, size_t *, void **) {aka int (*)(void *, struct MHD_Connection *, 
const char *, const char *, const char *, const char *, long unsigned int *, void **)}                                                                                                                      
In file included from ../../spinweb/spinweb.c:4:                                                                                                                                                            
/usr/include/microhttpd.h:2480:45: note: expected 'MHD_AccessHandlerCallback' {aka 'enum MHD_Result (*)(void *, struct MHD_Connection *, const char *, const char *, const char *, const char *, long unsign
ed int *, void **)'} but argument is of type 'int (*)(void *, struct MHD_Connection *, const char *, const char *, const char *, const char *, size_t *, void **)' {aka 'int (*)(void *, struct MHD_Connecti
on *, const char *, const char *, const char *, const char *, long unsigned int *, void **)'}                                                                                                               
 2480 |                   MHD_AccessHandlerCallback dh, void *dh_cls,                                                                                                                                       
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~                             
frankvandenhurk commented 2 years ago

Just tried it on a VM instead of a container, but same result so that's not the reason of the error.

cschutijser commented 2 years ago

Hi, Thanks for the report. Can you try out the issue-85 branch in this repository? I pushed two commits which I think address these problems. Caspar

frankvandenhurk commented 2 years ago

Thank you, when using this branch no build errors on this part!!

cschutijser commented 2 years ago

Good to hear! I have merged these commits to the master branch.