如何升级libcoap?
Posted: Mon Nov 01, 2021 3:35 am
我在使用 esp-idf-v4.2.1.我需要升级 libcoap 到4-3-0版本, 所以把这个版本文件替换掉 esp-idf-v4.2.1\components\coap。还修改了 compenent.mk 和 CMakeLists.txt 中相关的内容(coap2修改为coap3):
compenent.mk
CMakeLists.txt
编译时遇到如下报错:
libcoap/include/coap3/coap_dtls.h:118:14: error: unknown type name'coap_session_t';
我检查了 "coap_dtls.h"的内容, 发现其中、以及其包含的头文件里都没有 "coap_session_t"这个结构体的定义。请问这个coap库应该怎么编译啊?
compenent.mk
Code: Select all
#
# Component Makefile
#
COMPONENT_ADD_INCLUDEDIRS := port/include port/include/coap libcoap/include libcoap/include/coap3
Code: Select all
set(include_dirs port/include port/include/coap libcoap/include libcoap/include/coap3)
set(srcs
"libcoap/src/address.c"
"libcoap/src/async.c"
"libcoap/src/block.c"
"libcoap/src/coap_event.c"
"libcoap/src/coap_hashkey.c"
"libcoap/src/coap_session.c"
"libcoap/src/coap_time.c"
"port/coap_debug.c"
"libcoap/src/encode.c"
"libcoap/src/mem.c"
"libcoap/src/net.c"
"libcoap/src/option.c"
"libcoap/src/pdu.c"
"libcoap/src/resource.c"
"libcoap/src/str.c"
"libcoap/src/subscribe.c"
"libcoap/src/uri.c"
"libcoap/src/coap_io.c"
"port/coap_notls.c"
"port/coap_mbedtls.c")
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
REQUIRES lwip mbedtls)
# Silence format truncation warning, until it is fixed upstream
set_source_files_properties(port/coap_debug.c PROPERTIES COMPILE_FLAGS -Wno-format-truncation)
# Needed for coap headers in public builds, also.
#
# TODO: find a way to move this to a port header
target_compile_definitions(${COMPONENT_LIB} PUBLIC WITH_POSIX)
编译时遇到如下报错:
libcoap/include/coap3/coap_dtls.h:118:14: error: unknown type name'coap_session_t';
我检查了 "coap_dtls.h"的内容, 发现其中、以及其包含的头文件里都没有 "coap_session_t"这个结构体的定义。请问这个coap库应该怎么编译啊?