[Libwebsockets] build from repo fails

Felipe Gasper felipe at felipegasper.com
Mon Jun 7 01:45:33 CEST 2021



> On Jun 6, 2021, at 11:58 AM, Andy Green <andy at warmcat.com> wrote:
> 
> 
> 
> On June 6, 2021 2:26:15 PM GMT+01:00, Felipe Gasper <felipe at felipegasper.com> wrote:
>> Hello,
>> 
>> 	I’m trying to build from the upstream git, but I see this:
>> 
>> -----
>> Scanning dependencies of target websockets_shared
>> [  1%] Building C object
>> lib/CMakeFiles/websockets_shared.dir/plat/unix/unix-caps.c.o
>> In file included from
>> /Users/felipe/code/libwebsockets/lib/plat/unix/unix-caps.c:28:
>> In file included from
>> /Users/felipe/code/libwebsockets/lib/core/./private-lib-core.h:140:
>> In file included from
>> /Users/felipe/code/libwebsockets/include/libwebsockets.h:643:
>> /Users/felipe/code/libwebsockets/include/libwebsockets/lws-genhash.h:85:18:
>> error:
>>     field has incomplete type 'HMAC_CTX' (aka 'struct hmac_ctx_st')
>>       HMAC_CTX ctx;
>>                ^
>> /opt/local/include/openssl/ossl_typ.h:102:16: note: forward declaration
>> of
>>     'struct hmac_ctx_st'
>> typedef struct hmac_ctx_st HMAC_CTX;
>>              ^
>> 1 error generated.
>> make[2]: ***
>> [lib/CMakeFiles/websockets_shared.dir/plat/unix/unix-caps.c.o] Error 1
>> make[1]: *** [lib/CMakeFiles/websockets_shared.dir/all] Error 2
>> make: *** [all] Error 2
>> -----
>> 
>> My OpenSSL is OpenSSL 1.1.1k  (25 Mar 2021), and I’m on macOS Mojave.
> 
> That's not related to lws but cmake checking what's in your openssl apis.  Have a look at the second part of this
> 
> https://libwebsockets.org/git/libwebsockets/tree/READMEs/README.cmake.md
> 
> Lws is built in CI on M1 and intel macs every push, eg
> 
> https://libwebsockets.org/sai/index.html?task=62057d13492745f360c7e035ea8ff3ae74951508a5fdcbfeb7caba0d7ce58f52
> 
> You can see how it configured cmake... you need something similar
> 
> cmake .. -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DLWS_OPENSSL_INCLUDE_DIRS=/usr/local/opt/openssl at 1.1/include '-DLWS_OPENSSL_LIBRARIES=/usr/local/opt/openssl/lib/libssl.dylib;/usr/local/opt/openssl/lib/libcrypto.dylib'

Ah ok. Thank you--this made it work:

cmake .. -DLWS_OPENSSL_INCLUDE_DIRS=/opt/local/include '-DLWS_OPENSSL_LIBRARIES=/opt/local/lib/libssl.dylib;/opt/local/lib/libcrypto.dylib'

It seems strange, though, that this doesn’t “just work” given that pkg-config does identify the right stuff:

> pkg-config openssl --libs
-L/opt/local/lib -lssl -lcrypto

> pkg-config openssl --cflags
-I/opt/local/include

Is there maybe an upstream issue with cmake?

-FG



More information about the Libwebsockets mailing list