[Libwebsockets] ld symbols missing in libwebsocket.a

Andy Green andy at warmcat.com
Fri Mar 27 13:39:17 CET 2015



On 27 March 2015 18:30:22 GMT+08:00, Jeffrey Zhao <chunyong.zhao at qq.com> wrote:
>Dear Sir
>Could you help on how solve below symbol missing issue?
>It seems the libwebsockets doesn't include all the necessary symbols in
>the library.

Well... it seems your app doesn't link lws library more like.

Your makefile looks kind of confused you try to link with $(CC) and afterwards you use gcc to compile your app?

Can you build the test apps okay?

If so your make-fu needs more care I think.

-Andy

>Thank you  very much.
>
>
>
>
>
>
>content of makefile:
>#--------------------------------------------------------------------------------------------
>CC = gcc
>CFLAGS  = -lpthread -Wall -s -o2
>#CFLAGS  = -lpthread -Wall -g -o2
>LIBS = "-L/Users/blue/Downloads/libwebsockets/libwebsockets/build/lib/"
>
>
>all : clean test-server
>
>
>
>
>
>
>test-server:test-server.c
>  $(CC) $(CFLAGS) $^ -o $@ -lwebsockets $(LIBS)
>  gcc test-server.c
>
>
>
>
>
>
>clean :
>  rm -rf *.o test-server
>
>
>#--------------------------------------------------------------------------------------------
>
>
>
>
>blue$ make
>rm -rf *.o test-server
>gcc -lpthread -Wall -s -o2 test-server.c -o test-server -lwebsockets
>"-L/Users/zhchunyo/Downloads/Mambore_test/libwebsockets/build/lib/"
>ld: warning: option -s is obsolete and being ignored
>gcc test-server.c
>Undefined symbols for architecture x86_64:
>  "__lws_log", referenced from:
>      _main in test-server-07b887.o
>      _callback_http in test-server-07b887.o
>      _callback_test in test-server-07b887.o
>      _callback_dumb_increment in test-server-07b887.o
>      _callback_lws_mirror in test-server-07b887.o
>  "_libwebsocket_callback_on_writable", referenced from:
>      _callback_http in test-server-07b887.o
>      _callback_test in test-server-07b887.o
>      _callback_lws_mirror in test-server-07b887.o
>  "_libwebsocket_callback_on_writable_all_protocol", referenced from:
>      _main in test-server-07b887.o
>      _callback_lws_mirror in test-server-07b887.o
>  "_libwebsocket_cancel_service", referenced from:
>      _sighandler in test-server-07b887.o
>  "_libwebsocket_context_destroy", referenced from:
>      _main in test-server-07b887.o
>  "_libwebsocket_create_context", referenced from:
>      _main in test-server-07b887.o
>  "_libwebsocket_get_internal_extensions", referenced from:
>      _main in test-server-07b887.o
>  "_libwebsocket_rx_flow_allow_all_protocol", referenced from:
>      _callback_lws_mirror in test-server-07b887.o
>  "_libwebsocket_rx_flow_control", referenced from:
>      _callback_lws_mirror in test-server-07b887.o
>  "_libwebsocket_service", referenced from:
>      _main in test-server-07b887.o
>  "_libwebsocket_set_timeout", referenced from:
>      _callback_http in test-server-07b887.o
>  "_libwebsocket_write", referenced from:
>      _callback_http in test-server-07b887.o
>      _callback_test in test-server-07b887.o
>      _callback_dumb_increment in test-server-07b887.o
>      _callback_lws_mirror in test-server-07b887.o
>  "_libwebsockets_get_protocol", referenced from:
>      _callback_lws_mirror in test-server-07b887.o
>  "_libwebsockets_return_http_status", referenced from:
>      _callback_http in test-server-07b887.o
>  "_libwebsockets_serve_http_file", referenced from:
>      _callback_http in test-server-07b887.o
>  "_lws_add_http_header_by_name", referenced from:
>      _callback_http in test-server-07b887.o
>  "_lws_add_http_header_by_token", referenced from:
>      _callback_http in test-server-07b887.o
>  "_lws_add_http_header_content_length", referenced from:
>      _callback_http in test-server-07b887.o
>  "_lws_add_http_header_status", referenced from:
>      _callback_http in test-server-07b887.o
>  "_lws_daemonize", referenced from:
>      _main in test-server-07b887.o
>  "_lws_finalize_http_header", referenced from:
>      _callback_http in test-server-07b887.o
>  "_lws_get_peer_write_allowance", referenced from:
>      _callback_http in test-server-07b887.o
>  "_lws_hdr_copy", referenced from:
>      _dump_handshake_info in test-server-07b887.o
>  "_lws_hdr_total_length", referenced from:
>      _callback_http in test-server-07b887.o
>      _dump_handshake_info in test-server-07b887.o
>  "_lws_http_transateston_completed", referenced from:
>      _callback_http in test-server-07b887.o
>  "_lws_partial_buffered", referenced from:
>      _callback_http in test-server-07b887.o
>      _callback_lws_mirror in test-server-07b887.o
>  "_lws_send_pipe_choked", referenced from:
>      _callback_http in test-server-07b887.o
>      _callback_lws_mirror in test-server-07b887.o
>  "_lws_set_log_level", referenced from:
>      _main in test-server-07b887.o
>  "_lws_token_to_string", referenced from:
>      _dump_handshake_info in test-server-07b887.o
>  "_lwsl_emit_syslog", referenced from:
>      _main in test-server-07b887.o
>ld: symbol(s) not found for architecture x86_64
>clang: error: linker command failed with exit code 1 (use -v to see
>invocation)
>make: *** [test-server] Error 1
>blue$‍
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list