Skip to content

libwebsockets-v4.3-stable: build fails when building with mbedtls #3013

@lukakudra

Description

@lukakudra

When building libwebsockets configured with -DLWS_WITH_SSL=ON and -DLWS_WITH_MBEDTLS=ON from branch v4.3-stable the build fails when mbedtls library is built without MBEDTLS_VERSION_C defined.

The compiler warning is the following:

warning: implicit declaration of function 'mbedtls_version_get_string' [-Wimplicit-function-declaration]
  791 |         mbedtls_version_get_string(mbedtls_version);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~

and this warning results in a linker error:

 undefined reference to `mbedtls_version_get_string'

This issue is present on OpenWrt because the mbedtls library is built without the option MBEDTLS_VERSION_C as you can see here.

The solution to this problem is quite simple because there is actually no need to use the function mbedtls_version_get_string, you can simply use the definition MBEDTLS_VERSION_STRING and the code functionality will remain the same.
In the commit that introduced this issue the following changes need to be made:

  1. delete the code between lines 389 and 391
  2. delete the code between lines 790 and 792
  3. change the line 796 to this: "LWS: %s, MbedTLS-%s %s%s", library_version, MBEDTLS_VERSION_STRING, opts_str, s);

I can also make a pull request with these changes if you would prefer that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions