docs: Update installation instructions for shared library
Change-Id: I2c8b146b5f8aa73cbe9e9ded5b8359b646656148
Refs: #2243
diff --git a/docs/INSTALL.rst b/docs/INSTALL.rst
index 7f291d0..3266666 100644
--- a/docs/INSTALL.rst
+++ b/docs/INSTALL.rst
@@ -109,6 +109,8 @@
sudo yum install doxygen graphviz python-sphinx
sudo pip install sphinxcontrib-doxylink sphinxcontrib-googleanalytics
+.. _build:
+
Build
-----
@@ -123,9 +125,51 @@
./waf
sudo ./waf install
+By default, only the static version of ndn-cxx library is built. To build the shared library,
+use ``--enable-shared`` option for ``./waf configure`` command. For example::
+
+ ./waf configure --enable-shared
+
+To disable build of the static library and build only the shared library, use additional
+``--disable-static`` option. Note that at least one version of the library needs to be
+enabled.
+
+::
+
+ ./waf configure --enable-shared --disable-static
+
+
+After shared library is built and installed, some systems require additional actions.
+
+ - on Linux::
+
+ sudo ldconfig
+
+ - on FreeBSD::
+
+ sudo ldconfig -m
+
+ .. note::
+ When library is installed in a non-standard path (in general: not in ``/usr/lib`` or
+ ``/usr/local/lib``; on some Linux distros including Fedora: not in ``/usr/lib``),
+ additional actions may be necessary.
+
+ The installation path should be added to ``/etc/ld.so.conf`` (or in
+ ``/etc/ld.so.conf.d``) **before** running ``sudo ldconfig``. For example::
+
+ echo /usr/local/lib | sudo tee /etc/ld.so.conf.d/ndn-cxx.conf
+
+ Alternatively, ``LD_LIBRARY_PATH`` environment variable should be set to the location of
+ the library::
+
+ export LD_LIBRARY_PATH=/usr/local/lib
+
This builds and installs the following items:
-- ``<LIBPATH>/libndn-cxx.a``: static NDN C++ library
+- ``<LIBPATH>/libndn-cxx.a``: static NDN C++ library (if enabled)
+- ``<LIBPATH>/libndn-cxx.so``, ``<LIBPATH>/libndn-cxx.so.<VERSION>`` (on Linux),
+ ``<LIBPATH>/libndn-cxx.dylib``, ``<LIBPATH>/libndn-cxx.<VERSION>.dylib`` (on OS X):
+ shared NDN C++ library (if enabled)
- ``<LIBPATH>/pkgconfig/libndn-cxx.pc``: pkgconfig file storing all
neccessary flags to build against the library. For example, if
pkgconfig or pkgconf package is installed and ``PKG_CONFIG_PATH`` is
@@ -162,6 +206,17 @@
./waf configure --with-examples
./waf
+ sudo ./waf install
+
+:ref:`Additional step <build>`:
+
+ - on Linux::
+
+ sudo ldconfig
+
+ - on FreeBSD::
+
+ sudo ldconfig -m
To run examples:
@@ -183,6 +238,7 @@
cp examples/consumer.cpp examples/my-new-consumer-app.cpp
./waf
+ sudo ./waf install
./build/examples/my-new-consumer-app
@@ -201,6 +257,16 @@
./waf
sudo ./waf install
+:ref:`Additional step <build>`:
+
+ - on Linux::
+
+ sudo ldconfig
+
+ - on FreeBSD::
+
+ sudo ldconfig -m
+
Documentation
-------------
@@ -239,6 +305,16 @@
./waf
sudo ./waf install
+:ref:`Additional step <build>`:
+
+ - on Linux::
+
+ sudo ldconfig
+
+ - on FreeBSD::
+
+ sudo ldconfig -m
+
In the development build all compiler optimizations are disabled by
default and all warnings are treated as error. The default behavior can
be overridden by setting ``CXXFLAGS`` environment variable before