[Libwebsockets] Compilation error

Andy Green andy at warmcat.com
Fri Jul 23 05:16:07 CEST 2021



On 7/23/21 12:22 AM, Steve Calfee wrote:

> Is that an option for Cmake or make? What other generally useful options 
> are there?

CMake, lws doesn't come with Makefile and depending on your platform and 
generator, CMake may not even create one.

> Also, can I get a non-root (/etc/...) accessible conf dir for lwsws? 
> Useful for testing, I think.

There is already a -c /what/ever option on lwsws commandline where you 
can override the default of /etc/lwsws to /what/ever.  You won't be able 
to configure it to listen on ports < 1024 without starting it as root.

> I know cmake makes crossplatform builds easier, but adds a level of 
> indirection that I don't exactly understand. I am building on linux mint.

No, anything nontrivial needs one build system or another.  The only 
question is if it's some rotting customized hack or a generic way that 
other people are already familiar with.

After banging my head on autotools and trying to handle windows as its 
own VS-only thing, CMake blew away many problems, like a supportable 
story for generic cross-build, working with MSVC and the other 
toolchains too on windows, understanding OSX quirks, allowing clean lws 
integration into outer CMake project builds, and allowing the CI tests 
to run cross-platform via CTest instead of bash scripts.

You don't need to understand much to use it rather than develop on it, 
getting familiar with that will certainly pay you back the time tenfold.

-Andy

> Thanks, Steve
> 
> 
> 
> On Wed, Jul 21, 2021 at 9:19 PM Andy Green <andy at warmcat.com 
> <mailto:andy at warmcat.com>> wrote:
> 
> 
> 
>     On 7/21/21 9:46 PM, loic nicolas wrote:
>      > Good evening,
>      >
>      > I get this error when I try to run one of the examples:
>      >
>      > |1> main.obj: error LNK2001: unresolved external symbol
>      > _lws_retry_sul_schedule_retry_wsi 1> main.obj: error LNK2001:
>     unresolved
>      > external symbol _lws_retry_sul_schedule 1> main.obj: error LNK2001:
>      > unresolved external symbol _lws_get_context 1> main.obj: error
>     LNK2001:
>      > unresolved external symbol _lws_extension_callback_pm_deflate 1>
>      > main.obj: error LNK2001: unresolved external symbol _lws_strncpy 1>
>      > main.obj: error LNK2001: unresolved external symbol
>      > _lws_callback_http_dummy 1> main.obj: error LNK2001: unresolved
>     external
>      > symbol _lws_service 1> main.obj: error LNK2001: unresolved external
>      > symbol _lws_sul_schedule 1> main.obj: error LNK2001: unresolved
>     external
>      > symbol __lws_log 1> main.obj: error LNK2001: unresolved external
>     symbol
>      > _lws_sul_cancel 1> main.obj: error LNK2001: unresolved external
>     symbol
>      > _lws_context_destroy 1> main.obj: error LNK2001: unresolved external
>      > symbol _lws_create_context 1> main.obj: error LNK2001: unresolved
>      > external symbol _lws_cmdline_option_handle_builtin 1> main.obj:
>     error
>      > LNK2001: unresolved external symbol _lws_json_simple_find |
>      >
>      > I compiled the library using visual studio 2019 and i have link
>      > websockets.lib
>      > How to deal with this problem please?
> 
>     You seem to be building something and not linking the libwebsockets
>     library binary to it.
> 
>     If you just want to build the examples, you can build all that apply to
>     your library build options with -DLWS_WITH_MINIMAL_EXAMPLES=1 when you
>     build the library.
> 
>     Otherwise use vc to tell it to also link to lws library.
> 
>     -Andy
> 
>     _______________________________________________
>     Libwebsockets mailing list
>     Libwebsockets at ml.libwebsockets.org
>     <mailto:Libwebsockets at ml.libwebsockets.org>
>     https://libwebsockets.org/mailman/listinfo/libwebsockets
>     <https://libwebsockets.org/mailman/listinfo/libwebsockets>
> 


More information about the Libwebsockets mailing list