Build fixes on mbedtls and mqttc for CMake#3444
Open
fdcavalcanti wants to merge 2 commits intoapache:masterfrom
Open
Build fixes on mbedtls and mqttc for CMake#3444fdcavalcanti wants to merge 2 commits intoapache:masterfrom
fdcavalcanti wants to merge 2 commits intoapache:masterfrom
Conversation
Add mbedtls dependecy and fix patch path. Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
cederom
approved these changes
Apr 1, 2026
Contributor
cederom
left a comment
There was a problem hiding this comment.
Thank you @fdcavalcanti :-)
linguini1
previously approved these changes
Apr 1, 2026
Contributor
Author
|
I see CI is complaining about the change, I'll investigate. |
Contributor
|
@fdcavalcanti marked as a draft |
cederom
requested changes
Apr 2, 2026
Contributor
cederom
left a comment
There was a problem hiding this comment.
Just to note build fixes required :-)
fad76de to
f221d6f
Compare
Expose include paths as public when using CMake. Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
f221d6f to
1def0a5
Compare
simbit18
reviewed
Apr 3, 2026
| # Overlay mbedtls_config.h cannot be in the same nuttx_export_header() as | ||
| # ${MBEDTLS_DIR}/include (duplicate path). Alt headers need no export; INCDIR | ||
| # supplies them for this library only. | ||
| file(CREATE_LINK ${CMAKE_CURRENT_LIST_DIR}/include/mbedtls/mbedtls_config.h |
Contributor
There was a problem hiding this comment.
Hi @fdcavalcanti, Perhaps it would be better to use function
nuttx_create_symlink
https://github.com/apache/nuttx/blob/master/cmake/nuttx_create_symlink.cmake
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Expose include paths as public when using CMake.
Add mbedtls dependecy and fix patch path.
Apps mbedtls no longer appends its include directories to the global nuttx target (NUTTX_INCLUDE_DIRECTORIES / NUTTX_CXX_INCLUDE_DIRECTORIES). That global injection caused arch/vendor code (e.g. Espressif tf-psa-crypto) to pick up headers from
nuttx-apps/crypto/mbedtls/mbedtls/include, which mixed two incompatible Mbed TLS trees and led to PSA/config include errors.The post-FetchContent patch step used
$(MQTTC_DIR)insidesh -c, which the shell treats as command substitution, not a CMake path. Replaced with a directpatch -d ${MQTTC_DIR} -p1 -i… invocation.With mbedtls includes no longer global, MQTT-C with mbedtls wires
nuttx_add_dependencies(TARGET mqttc DEPENDS mbedtls)when bothCONFIG_NETUTILS_MQTTC_WITH_MBEDTLSandCONFIG_CRYPTO_MBEDTLSare set, andmqttc_mbedtls_publists mbedtls in DEPENDS so the example compiles against the same headers as the library.This fixes build issues for Espressif devices whenever mbedtls was added (affecting CMake support only).
Impact
Impact on user: No.
Impact on build: Make builds are unaffected.
Anything that included
<mbedtls/...>only because of those global includes, and does not get headers via:could fail to compile until it gains an explicit dependency or include path. That is not vendor-specific; it depends on how each app’s CMakeLists.txt was written.
Impact on hardware: No.
Impact on documentation: No.
Impact on security: No.
Impact on compatibility: No.
Testing
Building
CMake build for
esp32c3-devkit:wifi.Append the following:
Results
CMake build would fail for this scenario, but works after the changes.