0
|
1 .. _compiling:
|
|
2
|
|
3 Compiling Orthanc
|
|
4 =================
|
|
5
|
42
|
6 Under GNU/Linux
|
|
7 ---------------
|
0
|
8
|
|
9 * Orthanc >= 0.7.1: See the `build instructions
|
|
10 <https://bitbucket.org/sjodogne/orthanc/src/default/LinuxCompilation.txt>`_
|
|
11 inside the source package.
|
|
12 * Orthanc <= 0.7.0: See the :ref:`compiling-old`.
|
|
13
|
262
|
14 **Note for packagers:** As explained :ref:`below on this page
|
|
15 <compiling-infrastructure>`, the CMake scripts of Orthanc and its
|
|
16 associated plugins may have to download the source code of third-party
|
|
17 dependencies. This is an undesirable feature if packaging Orthanc for
|
|
18 some GNU/Linux distribution, as network connections are forbidden in
|
|
19 such situations to enable reproducible builds. To prevent the CMake
|
|
20 scripts to download from Internet, package maintainers can manually
|
|
21 download third-party dependencies by themselves (by checking what is
|
|
22 downloaded by CMake during a fresh build), then put them in a
|
|
23 subfolder named ``ThirdPartyDownloads/`` in the same folder as the
|
|
24 ``CMakeLists.txt`` file of the project. If the third-party packages
|
|
25 are already in that subfolder, the CMake script will not try and
|
|
26 download them from Internet.
|
|
27
|
|
28
|
0
|
29 Under Microsoft Windows
|
|
30 -----------------------
|
|
31
|
|
32 See the `build instructions for Windows
|
|
33 <https://bitbucket.org/sjodogne/orthanc/src/default/INSTALL>`_ inside
|
|
34 the source package.
|
|
35
|
|
36 Under OS X
|
|
37 ----------
|
|
38
|
|
39 The mainline of Orthanc can compile under Apple OS X, with the XCode
|
|
40 compiler, since June 24th, 2014. See the `build instructions for
|
|
41 Darwin
|
|
42 <https://bitbucket.org/sjodogne/orthanc/src/default/DarwinCompilation.txt>`_
|
|
43 inside the source package.
|
|
44
|
41
|
45 Performance warning
|
|
46 -------------------
|
|
47
|
|
48 If performance is important to you, make sure to add the option
|
|
49 ``-DCMAKE_BUILD_TYPE=Release`` when invoking ``cmake``. Indeed, by
|
|
50 default, `run-time debug assertions
|
|
51 <https://en.wikipedia.org/wiki/Assertion_(software_development)#Assertions_for_run-time_checking>`_
|
|
52 are enabled, which can seriously impact performance, especially if
|
|
53 your Orthanc server stores a lot of DICOM instances.
|
|
54
|
|
55
|
0
|
56
|
262
|
57 .. _compiling-infrastructure:
|
|
58
|
0
|
59 Please explain the build infrastructure
|
|
60 ---------------------------------------
|
|
61
|
|
62 The build infrastructure of Orthanc is based upon `CMake
|
25
|
63 <https://cmake.org/>`_. The build scripts are designed to embed all
|
0
|
64 the third-party dependencies directly inside the Orthanc
|
42
|
65 executable. This is the meaning of the ``-DSTATIC_BUILD=ON`` option,
|
0
|
66 as described in the `INSTALL
|
25
|
67 <https://bitbucket.org/sjodogne/orthanc/src/default/INSTALL>`_ file of Orthanc.
|
0
|
68
|
|
69 Such a static linking is very desirable under Windows, since the
|
|
70 Orthanc binaries do not depend on any external DLL, which results in a
|
|
71 straightforward installation procedure (just download the Windows
|
|
72 binaries and execute them), which eases the setup of the development
|
|
73 machines (no external library is to be manually installed, everything
|
|
74 is downloaded during the build configuration), and which avoids the
|
25
|
75 `DLL hell <https://en.wikipedia.org/wiki/Dll_hell>`_. As a downside,
|
0
|
76 this makes our build infrastructure rather complex.
|
|
77
|
42
|
78 Static linking is not as desirable under GNU/Linux than under
|
|
79 Windows. GNU/Linux prefers software that dynamically links against the
|
0
|
80 system-wide libraries: This is explained by the fact that whenever a
|
|
81 third-party dependency benefits from a bugfix, any software that is
|
|
82 linked against it also immediately benefits from this fix. This also
|
|
83 reduces the size of the binaries as well as the build time. Under
|
42
|
84 GNU/Linux, it is thus recommended to use the ``-DSTATIC_BUILD=OFF``
|
0
|
85 option whenever possible.
|
|
86
|
|
87 When the dynamic build is used, some third-party dependencies may be
|
42
|
88 unavailable or incompatible with Orthanc, depending on your GNU/Linux
|
0
|
89 distribution. Some CMake options have thus been introduced to force
|
|
90 the static linking against some individual third-party
|
|
91 dependencies. Here are the most useful:
|
|
92
|
42
|
93 * ``-DUSE_SYSTEM_DCMTK=OFF`` to statically link against DCMTK.
|
|
94 * ``-DUSE_SYSTEM_JSONCPP=OFF`` to statically link against JsonCpp.
|
0
|
95
|
86
|
96 You will also have to set the ``-DALLOW_DOWNLOADS=ON`` to explicitely
|
|
97 allow the CMake script to download the source code of any required
|
|
98 dependency. The source code of all these dependencies is self-hosted
|
|
99 on the Web server running our official homepage.
|
0
|
100
|
42
|
101 Please also note that the option ``-DSTANDALONE_BUILD=ON`` must be
|
0
|
102 used whenever your plan to move the binaries or to install them on
|
|
103 another computer. This option will embed all the external resource
|
|
104 files (notably Orthanc Explorer) into the resulting executable. If
|
42
|
105 this option is set to ``OFF``, the resources will be read from the
|
0
|
106 source directories.
|
|
107
|
|
108
|
|
109 Missing ``uuid-dev`` package
|
|
110 ----------------------------
|
|
111
|
|
112 Orthanc might fail to compile, complaining about missing ``uuid-dev`` package.
|
|
113
|
|
114 This problem seems to occur when fist building Orthanc without the
|
|
115 ``uuid-dev`` package installed, then installing ``uuid-dev``, then
|
|
116 rebuilding Orthanc. It seems that the build scripts do not update the
|
|
117 cached variable about the presence of ``uuid-dev``.
|
|
118
|
|
119 To solve this problem, `as reported
|
|
120 <https://groups.google.com/d/msg/orthanc-users/hQYulBBvJvs/S1Pm125o59gJ>`_
|
|
121 by Peter Somlo, it is necessary to entirely remove the build directory
|
|
122 (e.g. with ``rm -rf Build``) and start again the build from a fresh
|
|
123 directory.
|