view Sphinx/source/faq/compiling.rst @ 22:6d02b30fd8a9

note
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 13 Jul 2016 17:35:11 +0200
parents 901e8961f46e
children 669ea65ba7fb
line wrap: on
line source

.. _compiling:

Compiling Orthanc
=================

Under Linux
-----------

* Orthanc >= 0.7.1: See the `build instructions
  <https://bitbucket.org/sjodogne/orthanc/src/default/LinuxCompilation.txt>`_
  inside the source package.
* Orthanc <= 0.7.0: See the :ref:`compiling-old`.

Under Microsoft Windows
-----------------------

See the `build instructions for Windows
<https://bitbucket.org/sjodogne/orthanc/src/default/INSTALL>`_ inside
the source package.

Under OS X
----------

The mainline of Orthanc can compile under Apple OS X, with the XCode
compiler, since June 24th, 2014. See the `build instructions for
Darwin
<https://bitbucket.org/sjodogne/orthanc/src/default/DarwinCompilation.txt>`_
inside the source package.


Please explain the build infrastructure
---------------------------------------

The build infrastructure of Orthanc is based upon `CMake
<http://www.cmake.org/>`_. The build scripts are designed to embed all
the third-party dependencies directly inside the Orthanc
executable. This is the meaning of the ``-DSTATIC_BUILD=TRUE`` option,
as described in the `INSTALL
<http://orthanc.googlecode.com/hg/INSTALL>`_ file of Orthanc.

Such a static linking is very desirable under Windows, since the
Orthanc binaries do not depend on any external DLL, which results in a
straightforward installation procedure (just download the Windows
binaries and execute them), which eases the setup of the development
machines (no external library is to be manually installed, everything
is downloaded during the build configuration), and which avoids the
`DLL hell <http://en.wikipedia.org/wiki/Dll_hell>`_. As a downside,
this makes our build infrastructure rather complex.

Static linking is not as desirable under Linux than under
Windows. Linux prefers software that dynamically links against the
system-wide libraries: This is explained by the fact that whenever a
third-party dependency benefits from a bugfix, any software that is
linked against it also immediately benefits from this fix. This also
reduces the size of the binaries as well as the build time. Under
Linux, it is thus recommended to use the ``-DSTATIC_BUILD=FALSE``
option whenever possible.

When the dynamic build is used, some third-party dependencies may be
unavailable or incompatible with Orthanc, depending on your Linux
distribution. Some CMake options have thus been introduced to force
the static linking against some individual third-party
dependencies. Here are the most useful:

* ``-DUSE_SYSTEM_DCMTK=FALSE`` to statically link against DCMTK.
* ``-DUSE_SYSTEM_JSONCPP=FALSE`` to statically link against JsonCpp.

You will also have to set the ``-DALLOW_DOWNLOADS=TRUE`` to
explicitely allow the CMake script to download the source code of any
required dependency. The source code of all these dependencies is
self-hosted on our servers at the University Hospital of Liège.

Please also note that the option ``-DSTANDALONE_BUILD=TRUE`` must be
used whenever your plan to move the binaries or to install them on
another computer. This option will embed all the external resource
files (notably Orthanc Explorer) into the resulting executable. If
this option is set to ``FALSE``, the resources will be read from the
source directories.


Missing ``uuid-dev`` package
----------------------------

Orthanc might fail to compile, complaining about missing ``uuid-dev`` package. 

This problem seems to occur when fist building Orthanc without the
``uuid-dev`` package installed, then installing ``uuid-dev``, then
rebuilding Orthanc. It seems that the build scripts do not update the
cached variable about the presence of ``uuid-dev``.

To solve this problem, `as reported
<https://groups.google.com/d/msg/orthanc-users/hQYulBBvJvs/S1Pm125o59gJ>`_
by Peter Somlo, it is necessary to entirely remove the build directory
(e.g. with ``rm -rf Build``) and start again the build from a fresh
directory.