0026869: Documentation - simplify "Building with CMake and ADT on Android" article
[occt.git] / dox / dev_guides / building / 3rdparty / 3rdparty_linux.md
CommitLineData
ba06f8bb 1 Building 3rd-party libraries on Linux {#occt_dev_guides__building_3rdparty_linux}
79d580f2 2=========
3
e5bd0d98 4@tableofcontents
5
6@section dev_guides__building_3rdparty_linux_1 Introduction
7
79d580f2 8This document presents additional guidelines for building third-party
9products used by Open CASCADE Technology and samples on Linux platform.
e5bd0d98 10
79d580f2 11The links for downloading the third-party products are available on the web site
12of OPEN CASCADE SAS at
13http://www.opencascade.org/getocc/require/.
e5bd0d98 14
79d580f2 15There are two types of third-party products, which are necessary to build OCCT:
e5bd0d98 16
77906c4c 17* Mandatory products:
18 * Tcl/Tk 8.5 - 8.6;  
18006a0f 19 * FreeType 2.4.10 - 2.5.3;
77906c4c 20* Optional products:
21 * TBB 3.x - 4.x;
22 * gl2ps 1.3.5 - 1.3.8;
18006a0f 23 * FreeImage 3.14.1 - 3.16.0;
24 * VTK 6.1.0.
e5bd0d98 25
26@section dev_guides__building_3rdparty_linux_2 Building Mandatory Third-party Products
27
79d580f2 28@subsection dev_guides__building_3rdparty_linux_2_1 Tcl/Tk
e5bd0d98 29
79d580f2 30Tcl/Tk is required for DRAW test harness.
e5bd0d98 31
79d580f2 32@subsubsection dev_guides__building_3rdparty_linux_2_1_2 Installation from sources: Tcl
e5bd0d98 33
79d580f2 34Download the necessary archive from http://www.tcl.tk/software/tcltk/download.html and unpack it.
e5bd0d98 35
77906c4c 361. Enter the unix sub-directory of the directory where the Tcl source files are located <i>(TCL_SRC_DIR)</i>.
e5bd0d98 37
79d580f2 38 cd TCL_SRC_DIR/unix
e5bd0d98 39
77906c4c 402. Run the *configure* command:
e5bd0d98 41
79d580f2 42 configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR
e5bd0d98 43
77906c4c 44 For a 64 bit platform also add <i>--enable-64bit</i> option to the command line.
e5bd0d98 45
77906c4c 463. If the configure command has finished successfully, start the building process:
e5bd0d98 47
79d580f2 48 make
e5bd0d98 49
79d580f2 504. If building is finished successfully, start the installation of Tcl.
77906c4c 51 All binary and service files of the product will be copied to the directory defined by *TCL_INSTALL_DIR*
e5bd0d98 52
79d580f2 53 make install
e5bd0d98 54
79d580f2 55@subsubsection dev_guides__building_3rdparty_linux_2_1_3 Installation from sources: Tk
e5bd0d98 56
79d580f2 57Download the necessary archive from http://www.tcl.tk/software/tcltk/download.html and unpack it.
e5bd0d98 58
77906c4c 591. Enter the unix sub-directory of the directory where the Tk source files are located <i>(TK_SRC_DIR)</i>
e5bd0d98 60
79d580f2 61 cd TK_SRC_DIR/unix
e5bd0d98 62
77906c4c 632. Run the configure command, where <i>TCL_LIB_DIR</i> is *TCL_INSTALL_DIR/lib*.
e5bd0d98 64
79d580f2 65 configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR
e5bd0d98 66
77906c4c 67 For a 64 bit platform also add <i>--enable-64bit</i> option to the command line.
e5bd0d98 68
77906c4c 693. If the configure command has finished successfully, start the building process:
e5bd0d98 70
79d580f2 71 make
e5bd0d98 72
77906c4c 734. If the building has finished successfully, start the installation of Tk.
79d580f2 74 All binary and service files of the product will be copied
77906c4c 75 to the directory defined by *TK_INSTALL_DIR* (usually it is *TCL_INSTALL_DIR*)
e5bd0d98 76
79d580f2 77 make install
e5bd0d98 78
79d580f2 79@subsection dev_guides__building_3rdparty_linux_2_2 FreeType
e5bd0d98 80
77906c4c 81FreeType is required for text display in the 3D viewer.
79d580f2 82Download the necessary archive from http://sourceforge.net/projects/freetype/files/ and unpack it.
e5bd0d98 83
77906c4c 841. Enter the directory where the source files of FreeType are located <i>(FREETYPE_SRC_DIR)</i>.
e5bd0d98 85
79d580f2 86 cd FREETYPE_SRC_DIR
e5bd0d98 87
77906c4c 882. Run the *configure* command:
e5bd0d98 89
79d580f2 90 configure --prefix=FREETYPE_INSTALL_DIR
e5bd0d98 91
77906c4c 92 For a 64 bit platform also add <i>CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'</i> option to the command line.
e5bd0d98 93
77906c4c 943. If the *configure* command has finished successfully, start the building process:
e5bd0d98 95
79d580f2 96 make
e5bd0d98 97
77906c4c 984. If the building has finished successfully, start the installation of FreeType.
99 All binary and service files of the product will be copied to the directory defined by *FREETYPE_INSTALL_DIR*
e5bd0d98 100
79d580f2 101 make install
e5bd0d98 102
103@section dev_guides__building_3rdparty_linux_3 Building Optional Third-party Products
104
79d580f2 105@subsection dev_guides__building_3rdparty_linux_3_1 TBB
e5bd0d98 106
79d580f2 107This third-party product is installed with binaries from the archive that can be downloaded from http://threadingbuildingblocks.org.
18006a0f 108Go to the **Download** page, find the release version you need and pick the archive for Linux platform.
79d580f2 109To install, unpack the downloaded archive of TBB product.
e5bd0d98 110
79d580f2 111@subsection dev_guides__building_3rdparty_linux_3_2 gl2ps
e5bd0d98 112
79d580f2 113Download the necessary archive from http://geuz.org/gl2ps/ and unpack it.
e5bd0d98 114
77906c4c 1151. Install or build *cmake* product from the source file.
1162. Start *cmake* in GUI mode with the directory where the source files of gl2ps are located:
79d580f2 117
118 ccmake GL2PS_SRC_DIR
119
77906c4c 120 * Press <i>[c]</i> to make the initial configuration;
121 * Define the necessary options in *CMAKE_INSTALL_PREFIX*
122 * Press <i>[c]</i> to make the final configuration
123 * Press <i>[g]</i> to generate Makefile and exit
e5bd0d98 124
79d580f2 125 or just run the following command:
e5bd0d98 126
79d580f2 127 cmake –DCMAKE_INSTALL_PREFIX=GL2PS_INSTALL_DIR –DCMAKE_BUILD_TYPE=Release
e5bd0d98 128
77906c4c 1293. Start the building of gl2ps:
e5bd0d98 130
79d580f2 131 make
e5bd0d98 132
77906c4c 1334. Start the installation of gl2ps. Binaries will be installed according to the *CMAKE_INSTALL_PREFIX* option.
e5bd0d98 134
79d580f2 135 make install
e5bd0d98 136
79d580f2 137@subsection dev_guides__building_3rdparty_linux_3_3 FreeImage
e5bd0d98 138
79d580f2 139Download the necessary archive from http://sourceforge.net/projects/freeimage/files/Source%20Distribution/
77906c4c 140and unpack it. The directory with unpacked sources is further referred to as *FREEIMAGE_SRC_DIR*.
e5bd0d98 141
77906c4c 1421. Modify *FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h*:
e5bd0d98 143 In line 60 insert the following:
144
79d580f2 145 #include string.h
e5bd0d98 146
77906c4c 1472. Enter the directory where the source files of FreeImage are located <i>(FREEIMAGE_SRC_DIR)</i>.
e5bd0d98 148
79d580f2 149 cd FREEIMAGE_SRC_DIR
e5bd0d98 150
79d580f2 1513. Run the building process
e5bd0d98 152
79d580f2 153 make
154
1554. Run the installation process
156
77906c4c 157 a. If you have the permission to write into directories <i>/usr/include</i> and <i>/usr/lib</i>, run the following command:
79d580f2 158
159 make install
77906c4c 160 b. If you do not have this permission, you need to modify file *FREEIMAGE_SRC_DIR/Makefile.gnu*:
e5bd0d98 161
79d580f2 162 Change lines 7-9 from:
e5bd0d98 163
79d580f2 164 DESTDIR ?= /
165 INCDIR ?= $(DESTDIR)/usr/include
166 INSTALLDIR ?= $(DESTDIR)/usr/lib
167
168 to:
169
170 DESTDIR ?= $(DESTDIR)
171 INCDIR ?= $(DESTDIR)/include
172 INSTALLDIR ?= $(DESTDIR)/lib
173
174 Change lines 65-67 from:
175
176 install -m 644 -o root -g root $(HEADER) $(INCDIR)
177 install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
178 install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
e5bd0d98 179
79d580f2 180 to:
e5bd0d98 181
79d580f2 182 install -m 755 $(HEADER) $(INCDIR)
183 install -m 755 $(STATICLIB) $(INSTALLDIR)
184 install -m 755 $(SHAREDLIB) $(INSTALLDIR)
e5bd0d98 185
79d580f2 186 Change line 70 from: 
e5bd0d98 187
79d580f2 188 ldconfig
e5bd0d98 189
79d580f2 190 to:
e5bd0d98 191
79d580f2 192 \#ldconfig
e5bd0d98 193
79d580f2 194 Then run the installation process by the following command:
e5bd0d98 195
79d580f2 196 make DESTDIR=FREEIMAGE_INSTALL_DIR install
e5bd0d98 197
77906c4c 1985. Clean temporary files
79d580f2 199
18006a0f 200 make clean
79d580f2 201
18006a0f 202@subsection dev_guides__building_3rdparty_linux_3_4 VTK
79d580f2 203
18006a0f 204You can download VTK sources from http://www.vtk.org/VTK/resources/software.html
79d580f2 205
18006a0f 206### The building procedure:
79d580f2 207
18006a0f 208Download the necessary archive from http://www.vtk.org/VTK/resources/software.html and unpack it.
79d580f2 209
18006a0f 2101. Install or build *cmake* product from the source file.
2112. Start *cmake* in GUI mode with the directory where the source files of *VTK* are located:
79d580f2 212
18006a0f 213 ccmake VTK_SRC_DIR
e5bd0d98 214
18006a0f 215 * Press <i>[c]</i> to make the initial configuration
216 * Define the necessary options in *VTK_INSTALL_PREFIX*
217 * Press <i>[c]</i> to make the final configuration
218 * Press <i>[g]</i> to generate Makefile and exit
e5bd0d98 219
18006a0f 2203. Start the building of VTK:
e5bd0d98 221
18006a0f 222 make
e5bd0d98 223
18006a0f 2244. Start the installation of gl2ps. Binaries will be installed according to the *VTK_INSTALL_PREFIX* option.
e5bd0d98 225
18006a0f 226 make install
f3fb84ce 227
228@section dev_guides__building_3rdparty_linux_4 Installation From Official Repositories
229
230@subsection dev_guides__building_3rdparty_linux_4_1 Debian-based distributives
231
232All 3rd-party products required for building of OCCT could be installed
233from official repositories. You may install them from console using apt-get utility:
234
235 sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libxt-dev libxmu-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libfreeimage-dev libtbb-dev libgl2ps-dev
236
237To launch binaries built with WOK you need to install C shell and 32-bit libraries on x86_64 distributives:
238
239 # you may need to add i386 if not done already by command "dpkg --add-architecture i386"
240 sudo apt-get install csh libstdc++6:i386 libxt6:i386 libxext6:i386 libxmu6:i386
241
242Building is possible with C++ compliant compiler:
243
244 sudo apt-get install g++