mkschreder / orangerpcd

Websocket RPC server for OpenWRT
Other
27 stars 11 forks source link

compile orange_ws_server.c error #10

Closed Pillar1989 closed 7 years ago

Pillar1989 commented 7 years ago

static int _orange_socket_callback(struct lws _wsi, enum lws_callback_reasons reason, void _user, void in, size_t len){ ^ orange_ws_server.c:130:58: error: its scope is only this definition or declaration, which is probably not what you want [-Werror] orange_ws_server.c:130:79: error: parameter 2 ('reason') has incomplete type static int _orange_socket_callback(struct lws wsi, enum lws_callback_reasons reason, void _user, void in, size_t len){ ^ orange_ws_server.c:130:12: error: function declaration isn't a prototype [-Werror=strict-prototypes] static int _orange_socket_callback(struct lws wsi, enum lws_callback_reasons reason, void _user, void in, size_t len){ ^ orange_ws_server.c: In function '_orange_socket_callback': orange_ws_server.c:132:15: error: implicit declaration of function 'lws_get_protocol' [-Werror=implicit-function-declaration] const struct lws_protocols proto = lws_get_protocol(wsi); ^ orange_ws_server.c:132:15: error: nested extern declaration of 'lws_get_protocol' [-Werror=nested-externs] orange_ws_server.c:132:38: error: initialization makes pointer from integer without a cast [-Werror] const struct lws_protocols proto = lws_get_protocol(wsi); ^ orange_ws_server.c:141:2: error: implicit declaration of function 'lws_get_socket_fd' [-Werror=implicit-function-declaration] int32_t peer_id = lws_get_socket_fd(wsi); ^ orange_ws_server.c:141:2: error: nested extern declaration of 'lws_get_socket_fd' [-Werror=nested-externs] orange_ws_server.c:144:61: error: dereferencing pointer to incomplete type struct orange_srv_ws self = (struct orange_srvws)proto->user; ^ orange_ws_server.c:150:4: error: implicit declaration of function 'lws_get_peer_addresses' [-Werror=implicit-function-declaration] lws_get_peer_addresses(wsi, peer_id, hostname, sizeof(hostname), ipaddr, sizeof(ipaddr)); ^ orange_ws_server.c:150:4: error: nested extern declaration of 'lws_get_peer_addresses' [-Werror=nested-externs] orange_ws_server.c:155:4: error: implicit declaration of function 'lws_callback_on_writable' [-Werror=implicit-function-declaration] lws_callback_on_writable(wsi);
^ orange_ws_server.c:155:4: error: nested extern declaration of 'lws_callback_on_writable' [-Werror=nested-externs] orange_ws_server.c:163:61: error: dereferencing pointer to incomplete type struct orange_srv_ws _self = (struct orange_srvws)proto->user; ^ orange_ws_server.c:173:61: error: dereferencing pointer to incomplete type struct orange_srv_ws _self = (struct orange_srvws)proto->user; ^ orange_ws_server.c:194:6: error: implicit declaration of function 'lws_write' [-Werror=implicit-function-declaration] int n = lws_write(wsi, &frame->buf[LWS_SEND_BUFFER_PRE_PADDING]+frame->sent_count, towrite, flags); ^ orange_ws_server.c:194:6: error: nested extern declaration of 'lws_write' [-Werror=nested-externs] orange_ws_server.c:206:5: error: implicit declaration of function 'lws_partial_buffered' [-Werror=implicit-function-declaration] } while(frame->sent_count < frame->len && !lws_partial_buffered(wsi));
^ orange_ws_server.c:206:5: error: nested extern declaration of 'lws_partial_buffered' [-Werror=nested-externs] orange_ws_server.c:230:61: error: dereferencing pointer to incomplete type struct orange_srv_ws _self = (struct orange_srvws)proto->user; ^ orange_ws_server.c:238:4: error: implicit declaration of function 'lws_is_final_fragment' [-Werror=implicit-function-declaration] if(lws_is_final_fragment(wsi)){ ^ orange_ws_server.c:238:4: error: nested extern declaration of 'lws_is_final_fragment' [-Werror=nested-externs] orange_ws_server.c: In function '_websocket_destroy': orange_ws_server.c:313:2: error: implicit declaration of function 'lws_context_destroy' [-Werror=implicit-function-declaration] if(self->ctx) lws_context_destroy(self->ctx); ^ orange_ws_server.c:313:2: error: nested extern declaration of 'lws_context_destroy' [-Werror=nested-externs] orange_ws_server.c: In function '_find_interface_from_ip': orange_ws_server.c:350:14: error: 'NI_MAXHOST' undeclared (first use in this function) char host[NI_MAXHOST+1];
^ orange_ws_server.c:350:14: note: each undeclared identifier is reported only once for each function it appears in orange_ws_server.c:351:4: error: implicit declaration of function 'getnameinfo' [-Werror=implicit-function-declaration] int s = getnameinfo(iap->ifa_addr, ^ orange_ws_server.c:351:4: error: nested extern declaration of 'getnameinfo' [-Werror=nested-externs] orange_ws_server.c:355:17: error: 'NI_NUMERICHOST' undeclared (first use in this function) NULL, 0, NI_NUMERICHOST); ^ orange_ws_server.c:357:7: error: implicit declaration of function 'gai_strerror' [-Werror=implicit-function-declaration] printf("getnameinfo() failed: %s\n", gai_strerror(s)); ^ orange_ws_server.c:357:7: error: nested extern declaration of 'gai_strerror' [-Werror=nested-externs] orange_wsserver.c:357:7: error: format '%s' expects argument of type 'char ', but argument 2 has type 'int' [-Werror=format=] orange_ws_server.c: In function '_websocket_listen': orange_ws_server.c:397:17: error: assignment from incompatible pointer type [-Werror] info.protocols = self->protocols; ^ orange_ws_server.c:399:17: error: 'LWS_SERVER_OPTION_VALIDATE_UTF8' undeclared (first use in this function) info.options = LWS_SERVER_OPTION_VALIDATE_UTF8; ^ orange_ws_server.c:402:2: error: implicit declaration of function 'lws_create_context' [-Werror=implicit-function-declaration] self->ctx = lws_create_context(&info); ^ orange_ws_server.c:402:2: error: nested extern declaration of 'lws_create_context' [-Werror=nested-externs] orange_ws_server.c:402:12: error: assignment makes pointer from integer without a cast [-Werror] self->ctx = lws_create_context(&info); ^ orange_ws_server.c: In function '_websocket_server_thread': orange_ws_server.c:430:4: error: implicit declaration of function 'lws_service' [-Werror=implicit-function-declaration] lws_service(self->ctx, 10); ^ orange_ws_server.c:430:4: error: nested extern declaration of 'lws_service' [-Werror=nested-externs] orange_ws_server.c: In function 'orange_ws_server_new': orange_ws_server.c:532:37: error: invalid application of 'sizeof' to incomplete type 'struct lws_protocols' self->protocols = calloc(2, sizeof(struct lws_protocols)); ^ orange_ws_server.c:534:2: error: invalid use of undefined type 'struct lws_protocols' self->protocols[0] = (struct lws_protocols){ ^ orange_ws_server.c:534:17: error: dereferencing pointer to incomplete type self->protocols[0] = (struct lws_protocols){ ^ orange_ws_server.c:535:3: error: unknown field 'name' specified in initializer .name = "rpc", ^ orange_ws_server.c:535:3: error: excess elements in struct initializer [-Werror] orange_ws_server.c:535:3: error: (near initialization for '(anonymous)') [-Werror] orange_ws_server.c:536:3: error: unknown field 'callback' specified in initializer .callback = _orange_socket_callback, ^ orange_ws_server.c:536:3: error: excess elements in struct initializer [-Werror] orange_ws_server.c:536:3: error: (near initialization for '(anonymous)') [-Werror] orange_ws_server.c:537:3: error: unknown field 'per_session_data_size' specified in initializer .per_session_data_size = sizeof(struct orange_srv_wsclient), ^ orange_ws_server.c:537:42: error: excess elements in struct initializer [-Werror] .per_session_data_size = sizeof(struct orange_srv_wsclient), ^ orange_ws_server.c:537:42: error: (near initialization for '(anonymous)') [-Werror] orange_ws_server.c:538:3: error: unknown field 'user' specified in initializer .user = self ^ orange_ws_server.c:539:2: error: excess elements in struct initializer [-Werror] }; ^ orange_ws_server.c:539:2: error: (near initialization for '(anonymous)') [-Werror] orange_ws_server.c:539:2: error: invalid use of undefined type 'struct lws_protocols' cc1: all warnings being treated as errors make[5]:
_* [liborange_la-orange_ws_server.lo] Error 1

mkschreder commented 7 years ago

No newest version of libwebsockets installed. Make sure you are using libwebsockets from the juci feed.

On 23 Sep 2016 08:00, "Baozhu Zuo" notifications@github.com wrote:

static int _orange_socket_callback(struct lws

_wsi, enum lws_callback_reasons reason, void _user, void in, size_t len){ ^ orange_ws_server.c:130:58: error: its scope is only this definition or declaration, which is probably not what you want [-Werror] orange_ws_server.c:130:79: error: parameter 2 ('reason') has incomplete type static int _orange_socket_callback(struct lws wsi, enum lws_callback_reasons reason, void _user, void in, size_t len){ ^ orange_ws_server.c:130:12: error: function declaration isn't a prototype [-Werror=strict-prototypes] static int _orange_socket_callback(struct lws wsi, enum lws_callback_reasons reason, void _user, void in, size_t len){ ^ orange_ws_server.c: In function '_orange_socket_callback': orange_ws_server.c:132:15: error: implicit declaration of function 'lws_get_protocol' [-Werror=implicit-function-declaration] const struct lws_protocols proto = lws_get_protocol(wsi); ^ orange_ws_server.c:132:15: error: nested extern declaration of 'lws_get_protocol' [-Werror=nested-externs] orange_ws_server.c:132:38: error: initialization makes pointer from integer without a cast [-Werror] const struct lws_protocols proto = lws_get_protocol(wsi); ^ orange_ws_server.c:141:2: error: implicit declaration of function 'lws_get_socket_fd' [-Werror=implicit-function-declaration] int32_t peer_id = lws_get_socket_fd(wsi); ^ orange_ws_server.c:141:2: error: nested extern declaration of 'lws_get_socket_fd' [-Werror=nested-externs] orange_ws_server.c:144:61: error: dereferencing pointer to incomplete type struct orange_srv_ws *self = (struct orange_srvws)proto->user; ^ orange_ws_server.c:150:4: error: implicit declaration of function 'lws_get_peer_addresses' [-Werror=implicit-function-declaration] lws_get_peer_addresses(wsi, peer_id, hostname, sizeof(hostname), ipaddr, sizeof(ipaddr)); ^ orange_ws_server.c:150:4: error: nested extern declaration of 'lws_get_peer_addresses' [-Werror=nested-externs] orange_ws_server.c:155:4: error: implicit declaration of function 'lws_callback_on_writable' [-Werror=implicit-function-declaration] lws_callback_on_writable(wsi);

^ orange_ws_server.c:155:4: error: nested extern declaration of 'lws_callback_on_writable' [-Werror=nested-externs] orange_ws_server.c:163:61: error: dereferencing pointer to incomplete type struct orange_srv_ws _self = (struct orange_srvws)proto->user; ^ orange_ws_server.c:173:61: error: dereferencing pointer to incomplete type struct orange_srv_ws _self = (struct orange_srvws)proto->user; ^ orange_ws_server.c:194:6: error: implicit declaration of function 'lws_write' [-Werror=implicit-function-declaration] int n = lws_write(wsi, &frame->buf[LWS_SENDBUFFER PRE_PADDING]+frame->sent_count, towrite, flags); ^ orange_ws_server.c:194:6: error: nested extern declaration of 'lws_write' [-Werror=nested-externs] orange_ws_server.c:206:5: error: implicit declaration of function 'lws_partial_buffered' [-Werror=implicit-function-declaration] } while(frame->sent_count < frame->len && !lws_partial_buffered(wsi));

^ orange_ws_server.c:206:5: error: nested extern declaration of 'lws_partial_buffered' [-Werror=nested-externs] orange_ws_server.c:230:61: error: dereferencing pointer to incomplete type struct orange_srv_ws _self = (struct orange_srvws)proto->user; ^ orange_ws_server.c:238:4: error: implicit declaration of function 'lws_is_final_fragment' [-Werror=implicit-function-declaration] if(lws_is_final_fragment(wsi)){ ^ orange_ws_server.c:238:4: error: nested extern declaration of 'lws_is_final_fragment' [-Werror=nested-externs] orange_ws_server.c: In function '_websocket_destroy': orange_ws_server.c:313:2: error: implicit declaration of function 'lws_context_destroy' [-Werror=implicit-function-declaration] if(self->ctx) lws_context_destroy(self->ctx); ^ orange_ws_server.c:313:2: error: nested extern declaration of 'lws_context_destroy' [-Werror=nested-externs] orange_ws_server.c: In function '_find_interface_from_ip': orange_ws_server.c:350:14: error: 'NI_MAXHOST' undeclared (first use in this function) char host[NI_MAXHOST+1];

^ orange_ws_server.c:350:14: note: each undeclared identifier is reported only once for each function it appears in orange_ws_server.c:351:4: error: implicit declaration of function 'getnameinfo' [-Werror=implicit-function-declaration] int s = getnameinfo(iap->ifa_addr, ^ orange_ws_server.c:351:4: error: nested extern declaration of 'getnameinfo' [-Werror=nested-externs] orange_ws_server.c:355:17: error: 'NI_NUMERICHOST' undeclared (first use in this function) NULL, 0, NI_NUMERICHOST); ^ orange_ws_server.c:357:7: error: implicit declaration of function 'gai_strerror' [-Werror=implicit-function-declaration] printf("getnameinfo() failed: %s\n", gai_strerror(s)); ^ orange_ws_server.c:357:7: error: nested extern declaration of 'gai_strerror' [-Werror=nested-externs] orange_ws_server.c:357:7: error: format '%s' expects argument of type 'char

_', but argument 2 has type 'int' [-Werror=format=] orange_ws_server.c: In function '_websocket_listen': orange_ws_server.c:397:17: error: assignment from incompatible pointer type [-Werror] info.protocols = self->protocols; ^ orange_ws_server.c:399:17: error: 'LWS_SERVER_OPTION_VALIDATE_UTF8' undeclared (first use in this function) info.options = LWS_SERVER_OPTION_VALIDATE_UTF8; ^ orange_ws_server.c:402:2: error: implicit declaration of function 'lws_create_context' [-Werror=implicit-function-declaration] self->ctx = lws_create_context(&info); ^ orange_ws_server.c:402:2: error: nested extern declaration of 'lws_create_context' [-Werror=nested-externs] orange_ws_server.c:402:12: error: assignment makes pointer from integer without a cast [-Werror] self->ctx = lws_create_context(&info); ^ orange_ws_server.c: In function '_websocket_server_thread': orange_ws_server.c:430:4: error: implicit declaration of function 'lws_service' [-Werror=implicit-function-declaration] lws_service(self->ctx, 10); ^ orange_ws_server.c:430:4: error: nested extern declaration of 'lws_service' [-Werror=nested-externs] orange_ws_server.c: In function 'orange_ws_server_new': orange_ws_server.c:532:37: error: invalid application of 'sizeof' to incomplete type 'struct lws_protocols' self->protocols = calloc(2, sizeof(struct lws_protocols)); ^ orange_ws_server.c:534:2: error: invalid use of undefined type 'struct lws_protocols' self->protocols[0] = (struct lws_protocols){ ^ orange_ws_server.c:534:17: error: dereferencing pointer to incomplete type self->protocols[0] = (struct lws_protocols){ ^ orange_ws_server.c:535:3: error: unknown field 'name' specified in initializer .name = "rpc", ^ orange_ws_server.c:535:3: error: excess elements in struct initializer [-Werror] orange_ws_server.c:535:3: error: (near initialization for '(anonymous)') [-Werror] orange_ws_server.c:536:3: error: unknown field 'callback' specified in initializer .callback = _orange_socket_callback, ^ orange_ws_server.c:536:3: error: excess elements in struct initializer [-Werror] orange_ws_server.c:536:3: error: (near initialization for '(anonymous)') [-Werror] orange_ws_server.c:537:3: error: unknown field 'per_session_data_size' specified in initializer .per_session_data_size = sizeof(struct orange_srv_wsclient), ^ orange_ws_server.c:537:42: error: excess elements in struct initializer [-Werror] .per_session_data_size = sizeof(struct orange_srv_ws_client

_), ^ orange_ws_server.c:537:42: error: (near initialization for '(anonymous)') [-Werror] orange_ws_server.c:538:3: error: unknown field 'user' specified in initializer .user = self ^ orange_ws_server.c:539:2: error: excess elements in struct initializer [-Werror] }; ^ orange_ws_server.c:539:2: error: (near initialization for '(anonymous)') [-Werror] orange_ws_server.c:539:2: error: invalid use of undefined type 'struct lwsprotocols' cc1: all warnings being treated as errors make[5]: ** [liborange_la-orange_ws_server.lo] Error 1

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mkschreder/orangerpcd/issues/10, or mute the thread https://github.com/notifications/unsubscribe-auth/AERqib_cStFX_3DLpODfiYucmHkB7d0zks5qs2sTgaJpZM4KEow7 .

jacksun101 commented 7 years ago

@Pillar1989 Would you please share how to fix this? I am facing the same issue when building Respeaker openwrt image.

mkschreder commented 7 years ago

You need to use latest version of libwebsocket. Whatever version you have does not have lws_* methods. The correct version of libwebsockets can be found in the juci feed. For proper override of the default package install juci feed first before installing any openwrt feeds.

On 9 Apr 2017 04:16, "Jack Sun" notifications@github.com wrote:

@Pillar1989 https://github.com/Pillar1989 Would you please share how to fix this? I am facing the same issue when building Respeaker openwrt image.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/mkschreder/orangerpcd/issues/10#issuecomment-292758926, or mute the thread https://github.com/notifications/unsubscribe-auth/AERqiZyx3-e8QyQITiiQ3NwEjspS1-rEks5ruD9igaJpZM4KEow7 .