fulup-bzh / AlsaJsonGateway

HTTP REST/JSON Gateway to ALSA mixer service for HTML5 UI
53 stars 5 forks source link

Error 1 while compiling #16

Closed sxiii closed 3 years ago

sxiii commented 3 years ago

Greetings! Tried to compile your project on Garuda Linux (Arch family).

Got this error:

Making all in src
make[1]: Entering directory '/home/sa/AlsaJsonGateway/src'
  CC       ajg_daemon-main-ajg.o
  CC       ajg_daemon-config-ajg.o
  CC       ajg_daemon-httpd-ajg.o
httpd-ajg.c: In function ‘httpdStart’:
httpd-ajg.c:456:13: error: passing argument 3 of ‘MHD_start_daemon’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  456 |             &newClient, NULL,       // Tcp Accept call back + extra attribute
      |             ^~~~~~~~~~
      |             |
      |             int (*)(void *, const struct sockaddr *, socklen_t) {aka int (*)(void *, const struct sockaddr *, unsigned int)}
In file included from httpd-ajg.c:39:
/usr/include/microhttpd.h:2479:44: note: expected ‘MHD_AcceptPolicyCallback’ {aka ‘enum MHD_Result (*)(void *, const struct sockaddr *, unsigned int)’} but argument is of type ‘int (*)(void *, const struct sockaddr *, socklen_t)’ {aka ‘int (*)(void *, const struct sockaddr *, unsigned int)’}
 2479 |                   MHD_AcceptPolicyCallback apc, void *apc_cls,
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
httpd-ajg.c:457:13: error: passing argument 5 of ‘MHD_start_daemon’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  457 |             &newRequest, session,  // Http Request Call back + extra attribute
      |             ^~~~~~~~~~~
      |             |
      |             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 httpd-ajg.c:39:
/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 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 **)’}
 2480 |                   MHD_AccessHandlerCallback dh, void *dh_cls,
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:526: ajg_daemon-httpd-ajg.o] Error 1
make[1]: Leaving directory '/home/sa/AlsaJsonGateway/src'
make: *** [Makefile:400: all-recursive] Error 1
[sudo] password for sa: 
Making install in src
make[1]: Entering directory '/home/sa/AlsaJsonGateway/src'
  CC       ajg_daemon-httpd-ajg.o
httpd-ajg.c: In function ‘httpdStart’:
httpd-ajg.c:456:13: error: passing argument 3 of ‘MHD_start_daemon’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  456 |             &newClient, NULL,       // Tcp Accept call back + extra attribute
      |             ^~~~~~~~~~
      |             |
      |             int (*)(void *, const struct sockaddr *, socklen_t) {aka int (*)(void *, const struct sockaddr *, unsigned int)}
In file included from httpd-ajg.c:39:
/usr/include/microhttpd.h:2479:44: note: expected ‘MHD_AcceptPolicyCallback’ {aka ‘enum MHD_Result (*)(void *, const struct sockaddr *, unsigned int)’} but argument is of type ‘int (*)(void *, const struct sockaddr *, socklen_t)’ {aka ‘int (*)(void *, const struct sockaddr *, unsigned int)’}
 2479 |                   MHD_AcceptPolicyCallback apc, void *apc_cls,
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
httpd-ajg.c:457:13: error: passing argument 5 of ‘MHD_start_daemon’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  457 |             &newRequest, session,  // Http Request Call back + extra attribute
      |             ^~~~~~~~~~~
      |             |
      |             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 httpd-ajg.c:39:
/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 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 **)’}
 2480 |                   MHD_AccessHandlerCallback dh, void *dh_cls,
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:526: ajg_daemon-httpd-ajg.o] Error 1
make[1]: Leaving directory '/home/sa/AlsaJsonGateway/src'
make: *** [Makefile:400: install-recursive] Error 1

Probably this is the important part:

error: passing argument 3 of ‘MHD_start_daemon’ from incompatible pointer type

Would be happy if you could lead me; if this is something with a code; or with my system. I've checked deps and I think they are installed OK. Thanks.

fulup-bzh commented 3 years ago

This error comes from a libmicrohttpd API change in between stable and last beta version. Before callback returned an int, and now they return an enum.

The easy option is to stick to a stable version of libmicrohttpd. If you nevertheless want to run with the new API, then you may change the signature of concerned callaback. Replacing int with enum MHD_Result in concerned functions:

On my side, I will change the API when it will be stable. Until them you have to change the code to run it with beta version of the API.