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
Latest development releases are available as package for download, or from the git repository.
There is also a stable version which can also be cloned from git.
(Note that the former SF repository is outdated.)
Configuration
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.
Next, say ./configure followed by make and make install.
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.--with-mbedtlsselect an Mbed TLS library.--with-tinydtlsselect tinyDTLS.--with-wolfsslselect wolfSSL.
--enable-gcovenable gcov test coverage support.
Contiki
An example Contiki application can be found in examples/contiki. You
need to run configure (possibly preceded by autogen.sh when cloned
from git). The example Makefile will clone the Contiki-NG
repository and create a
symbolic link in Contiki’s apps directory to the libcoap root
directory where Makefile.libcoap is located. After that, a simple
server application is build by Makefile.contiki.
There is currently no DTLS support for libcoap with Contiki.
RIOT
Example RIOT application can be found under examples/riot. The examples/riot example Makefile will clone the RIOT repository and then build an example client, server and test server within the RIOT subdirectory.
LwIP
Using libcoap with LwIP requires a hand-crafted Makefile. Please refer
to examples/lwip/Makefile to see how this is done.
There is DTLS (TinyDTLS) support for libcoap with LwIP.
TinyOS
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.