[Libwebsockets] working with wolfssl

Andy Green andy at warmcat.com
Mon May 10 15:41:29 CEST 2021

On 5/10/21 2:25 PM, Trey Weaver wrote:
> When I do a straight up:
> *cmake ..*
> *make*
> everything goes fine.  But when I try to add the wolfssl stuff like this:
> -DLWS_WOLFSSL_INCLUDE_DIRS=/home/jps/Temp/wolfssh.headers 
> -DLWS_WOLFSSL_LIBRARIES=/usr/share/jps-audioproc-third-party/wolfssl/lib/libwolfssl.a 
> ..
> just like the build notes say to do and then do a make then I get this 
> error:
> *jps at dsp:~/Development/libwebsockets-4.2/libwebsockets/build$ make*
> *Scanning dependencies of target GENHDR*
> *[  0%] Creating build include dir*
> *[  0%] Built target GENHDR*
> *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 
> /home/jps/Development/libwebsockets-4.2/libwebsockets/include/libwebsockets.h:642,*
> *                 from 
> /home/jps/Development/libwebsockets-4.2/libwebsockets/lib/core/./private-lib-core.h:140,*
> *                 from 
> /home/jps/Development/libwebsockets-4.2/libwebsockets/lib/plat/unix/unix-caps.c:28:*
> */home/jps/Development/libwebsockets-4.2/libwebsockets/include/libwebsockets/lws-genhash.h:85:9: 
> error: unknown type name ‘HMAC_CTX’*
> *         HMAC_CTX ctx;*
> *         ^~~~~~~~*
> *make[2]: *** [lib/CMakeFiles/websockets_shared.dir/build.make:63: 
> lib/CMakeFiles/websockets_shared.dir/plat/unix/unix-caps.c.o] Error 1*
> *make[1]: *** [CMakeFiles/Makefile2:1076: 
> lib/CMakeFiles/websockets_shared.dir/all] Error 2*
> *make: *** [Makefile:163: all] Error 2*
> I am building 4.2 on a 32 bit ARM (iMX6).

So it's a native build actually on the arm device?

> I do see this in CMAKE:
> *-- Looking for wolfSSL_HMAC_CTX_new
> *
> *-- Looking for wolfSSL_HMAC_CTX_new - not found
> *
> I did compile wolfssl with the --enable-opensslextra option.
> I have attached the cmake output file....I don't know why every wolfssl 
> option is "not found" or if that is normal.

Most of them are "not found" on the CI build, eg


... but there are like 5 or so that are found when built on x86_64 in 
CI, particularly

-- Looking for wolfSSL_HMAC_CTX_new
-- Looking for wolfSSL_HMAC_CTX_new - found

It should have emitted something like this on stdout (I think)

Compiling with SSL support
wolfSSL include dir: /usr/local/include
wolfSSL libraries: /usr/local/lib/libwolfssl.so

I would look into exactly what you have in


it should contain a subdir wolfssl/ that has a bunch of .h, an openssl 
subdir inside wolfssl/ etc.

If that looks OK, then you need to go look in whatever your equivalent 
of ./build/CMakeFiles/CMakeError.log is, and find the test it did for 
wolfSSL_HMAC_CTX_new(), and paste what happened with that test.  The 
test builds that CMake does to determine api existence are allowed to 
fail, then it takes the failure to mean that the api it was looking for 
doesn't exist.  But there are many reasons the tests can fail to build, 
eg, missing library so it can't link.

Also in CI, it is dynamically linking to the .so version of Wolfssl, you 
might try that.


More information about the Libwebsockets mailing list