AVSystem / Anjay

C implementation of the client-side OMA LwM2M protocol
Other
189 stars 70 forks source link

How to make tinydtls #35

Closed saddamwilson closed 4 years ago

saddamwilson commented 5 years ago

hi, when I want to use tinydtls, but when i try to compile.I got following errors in cmake. My environment: Ubuntu 16.04LTS

cmake . -DDTLS_BACKEND="tinydtls" -- Looking for dlsym() in library: -- Looking for dlsym -- Looking for dlsym - not found -- Looking for dlsym() in library: dl -- Looking for dlsym -- Looking for dlsym - found -- Checking if IN6_IS_ADDR_V4MAPPED is usable -- Checking if IN6_IS_ADDR_V4MAPPED is usable - no -- DTLS backend: tinydtls -- Checking if IN6_IS_ADDR_V4MAPPED is usable -- Checking if IN6_IS_ADDR_V4MAPPED is usable - no -- Could NOT find tinyDTLS (missing: TINYDTLS_INCLUDE_DIR TINYDTLS_LIBRARIES TINYDTLS_VERSION) -- Configuring done CMake Error in CMakeLists.txt: Target "avs_coap" contains relative path in its INTERFACE_INCLUDE_DIRECTORIES:

"TINYDTLS_INCLUDE_DIR-NOTFOUND"

CMake Error in CMakeLists.txt: Target "avs_coap" contains relative path in its INTERFACE_INCLUDE_DIRECTORIES:

"TINYDTLS_INCLUDE_DIR-NOTFOUND"
dextero commented 5 years ago

You need to have tinyDTLS installed in your system first. Something like this should work (create and install libtinydtls-dev apt package):

git clone https://git.eclipse.org/r/tinydtls/org.eclipse.tinydtls \
    && cd org.eclipse.tinydtls \
    && sed -i -e 's|#include "tinydtls.h"|#include "tinydtls/tinydtls.h"|' sha2/sha2.h \
    && autoconf \
    && autoheader \
    && ./configure \
    && make \
    && TINYDTLS_VERSION=$(awk '/PACKAGE_VERSION/ { print $3 }' platform-specific/platform.h) \
    && sudo checkinstall -y --pkgname libtinydtls-dev --pkgversion $TINYDTLS_VERSION make install

Note: a small patch is applied to fix an include path that causes problems when tinyDTLS is installed.

In case of issues, please refer to tinyDTLS installation instructions.

After the package is installed, retry the CMake command you tried and it should work.