Skip to content

Zephyr - failed to link mbedtls #1890

@magdalenaszumny

Description

@magdalenaszumny

Environment

  • Build System: CMake
  • Operating System: Zephyr
  • Operating System Version:
  • Hosted Environment:

libcoap Configuration Summary

Problem Description

I am using libcoap for Zephyr with mbedtls. I have following problem during the build:
CMake Error at xxx/lib/libcoap/CMakeLists.txt:747 (target_link_libraries):
Target "coap-3" links to:

MbedTLS::mbedtls

but the target was not found. Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

I checked zephyr_modules.txt in build output and I see that libcoap is before mbedtls on the list. That means that libcoap does not see mbedtls at the momen when libcoap is build.
I have other sample application, where I don't see this issue. I checked zephyr_modules.txt there and I can see that mbedtls is before libcoap.

I have some fix that ensures that Zephyr sees mbedtls when building libcoap. In module.yml in libcoap we can add:
depends:

  • mbedtls

But I guess that is not generic enough, because other users might not be using mbedtls. Do you have any suggestions?

Expected Behavior

Libcoap with mbedtls can be build for Zephyr and successful build is not dependent on modules order.

Actual Behavior

Build is dependent on modules order.

Steps to reproduce

Code to reproduce this issue

Debug Logs

Other items if possible

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions