[Libwebsockets] Problems building with libuv

Sean Martin sean.martin at mmbnetworks.com
Mon Apr 24 22:15:10 CEST 2017


Hey hopefully this is the right place to ask.

I'm trying to build a quick and dirty websockets server based on the
example code. I had already done so for a client, but this time I decided
it makes sense to start incorporating the libuv library.

I received the following Undefined symbols error.

Undefined symbols for architecture x86_64:

  "_lws_libuv_run", referenced from:

      _mmbc_startup_server in libmmbwebsocketapp-mmb-connection.o

  "_lws_uv_getloop", referenced from:

      _mmbc_startup_server in libmmbwebsocketapp-mmb-connection.o

  "_lws_uv_initloop", referenced from:

      _mmbc_startup_server in libmmbwebsocketapp-mmb-connection.o

  "_lws_uv_sigint_cfg", referenced from:

      _mmbc_startup_server in libmmbwebsocketapp-mmb-connection.o

ld: symbol(s) not found for architecture x86_64

clang: *error: *linker command failed with exit code 1 (use -v to see
invocation)
I think I just have to rebuild the libwebsockets library itself with the
LWS_USE_LIBUV defined so that all the relevant symbols get built in.
However I am having problems getting libuv to build into the libwebsockets
library.

Following the readme instructions I end up calling
cmake .. -DLWS_USE_LIBUV=1

Which works and then I call 'make' which results in the library being built
but the follow up targets fail.

*Scanning dependencies of target websockets*

[  1%] Building C object CMakeFiles/websockets.dir/lib/base64-decode.c.o

[  2%] Building C object CMakeFiles/websockets.dir/lib/handshake.c.o

[  4%] Building C object CMakeFiles/websockets.dir/lib/libwebsockets.c.o

[  5%] Building C object CMakeFiles/websockets.dir/lib/service.c.o

[  6%] Building C object CMakeFiles/websockets.dir/lib/pollfd.c.o

[  8%] Building C object CMakeFiles/websockets.dir/lib/output.c.o

[  9%] Building C object CMakeFiles/websockets.dir/lib/parsers.c.o

[ 10%] Building C object CMakeFiles/websockets.dir/lib/context.c.o

[ 12%] Building C object CMakeFiles/websockets.dir/lib/alloc.c.o

[ 13%] Building C object CMakeFiles/websockets.dir/lib/header.c.o

[ 14%] Building C object CMakeFiles/websockets.dir/lib/client.c.o

[ 16%] Building C object CMakeFiles/websockets.dir/lib/client-handshake.c.o

[ 17%] Building C object CMakeFiles/websockets.dir/lib/client-parser.c.o

[ 18%] Building C object CMakeFiles/websockets.dir/lib/ssl.c.o

[ 20%] Building C object CMakeFiles/websockets.dir/lib/ssl-server.c.o

[ 21%] Building C object CMakeFiles/websockets.dir/lib/ssl-client.c.o

[ 22%] Building C object CMakeFiles/websockets.dir/lib/sha-1.c.o

[ 24%] Building C object CMakeFiles/websockets.dir/lib/lws-plat-unix.c.o

[ 25%] Building C object CMakeFiles/websockets.dir/lib/server.c.o

[ 27%] Building C object CMakeFiles/websockets.dir/lib/server-handshake.c.o

[ 28%] Building C object CMakeFiles/websockets.dir/lib/extension.c.o

[ 29%] Building C object
CMakeFiles/websockets.dir/lib/extension-permessage-deflate.c.o

[ 31%] Building C object CMakeFiles/websockets.dir/lib/ranges.c.o

[ 32%] Building C object CMakeFiles/websockets.dir/lib/fops-zip.c.o

[ 33%] *Linking C static library lib/libwebsockets.a*

[ 33%] Built target websockets

[ 35%] *Linking C executable bin/libwebsockets-test-server-extpoll*

Undefined symbols for architecture x86_64:

  "_lws_feature_status_libuv", referenced from:

      _lws_create_context in libwebsockets.a(context.c.o)

  "_lws_libuv_accept", referenced from:

      _lws_client_connect_2 in libwebsockets.a(client-handshake.c.o)

      _lws_adopt_descriptor_vhost in libwebsockets.a(server.c.o)

  "_lws_libuv_closehandle", referenced from:

      _lws_close_free_wsi in libwebsockets.a(libwebsockets.c.o)

  "_lws_libuv_destroyloop", referenced from:

      _lws_context_destroy in libwebsockets.a(context.c.o)

  "_lws_libuv_init_fd_table", referenced from:

      _lws_plat_init in libwebsockets.a(lws-plat-unix.c.o)

  "_lws_libuv_io", referenced from:

      __lws_change_pollfd in libwebsockets.a(pollfd.c.o)

      _remove_wsi_socket_from_fds in libwebsockets.a(pollfd.c.o)

      _lws_plat_insert_socket_into_fds in libwebsockets.a(lws-plat-unix.c.o)

      _lws_plat_delete_socket_from_fds in libwebsockets.a(lws-plat-unix.c.o)

  "_lws_libuv_run", referenced from:

      __lws_plat_service_tsi in libwebsockets.a(lws-plat-unix.c.o)

  "_lws_uv_initvhost", referenced from:

      _lws_context_init_server in libwebsockets.a(server.c.o)

  "_lws_uv_sigint_cb", referenced from:

      _lws_create_context in libwebsockets.a(context.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[2]: *** [bin/libwebsockets-test-server-extpoll] Error 1

make[1]: *** [CMakeFiles/test-server-extpoll.dir/all] Error 2

make: *** [all] Error 2

I'm sure I'm just missing something simple, but I've spent enough time on
this and have to just move on so just reaching out to see if there is a
quick fix as I'd much rather use established libraries than rebuilding
those features myself.

Thanks


-- 
*Sean Martin*
Lead QA Developer

E *sean.martin at mmbnetworks.com <sean.martin at mmbnetworks.com>*
T 416.636.3145 x 216
<http://ca.linkedin.com/in/dmoneta>
*MMB* Networks
243 College St., Suite 500
Toronto, ON, Canada M5T1R5
www.mmbnetworks.com

<http://www.mmbresearch.com/>
NOTICE: MMB Networks is a division of MMB Research Inc. This message and
all attachments are confidential and may be privileged or otherwise
protected from disclosure, and are intended only for the use of the
individual and/or entity identified in the alias address of this message.
No rights to privilege have been waived. If you are not the intended
recipient or an employee or agent responsible to deliver it to the intended
recipient, you must not copy or distribute this message or attachment or
disclose the contents to any other person. If you have received this
message in error, please telephone or email the sender immediately and
delete this message and any attachment from your system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20170424/712af231/attachment-0001.html>


More information about the Libwebsockets mailing list