documentation updated
[occt.git] / dox / dev_guides / building / 3rdparty / 3rdparty_linux.md
1  Building 3rd-party libraries on Linux {#dev_guides__building_3rdparty_linux}
2 ============================================
3 @tableofcontents 
4
5 @section dev_guides__building_3rdparty_linux_1 Introduction
6
7   This document presents additional guidelines for building third-party 
8   products used by Open CASCADE Technology and samples on Linux platform. 
9
10   The links for downloading the third-party products are available on the web site 
11   of OPEN CASCADE SAS at 
12   http://www.opencascade.org/getocc/require/. 
13
14   There are two types of third-party products, which are  necessary to build OCCT: 
15   
16   * Mandatory  products: Tcl 8.5, Tk 8.5, FreeType 2.4.10 
17   * Optional  products: TBB 3.x or 4.x, gl2ps 1.3.5, FreeImage 3.14.1 
18
19 @section dev_guides__building_3rdparty_linux_2 Building Mandatory Third-party Products
20
21 @subsection dev_guides__building_3rdparty_linux_2_1 Tcl/Tk 8.5 
22
23   Tcl/Tk is required for DRAW test harness. Version 8.5 or 8.6 can be used with OCCT. 
24
25 @subsubsection dev_guides__building_3rdparty_linux_2_1_1 Installation from binaries
26
27   It is possible to download ready-to-install binaries from 
28   http://www.activestate.com/activetcl/downloads
29
30   * 1. Download the binaries archive and unpack them to some  TCL_SRC_DIR. 
31   * 2. Enter the directory TCL_SRC_DIR.
32
33   @verbatim
34     cd TCL_SRC_DIR
35   @endverbatim
36
37   * 3. Run the install command 
38
39   @verbatim
40     install.sh
41   @endverbatim
42     
43   and follow instructions. 
44
45 @subsubsection dev_guides__building_3rdparty_linux_2_1_2 Installation from sources: Tcl 8.5
46   
47   Download the necessary archive from http://www.tcl.tk/software/tcltk/download.html and unpack it. 
48   
49   * 1. Enter the unix sub-directory of the directory where the source  files of Tcl are located (TCL_SRC_DIR). 
50
51   @verbatim
52     cd TCL_SRC_DIR/unix   
53   @endverbatim
54
55   * 2. Run the configure command
56
57   @verbatim
58     configure --enable-gcc  --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR   
59   @endverbatim
60
61   For a 64 bit platform also add --enable-64bit option to the  command line. 
62   
63   * 3. If the configure command has finished successfully, start  the building process 
64   
65   @verbatim
66     make   
67   @endverbatim
68
69   * 4. If building is finished successfully, start the installation of Tcl. 
70   All binary and service files of the product will be copied to the directory defined by TCL_INSTALL_DIR 
71
72   @verbatim
73     make install   
74   @endverbatim
75
76 @subsubsection dev_guides__building_3rdparty_linux_2_1_3 Installation from sources: Tk 8.5
77   
78   Download the necessary archive from http://www.tcl.tk/software/tcltk/download.html and unpack it. 
79   
80   * 1. Enter the unix sub-directory of the directory where the source  files of Tk are located (TK_SRC_DIR). 
81
82   @verbatim
83     cd TK_SRC_DIR/unix   
84   @endverbatim
85
86   * 2. Run the configure command, where TCL_LIB_DIR is  TCL_INSTALL_DIR/lib 
87
88   @verbatim
89     configure --enable-gcc  --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR  --prefix=TK_INSTALL_DIR   
90   @endverbatim
91
92   where TCL_LIB_DIR is TCL_INSTALL_DIR/lib 
93
94   For a 64 bit platform also add --enable-64bit option to the  command line. 
95
96   * 3. If the configure command has finished successfully, start  the building process 
97
98   @verbatim
99     make   
100   @endverbatim
101
102   * 4. If building has finished successfully, start the installation of Tk. 
103        All binary and service files of the product will be copied 
104        to the directory defined by TK_INSTALL_DIR (usually  TK_INSTALL_DIR is TCL_INSTALL_DIR) 
105
106   @verbatim
107     make install   
108   @endverbatim
109
110 @subsection dev_guides__building_3rdparty_linux_2_2 FreeType 2.4.10
111
112   FreeType is required for display of text in 3D viewer. 
113   Download the necessary archive from http://sourceforge.net/projects/freetype/files/ and unpack it. 
114   
115   * 1. Enter the directory where the source files of FreeType  are located (FREETYPE_SRC_DIR). 
116
117   @verbatim
118     cd FREETYPE_SRC_DIR   
119   @endverbatim
120
121   * 2. Run the configure command 
122   
123   @verbatim
124     configure  --prefix=FREETYPE_INSTALL_DIR   
125   @endverbatim
126
127   For a 64 bit platform also add CFLAGS='-m64 -fPIC'  CPPFLAGS='-m64 -fPIC' option to the command line. 
128     
129   * 3. If the configure command has finished successfully, start  the building process 
130
131   @verbatim
132     make   
133   @endverbatim
134
135   * 4. If building has finished successfully, start the installation of FreeType. 
136        All binary and service files of the product will be copied to the directory defined by FREETYPE_INSTALL_DIR 
137     
138   @verbatim
139     make install   
140   @endverbatim
141
142 @section dev_guides__building_3rdparty_linux_3 Building Optional Third-party Products
143     
144 @subsection dev_guides__building_3rdparty_linux_3_1 TBB 3.x or 4.x
145
146   This third-party product is  installed with binaries from the archive that can be downloaded from http://threadingbuildingblocks.org. 
147   Go to \"Downloads page\", find the  release version you need (e.g. tbb30_018oss) and pick the archive for Linux  platform. 
148   To install, unpack the downloaded archive of TBB 3.0 product (*tbb30_018oss_lin.tgz*).
149
150 @subsection dev_guides__building_3rdparty_linux_3_2 gl2ps 1.3.5
151
152   Download the necessary archive from http://geuz.org/gl2ps/ and unpack it.
153   
154   * 1. Install or build cmake product from source file. 
155   * 2. Start cmake in GUI mode with the directory where the source files of gl2ps are located:
156   @verbatim
157     ccmake GL2PS_SRC_DIR   
158   @endverbatim
159      * 2.1. Press [c] to make the  initial configuration 
160      * 2.2. Define the necessary options  CMAKE_INSTALL_PREFIX 
161      * 2.3. Press [c] to make the final  configuration 
162      * 2.4. Press [g] to generate  Makefile and exit 
163
164   or just run the following command: 
165
166   @verbatim
167     cmake  –DCMAKE_INSTALL_PREFIX=GL2PS_INSTALL_DIR –DCMAKE_BUILD_TYPE=Release   
168   @endverbatim
169
170   * 3. Start building of gl2ps 
171
172   @verbatim
173     make   
174   @endverbatim
175
176   * 4. Start the installation of gl2ps. Binaries will be  installed according to the CMAKE_INSTALL_PREFIX option 
177
178   @verbatim
179     make install   
180   @endverbatim
181
182 @subsection dev_guides__building_3rdparty_linux_3_3 FreeImage 3.14.1
183
184   Download the necessary archive from http://sourceforge.net/projects/freeimage/files/Source%20Distribution/
185   and unpack it. The directory with unpacked sources is  further referred to as FREEIMAGE_SRC_DIR. 
186   
187   * 1. Modify FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h: 
188    In line 60 insert the following: 
189
190   @verbatim
191     #include string.h   
192   @endverbatim
193
194   * 2. Enter the directory where the source files of FreeImage are located (FREEIMAGE_SRC_DIR). 
195   
196   @verbatim
197     cd FREEIMAGE_SRC_DIR   
198   @endverbatim
199
200   * 3. Run the building process 
201   
202   @verbatim
203     make   
204   @endverbatim
205
206   * 4. Run the installation process 
207      * 4.1. If you have permissions to write to /usr/include and /usr/lib directories then run the following command: 
208   @verbatim
209     make install   
210   @endverbatim
211      * 4.2. If you don’t have permissions to write to /usr/include and 
212        /usr/lib directories then you need to modify the file FREEIMAGE_SRC_DIR/Makefile.gnu: 
213   
214   Change lines 7-9 from:
215   
216   @verbatim
217     DESTDIR ?= /   
218     INCDIR  ?= $(DESTDIR)/usr/include   
219     INSTALLDIR  ?= $(DESTDIR)/usr/lib   
220   @endverbatim
221
222   to: 
223
224   @verbatim
225     DESTDIR  ?= $(DESTDIR)   
226     INCDIR  ?= $(DESTDIR)/include   
227     INSTALLDIR  ?= $(DESTDIR)/lib   
228   @endverbatim
229
230   Change lines 65-67 from: 
231
232   @verbatim
233     install  -m 644 -o root -g root $(HEADER) $(INCDIR)   
234     install  -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)   
235     install  -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)   
236   @endverbatim
237   
238   to:
239
240   @verbatim
241     install  -m 755 $(HEADER) $(INCDIR)   
242     install  -m 755 $(STATICLIB) $(INSTALLDIR)   
243     install  -m 755 $(SHAREDLIB) $(INSTALLDIR)
244   @endverbatim
245
246   Change line 70 from: 
247
248   @verbatim
249     ldconfig
250   @endverbatim
251
252   to:
253   
254   @verbatim
255     \#ldconfig   
256   @endverbatim
257     
258   Then run the installation process by the following command: 
259
260   @verbatim
261     make DESTDIR=FREEIMAGE_INSTALL_DIR  install   
262   @endverbatim
263
264   * 5. Clean the temporary files
265   
266   @verbatim
267     make clean   
268   @endverbatim
269
270 @section dev_guides__building_3rdparty_linux_4 Installation From Official Repositories
271
272 @subsection dev_guides__building_3rdparty_linux_4_1 Debian-based distributives
273
274   All 3rd-party products required for building of  OCCT could be installed 
275   from official repositories. You may install them from  console using apt-get utility: 
276
277   @verbatim
278     sudo apt-get install \   
279     tcllib tklib tcl-dev tk-dev \   
280     libfreetype-dev \   
281     libxt-dev libxmu-dev \   
282     libgl1-mesa-dev \   
283     libfreeimage-dev \   
284     libtbb-dev \   
285     libgl2ps-dev   
286   @endverbatim
287   
288   To launch WOK-prebuilt binaries you need install C shell and  32-bit libraries on x86_64 distributives: 
289   
290   @verbatim
291     sudo apt-get install \   
292     csh \   
293     libstdc++5:i386 libxt6:i386   
294   @endverbatim
295
296   Any compliant C++ compiler is required for building anyway: 
297   
298   @verbatim
299     sudo apt-get install \   
300     g++ \   
301   @endverbatim
302
303 @see http://www.opencascade.org for details