How to update libcoap?

zsd0101
Posts: 4
Joined: Sun Sep 26, 2021 12:50 pm

How to update libcoap?

Postby zsd0101 » Mon Nov 01, 2021 3:30 am

i`m using esp-idf-v4.2.1. I need to integrate libcoap 4-3-0, so I replace esp-idf-v4.2.1\components\coap with this version library. And change compenent.mk and CMakeLists.txt:
compenent.mk

Code: Select all

#
# Component Makefile
#

COMPONENT_ADD_INCLUDEDIRS := port/include port/include/coap libcoap/include libcoap/include/coap3
CMakeLists.txt

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)


Then I got the following error when compiling:
libcoap/include/coap3/coap_dtls.h:118:14: error: unknown type name'coap_session_t';

I checked the content of "coap_dtls.h", I found that there was no definition or extern about the structure "coap_session_t". And "coap_dtls.h" also only contained two header files: "coap_time.h" and "str.h"--there is no definition of coap_session_t in these two files too.

So I'm wondering how to compile here, can anyone provide any help? Thanks in advance!

Who is online

Users browsing this forum: No registered users and 104 guests