[Libwebsockets] 回复: Re: 回复: Static Link issue

Jeffrey Zhao chunyong.zhao at qq.com
Sun Mar 29 07:00:06 CEST 2015


Dear Sir
Here is the result based on your idea.




gcc -lpthread -Wall -o2 test-server.c /Users/blue/Downloads/libwebsockets/libwebsockets/build/lib/libwebsockets.a -o test-server
Undefined symbols for architecture x86_64:
  "_BIO_ctrl", referenced from:
      _lws_client_socket_service in libwebsockets.a(client.c.o)
      _lws_server_socket_service_ssl in libwebsockets.a(ssl.c.o)
  "_BIO_new_socket", referenced from:
      _lws_client_socket_service in libwebsockets.a(client.c.o)
  "_CRYPTO_cleanup_all_ex_data", referenced from:
      _lws_ssl_destroy in libwebsockets.a(ssl.c.o)
      _lws_ssl_context_destroy in libwebsockets.a(ssl.c.o)
  "_ERR_error_string", referenced from:
      _lws_client_socket_service in libwebsockets.a(client.c.o)
      _lws_context_init_server_ssl in libwebsockets.a(ssl.c.o)
      _lws_context_init_client_ssl in libwebsockets.a(ssl.c.o)
      _lws_server_socket_service_ssl in libwebsockets.a(ssl.c.o)
  "_ERR_error_string_n", referenced from:
      _libwebsockets_decode_ssl_error in libwebsockets.a(ssl.c.o)
  "_ERR_free_strings", referenced from:
      _lws_ssl_destroy in libwebsockets.a(ssl.c.o)
      _lws_ssl_context_destroy in libwebsockets.a(ssl.c.o)
  "_ERR_get_error", referenced from:
      _lws_client_socket_service in libwebsockets.a(client.c.o)
      _lws_context_init_server_ssl in libwebsockets.a(ssl.c.o)
      _libwebsockets_decode_ssl_error in libwebsockets.a(ssl.c.o)
      _lws_context_init_client_ssl in libwebsockets.a(ssl.c.o)
  "_ERR_remove_state", referenced from:
      _lws_ssl_destroy in libwebsockets.a(ssl.c.o)
      _lws_ssl_context_destroy in libwebsockets.a(ssl.c.o)
  "_EVP_cleanup", referenced from:
      _lws_ssl_destroy in libwebsockets.a(ssl.c.o)
      _lws_ssl_context_destroy in libwebsockets.a(ssl.c.o)
  "_OPENSSL_add_all_algorithms_noconf", referenced from:
      _lws_context_init_server_ssl in libwebsockets.a(ssl.c.o)
      _lws_context_init_client_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_CTX_check_private_key", referenced from:
      _lws_context_init_server_ssl in libwebsockets.a(ssl.c.o)
      _lws_context_init_client_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_CTX_ctrl", referenced from:
      _lws_context_init_server_ssl in libwebsockets.a(ssl.c.o)
      _lws_context_init_client_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_CTX_free", referenced from:
      _lws_ssl_destroy in libwebsockets.a(ssl.c.o)
      _lws_ssl_context_destroy in libwebsockets.a(ssl.c.o)
  "_SSL_CTX_load_verify_locations", referenced from:
      _lws_context_init_client_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_CTX_new", referenced from:
      _lws_context_init_server_ssl in libwebsockets.a(ssl.c.o)
      _lws_context_init_client_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_CTX_set_cipher_list", referenced from:
      _lws_context_init_server_ssl in libwebsockets.a(ssl.c.o)
      _lws_context_init_client_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_CTX_set_default_passwd_cb", referenced from:
      _lws_ssl_bind_passphrase in libwebsockets.a(ssl.c.o)
  "_SSL_CTX_set_default_passwd_cb_userdata", referenced from:
      _lws_ssl_bind_passphrase in libwebsockets.a(ssl.c.o)
  "_SSL_CTX_set_default_verify_paths", referenced from:
      _lws_context_init_client_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_CTX_set_verify", referenced from:
      _lws_context_init_server_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_CTX_use_PrivateKey_file", referenced from:
      _lws_context_init_server_ssl in libwebsockets.a(ssl.c.o)
      _lws_context_init_client_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_CTX_use_certificate_chain_file", referenced from:
      _lws_context_init_server_ssl in libwebsockets.a(ssl.c.o)
      _lws_context_init_client_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_accept", referenced from:
      _lws_server_socket_service_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_connect", referenced from:
      _lws_client_socket_service in libwebsockets.a(client.c.o)
  "_SSL_ctrl", referenced from:
      _lws_client_socket_service in libwebsockets.a(client.c.o)
      _lws_server_socket_service_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_free", referenced from:
      _lws_ssl_close in libwebsockets.a(ssl.c.o)
      _lws_server_socket_service_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_get_error", referenced from:
      _lws_client_socket_service in libwebsockets.a(client.c.o)
      _lws_ssl_capable_read in libwebsockets.a(ssl.c.o)
      _lws_ssl_capable_write in libwebsockets.a(ssl.c.o)
      _lws_server_socket_service_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_get_ex_data", referenced from:
      _OpenSSL_verify_callback in libwebsockets.a(ssl.c.o)
  "_SSL_get_ex_data_X509_STORE_CTX_idx", referenced from:
      _OpenSSL_verify_callback in libwebsockets.a(ssl.c.o)
  "_SSL_get_ex_new_index", referenced from:
      _lws_context_init_server_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_get_fd", referenced from:
      _lws_ssl_close in libwebsockets.a(ssl.c.o)
  "_SSL_get_rbio", referenced from:
      _lws_server_socket_service_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_get_verify_result", referenced from:
      _lws_client_socket_service in libwebsockets.a(client.c.o)
  "_SSL_get_wbio", referenced from:
      _lws_server_socket_service_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_library_init", referenced from:
      _lws_context_init_server_ssl in libwebsockets.a(ssl.c.o)
      _lws_context_init_client_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_load_error_strings", referenced from:
      _lws_context_init_server_ssl in libwebsockets.a(ssl.c.o)
      _lws_context_init_client_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_new", referenced from:
      _lws_client_socket_service in libwebsockets.a(client.c.o)
      _lws_server_socket_service_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_pending", referenced from:
      _lws_ssl_capable_read in libwebsockets.a(ssl.c.o)
  "_SSL_read", referenced from:
      _lws_ssl_capable_read in libwebsockets.a(ssl.c.o)
  "_SSL_set_bio", referenced from:
      _lws_client_socket_service in libwebsockets.a(client.c.o)
  "_SSL_set_ex_data", referenced from:
      _lws_client_socket_service in libwebsockets.a(client.c.o)
      _lws_server_socket_service_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_set_fd", referenced from:
      _lws_server_socket_service_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_shutdown", referenced from:
      _lws_ssl_close in libwebsockets.a(ssl.c.o)
      _lws_server_socket_service_ssl in libwebsockets.a(ssl.c.o)
  "_SSL_write", referenced from:
      _lws_ssl_capable_write in libwebsockets.a(ssl.c.o)
  "_SSLv23_client_method", referenced from:
      _lws_context_init_client_ssl in libwebsockets.a(ssl.c.o)
  "_SSLv23_server_method", referenced from:
      _lws_context_init_server_ssl in libwebsockets.a(ssl.c.o)
  "_X509_STORE_CTX_get_ex_data", referenced from:
      _OpenSSL_verify_callback in libwebsockets.a(ssl.c.o)
  "_deflate", referenced from:
      _lws_extension_callback_deflate_frame in libwebsockets.a(extension-deflate-frame.c.o)
     (maybe you meant: _lws_extension_callback_deflate_frame)
  "_deflateEnd", referenced from:
      _lws_extension_callback_deflate_frame in libwebsockets.a(extension-deflate-frame.c.o)
  "_deflateInit2_", referenced from:
      _lws_extension_callback_deflate_frame in libwebsockets.a(extension-deflate-frame.c.o)
  "_inflate", referenced from:
      _lws_extension_callback_deflate_frame in libwebsockets.a(extension-deflate-frame.c.o)
  "_inflateEnd", referenced from:
      _lws_extension_callback_deflate_frame in libwebsockets.a(extension-deflate-frame.c.o)
  "_inflateInit2_", referenced from:
      _lws_extension_callback_deflate_frame in libwebsockets.a(extension-deflate-frame.c.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‍

------------------ 原始邮件 ------------------
发件人: "Andy Green";<andy at warmcat.com>;
发送时间: 2015年3月29日(星期天) 中午12:48
收件人: "Jeffrey Zhao"<chunyong.zhao at qq.com>; "libwebsockets at ml.libwebsockets."<libwebsockets at ml.libwebsockets.org>; 

主题:  Re: 回复: [Libwebsockets] Static Link issue





On 29 March 2015 12:29:19 GMT+08:00, Jeffrey Zhao <chunyong.zhao at qq.com> wrote:
>Dear Andy
>For some reasons, we need to use static link.

Have you tried explicitly giving it the libwebsockets.a file instead of -l?

>Could you tell me more details regarding clang list?

Google found this

http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users

I have no idea if your question is inappropriate there.

-Andy

>
>
>
>Thanks.
>
>
>
>
>
>
>------------------ 原始邮件 ------------------
>发件人: "Andy Green";<andy at warmcat.com>;
>发送时间: 2015年3月28日(星期六) 上午6:58
>收件人: "Jeffrey Zhao"<chunyong.zhao at qq.com>;
>"libwebsockets at ml.libwebsockets."<libwebsockets at ml.libwebsockets.org>; 
>
>主题: Re: [Libwebsockets] Static Link issue
>
>
>
>
>
>On 27 March 2015 21:22:50 GMT+08:00, Jeffrey Zhao
><chunyong.zhao at qq.com> wrote:
>>Dear Sir
>>When I do the static link with libwebsockets, it indicates that crt0.o
>>is not found.
>>Any suggestion here?
>
>It's not a question about lws.  crt0 is C Runtime Library.  Maybe try a
>clang list.
>
>Or, don't static link...
>
>-Andy
>
>>
>>thank you in advance.
>>
>>
>>
>>
>>
>>
>>gcc -lpthread -Wall -o2 test-server.c -o test-server -static
>>-lwebsockets
>>-L/Users/blue/Downloads/libwebsockets‍/libwebsockets/build/lib/
>>ld: library not found for -lcrt0.o
>>clang: error: linker command failed with exit code 1 (use -v to see
>>invocation)
>>make: *** [cti-server] Error 1‍
>>
>>------------------------------------------------------------------------
>>
>>_______________________________________________
>>Libwebsockets mailing list
>>Libwebsockets at ml.libwebsockets.org
>>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20150329/3facccb1/attachment-0001.html>


More information about the Libwebsockets mailing list