libcoap currently is available only as source archive or (preferably) can be cloned via Git. A debian package is being worked on.
Get the Code
(Note that the former SF repository is outdated.)
On platforms where POSIX system calls are available, the installation follows the usual configure/make cycle as described below.
Linux, Mac OSX and other POSIX platforms
If you have cloned the sources via git, you need to run
./autogen.sh to generate the build scripts. This step is
optional when a source archive is used.
./configure followed by
Besides common GNU options, the configure script provides the following switches to control the build process:
--enable-testsWill build the provided unit tests. This option requires cunit and its header files.
--enable-examplesWill build the included POSIX examples.
--enable-documentationWill generate documentation for libcoap provided that doxygen, a2x, and the docbook XML and XSL packages are available. This option enables manual page generation and doxygen-based API reference generation. Selective override (enable or disable, respectively is possible with the following two switches:
--enable-manpagesgenerate manual pages.
--enable-doxygengenerate the doxygen-based API reference. generation.
--enable-dtlsenables linking against a DTLS library. By default, this option is enabled and will look for GnuTLS version 3.3.0 or higher, OpenSSL version 1.1.0 or higher, or tinyDTLS, in that order. The following switches allow selecting a specific DTLS library manually:
--with-gnutlsselect a GnuTLS library.
--with-opensslselect an OpenSSL library.
--enable-gcovenable gcov test coverage support.
An example Contiki application can be found in
need to run
configure (possibly preceded by
autogen.sh when cloned
from git). The example Makefile will clone a the Contiki
repository and create a
symbolic link in Contiki’s
apps directory to the libcoap root
Makefile.libcoap is located. After that, a simple
server application is build by
There is currently no DTLS support for libcoap with Contiki.
Using libcoap with LwIP requires a hand-crafted Makefile. Please refer
examples/lwip/Makefile to see how this is done.
There is currently no DTLS support for libcoap with LwIP.
The usage of libcoap with TinyOS is documented in the TinyOS Wiki. Note that this implements an outdated version of the protocol.
There is no DTLS support for libcoap with TinyOS.